Skip to content

About

MiroFish-derived skill-native simulation for Codex and Claude with local temporal memory and no project-initiated generation API

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

MiroFish Logo

MiroFishCodex

Schema-driven multi-actor branch simulation and prediction for Codex and Claude

Native CI License: AGPL-3.0

English | 中文文档

Important

The native project path keeps state and embeddings local and is skill-native: no Zep Cloud, project-initiated generation API, or extra provider API key is read by this runtime. The current authenticated Codex or Claude product task tree is the sole generative harness. For each run, the broker leases at most one active task at a time; top-level subagents, if used, may collaborate only within that task and do not receive independent broker dispatches. That product may itself be remotely hosted, and its service boundary is outside this repository. MiroFish owns durable workflow state, local memory, retrieval, strict validation, and report reflection.

Data boundary

Component Data and network behavior
Native Python CLI Local SQLite and artifacts; no Zep, generation API, or nested model CLI
Codex / Claude host Performs reasoning and may be a remote product; task packets derived from private input may be processed by that host
BGE-M3 May download the pinned snapshot on first use, then embeds locally; never generates actions, reports, or prose
Legacy cloud path Explicit opt-in only; retains the historical Zep/API/UI stack for comparison

--local-files-only prevents embedding downloads. It does not turn a remote Codex or Claude product into a local model.

What changed

  • Zep Cloud removed from the native path. Documents, entities, aliases, temporal facts, episodes, actions, and vectors are stored in local SQLite.
  • No nested model harness. The runtime never launches codex, claude, Ollama, or an OpenAI-compatible generation endpoint. It emits immutable JSON tasks for the current product task tree to solve, one active broker lease at a time. Top-level subagents may assist only within that active task before the host returns its single response envelope.
  • No silent quality downgrade. BAAI/bge-m3@5617a9f61b028005a4858fdac845db406aefb181 is used only for multilingual retrieval and similarity scoring. It is not a local generative substitute for Codex or Claude, and quality mode fails closed if dense embeddings are unavailable.
  • Resumable and auditable. Content-addressed artifacts, explicit entity IDs, temporal provenance, write barriers, bounded validation retries, and real draft → critique → revise transitions make interrupted runs safe to resume.

The architecture and quality invariants are documented in Skill-native runtime architecture.

Architecture

Current Codex / Claude product task tree (sole generative harness)
  └─ mirofish-codex skill
       ├─ top-level session / subagents: collaborate on the active task
       └─ mirofish-native CLI: schema-driven, non-generative orchestration
            ├─ immutable task / response artifacts
            ├─ local SQLite temporal memory + BGE-M3 retrieval
            ├─ baseline / high-pressure / secret-change branches
            └─ report draft → critique → revise checkpoints

The native MiroFish-derived state machine is the non-generative orchestrator. This is schema-driven multi-actor branch simulation, not an OASIS-equivalent Twitter/Reddit action loop or the original ReportAgent harness. The Codex or Claude product task tree is the only generative harness. The broker keeps at most one task in progress per run. Top-level subagents may help solve that active task, but they do not acquire separate leases or advance adjacent state transitions; the host returns one response envelope before the next task can be leased. No coding agent is inserted under another model loop, so competing system prompts and tool harnesses do not fight for control.

Quick start: native skill runtime

Prerequisites

  • Python 3.11 or 3.12
  • uv
  • Codex or Claude with local skill support

Node.js, Docker, .env, Zep credentials, and an extra provider API key are not required for the native CLI. An authenticated Codex or Claude session is still required for reasoning.

1. Install the runtime

From the repository root:

cd backend
uv sync --no-dev
cd ..

2. Install the skill

Choose one or both:

python3 scripts/install_skill.py --codex
python3 scripts/install_skill.py --claude

The installer creates a safe symlink and refuses to overwrite an existing skill. Codex uses the cross-product user path ~/.agents/skills; the Claude option targets local Claude Code at ~/.claude/skills.

Restart the host if it was already open, then invoke the installed skill explicitly once:

  • Codex: $mirofish-codex
  • Claude Code: /mirofish-codex

3. Verify the quality profile

cd backend
uv run --no-dev mirofish-native doctor --quality --json

The first quality check may download BAAI/bge-m3. Use --local-files-only when network access must be forbidden and the model is already cached. The doctor flag covers that probe only; pass the same flag to init to enforce it for later resume and search operations.

4. Initialize a private run

The workspace must be an absolute path outside a Git worktree because it holds private source-derived artifacts.

uv run --no-dev mirofish-native init \
  --workspace /absolute/private/mirofish-run \
  --source /absolute/path/to/source.txt \
  --question "What should the simulation predict?" \
  --reflection-rounds 2 \
  --local-files-only \
  --json

init --local-files-only persists the embedding network policy in the private workspace, and every later command reuses it. That policy is immutable for the workspace; use a new workspace instead of changing it during a later init. Commands that actually need dense embedding or indexing fail closed when the pinned model is absent; lightweight state or graph reads need not load the model. Omit the flag only when the first embedding use is allowed to download it.

Then ask the current Codex or Claude product task tree to use the mirofish-codex skill and continue that workspace. The skill drives the step / resume loop and exposes one active task at a time. Any top-level subagents collaborate only within that task, and the host submits one strict response envelope before the broker advances.

For a manual inspection:

uv run --no-dev mirofish-native step \
  --workspace /absolute/private/mirofish-run \
  --json

uv run --no-dev mirofish-native status \
  --workspace /absolute/private/mirofish-run \
  --json

# Discover all committed run IDs after an interrupted init:
uv run --no-dev mirofish-native list-runs \
  --workspace /absolute/private/mirofish-run \
  --json

Submit a completed response envelope with:

uv run --no-dev mirofish-native resume \
  --workspace /absolute/private/mirofish-run \
  --response /absolute/private/response.json \
  --json

See the tracked skill instructions and task protocol for the exact loop and integrity rules. A copyright-safe synthetic smoke example is available for first-time setup checks.

Local evidence commands

uv run --no-dev mirofish-native search \
  --workspace /absolute/private/mirofish-run \
  --query "evidence to retrieve" \
  --limit 12 \
  --json

uv run --no-dev mirofish-native neighbors \
  --workspace /absolute/private/mirofish-run \
  --entity-id "explicit-entity-id" \
  --depth 2 \
  --json

uv run --no-dev mirofish-native timeline \
  --workspace /absolute/private/mirofish-run \
  --entity-id "explicit-entity-id" \
  --json

Every query is scoped to the active run before ranking, preventing memory from another run from entering the result set.

Blind N+1 benchmark

The native CLI includes a private, content-addressed workflow for preparing a shared context, freezing candidate continuations before target reveal, anonymizing labels, and recording plot-node, blind editorial, and BGE-M3 similarity scores.

Read the benchmark protocol before running mirofish-native benchmark prepare. Source text, target text, and full candidate prose must remain in a private workspace outside every Git worktree. This repository does not publish benchmark claims without recorded evidence.

Evidence at a glance

The current N=20 original-vs-native comparison used one shared 20-chapter context, froze candidates before target reveal, scored 10 strict plot nodes, and added one anonymous 0–100 editorial judgment plus BGE-M3 cosine.

Primary blind candidate Strict plot hits One-judge closeness BGE-M3 cosine
Codex Skill 1/10 43 0.7396102597
Original MiroFish + Qwen 1/10 30 0.7340445189

Kimi K3 and DeepSeek did not form eligible candidates by the primary cutoff. Their later runs are isolated as post-reveal diagnostics and never backfill the leaderboard. Across all four supplemental candidates, strict hits remained 0–1/10. The evidence therefore does not support calling this a reliable exact next-chapter predictor. Its more credible current use is non-canon branch exploration, character pressure testing, risk discovery, and macro-scenario analysis.

This is one book, one target chapter, one primary judge, and no repeated runs. It is not a general model ranking. A causal test of the multi-agent layer still needs the same model compared under direct generation, retrieval-only augmentation, and the complete workflow across multiple targets and judges. See the evaluation index for the current and historical evidence layers.

The historical direct-generation single-chapter result is documented in the N=12 direct-generation baseline. It did not run the original MiroFish Zep/OASIS/ReportAgent harness, and documents its one-sample, one-judge, length-compliance, and procedural-blinding limitations. See the implementation comparison for the fixed upstream and Offline-fork code audit.

After scores are committed, export only the prose-free public allowlist with:

uv run --no-dev mirofish-native benchmark export-public \
  --workspace /absolute/private/benchmark-run \
  --json

The export omits source, target, and candidate prose; plot descriptions and hit IDs; judge evidence and notes; arbitrary runtime metadata extensions; and the candidate mapping.

Optional legacy cloud mode

The historical Flask + OpenAI-compatible API + Zep Cloud path is retained only for explicit comparison. It is not installed or started by the native quickstart.

test ! -e .env && cp .env.legacy-cloud.example .env
# Fill in credentials only for this optional legacy comparison.
npm run setup:legacy
npm run dev:legacy

If .env already exists, back it up or merge the legacy fields explicitly; the guarded command above will not overwrite it.

Legacy Python packages live only in backend/requirements-legacy-cloud.txt, outside the native pyproject.toml and uv.lock. setup:legacy installs them into a separate backend/.venv-legacy environment because OASIS pins an older sentence-transformers release. The native .venv and BGE-M3 quality profile remain untouched.

Dockerfile and docker-compose.yml are also legacy UI deployments. The Dockerfile installs requirements-legacy-cloud.txt into the isolated legacy environment and starts npm run dev:legacy; Compose pulls the historical upstream container. Compose binds ports 3000/5001 to loopback only. The legacy API has no authentication layer and must not be exposed to an untrusted network. Its GitHub workflow validates a build manually but never publishes an image. This path may require the credentials above and does not run the skill-native CLI.

Upstream project and credits

This adaptation is based on the original 666ghj/MiroFish. The local-memory direction also references nikmcfly/MiroFish-Offline. Thanks to both projects for making their work available. The exact base and release relationship are recorded in UPSTREAM.md.

The original simulation work uses OASIS, created by the CAMEL-AI team. Upstream demos and media remain available from the original project and its live demo; those UI screenshots and deployments describe the upstream/legacy experience, not the native CLI.

License

AGPL-3.0. See LICENSE.

About

MiroFish-derived skill-native simulation for Codex and Claude with local temporal memory and no project-initiated generation API

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages