Phase 0 and Phase 1 Report
Reporting period: fork bootstrap through the first working vertical slice. This report covers files created, files modified, architectural decisions, tests executed, results, known limitations, and next steps, as required for every phase.
Phase 0 — Upstream audit and fork architecture
Files created
docs/UPSTREAM_AUDIT.md— measured upstream facts, architecture summary, plugin conventions, build constraints, MCP investigation, and the gaps the fork fills.docs/ARCHITECTURE.md— the ordered map of the Avalanche AI runtime: composition, services, lifecycle, enforcement points, persistence, and dependency direction.docs/FORK_STRATEGY.md— repository topology, extension pattern, package inventory, upstream merge policy, decisions, and deliberate deviations.docs/IMPLEMENTATION_ROADMAP.md— phased plan with outcomes and exit criteria.docs/SECURITY_THREAT_MODEL.md— assets, trust boundaries, threats and controls, invariants, out-of-scope.docs/TESTING_STRATEGY.md— test layers, coverage map, commands, boot verification limits.docs/PHASE_0_1_REPORT.md— this report.
Files modified
- None in Phase 0 beyond the package scaffolding that follows (see Phase 1).
Architectural decisions
- Extend the upstream monorepo in place; no rewrite and no second runtime.
- One bundle (
@deepseek-ai/dsh-avalanche-app) overdsh-base, registered asPROFILE_TEMPLATES.avalanche. - Seven domains as separate packages because the build emits at most
index+startupper package. - Capability-based policy enforced in
tools/pre-execute; domains are data; routing is deterministic. - Evidence ledger and receipts are separate from the session log; receipts carry a fixed disclaimer.
Phase 1 — Shared runtime vertical slice
Files created
Packages (19, all under packages/avalanche/)
| Package | Source | Tests |
|---|---|---|
avalanche-schemas | src/index.ts, src/types.ts | — (types only) |
avalanche-context | src/index.ts | tests/context.spec.ts |
avalanche-memory | src/index.ts | tests/memory.spec.ts |
avalanche-policy | src/index.ts | tests/policy.spec.ts |
avalanche-evidence | src/index.ts | tests/evidence.spec.ts |
avalanche-verification | src/index.ts | tests/verification.spec.ts |
avalanche-network | src/index.ts | tests/network.spec.ts |
avalanche-tooling | src/index.ts | tests/gate.spec.ts |
avalanche-agents | src/index.ts | tests/routing.spec.ts |
avalanche-orchestrator | src/index.ts | tests/orchestrator.spec.ts |
avalanche-cli | src/index.ts (runner), src/startup.ts (parser) | covered by composition test |
avalanche-app | src/index.ts (profile constant), cordis.patch.yml | tests/loader-composition.spec.ts |
7 × avalanche-domain-* | src/index.ts each | covered by routing + composition tests |
Each package also ships package.json, generated tsconfig.json project references, and shipped-language locale/*.json metadata.
Other
docs/— the seven documents listed under Phase 0, each with a Simplified Chinese counterpart and a translation-pairing record; plusdocs/subsystems/avalanche.mdand its Chinese pair, which own the generated service and event reference.packages/avalanche/README.mdand 19 package READMEs with English/Chinese pairs, Model Experience or audited omission, Known Limitations, and Dev Notes.
Files modified (upstream)
packages/util/official-bundles/src/bundles.ts— onePROFILE_TEMPLATES.avalancheentry.packages/util/official-bundles/tests/official-bundles.spec.ts— expectation includes the new template.tsconfig.base.json— generated project references for the new packages.pnpm-lock.yaml— generated workspace lockfile.scripts/doc-standard.spec.ts,scripts/verify-package-readme-model-experience.ts— documentation-gate registries with the new group's audited README entries.scripts/gen-cordis-catalog.ts,scripts/gen-doc-graphs.ts,scripts/verify-subsystem-pages.ts— service and event partition entries pointing at the newdocs/subsystems/avalanche.mdpage.tsconfig.host.json— Host aggregate references for all 19 packages.packages/README.md,packages/README.zh.md— package-group table carries theavalanche/row.- Generated catalogs:
docs/config-catalog.md,docs/config-catalog.zh.md,docs/cli-help.md,docs/cli-help.zh.md,docs/module-graph.md,docs/module-graph.zh.md,docs/capability-seams.md,docs/capability-seams.zh.md,docs/event-producer-consumer.md,docs/event-producer-consumer.zh.md,packages/preset/agent-preset/skills/cordis-composition-reference/references/packages.md.
Architectural decisions
| Decision | Reason |
|---|---|
Policy gate registered in AvalancheTooling[Service.init] on tools/pre-execute | The executor is the one path every caller crosses; schema filtering and prompts are bypassable |
Gate fails closed when avalanchePolicy is absent | A missing policy must never mean "allow" |
Network-bound policy resolves networkArgument through a resolver supplied by avalancheNetworks | The catalog does not import the registry; the network named by the call is judged, not a static registration-time network |
avalancheNetworks binds tool registration and verifier registration through ctx.inject | Rows activate asynchronously; binding to service availability removes the startup race without making the registry unmountable standalone |
Evidence records every tools/result at the executor | The receipt cites what ran, not what the model said |
Receipt digest over canonical JSON of every field except digest; fixed disclaimer | Tamper-evident and honest about what it does not attest |
Approval fingerprint over sorted permissions + actor + reason + risk + optional task/network/environment; consume() single-use; decide() one decision | Prevents replay and request substitution |
| Orchestrator routing uses keyword scoring with id tie-break | Model-agnostic and assertable |
Task records write-through to tasksDir with a serialized queue; TaskHandle.done awaits the queue and the evidence flush | A later process must see the record and the receipt |
CLI splits into parser (/startup) and runner (index) | Upstream pattern; avoids reading services while rows are still activating |
| Read-only RPC allowlist enforced before the transport | A write cannot be smuggled through a tool argument |
Mainnet descriptor writeEnabled: false; policy denies tx:sign/chain:write/infra:operate on mainnet | This build never writes to mainnet |
Tests executed
pnpm exec vitest run packages/avalanche
Result:
Test Files 10 passed (10)
Tests 93 passed (93)
Per-file breakdown: routing 11, context 9, evidence 9, memory 12, network 12, orchestrator 10, policy 11, tooling 11, verification 5, + 3 composition tests.
Also run:
pnpm exec vitest run packages/util/official-bundles # 2 passed
pnpm run typecheck # 5/5 gates passed: Host Typert, host compiler, client compiler, host aggregate, client aggregate
Composition test detail
avalanche-app/tests/loader-composition.spec.ts boots the real shipped cordis.patch.yml through the real Loader over a test-only base tree, with only the model adapter and RPC transport substituted. It asserts:
- every shipped row activates (no unloaded entries);
- seven domains, five catalogued tools, baseline policy rules, and the
chain-idverifier are present; agent list --jsonprints all seven domains;- a task routes to
developer, executesavalanche_chain_statusagainst a stub Fuji transport, returns the scripted model text; - exactly one
tool-callevidence record exists, the receipt cites it, the granting rule isallow-read-and-generate, verification isverified/chain-id, and the disclaimer is present; - the task JSON and evidence JSONL persist; a second process
task inspectreads the record and a third processevidence verifyreportsevidence chain: ok.
Known limitations
- No built
lib/artifacts in this checkout. A literalpnpm exec tsx apps/cli/src/bin.ts --profile avalanche doctorfails in upstream base packages (typertbuild outputs missing) before avalanche rows load. The Loader composition test covers the same boot path in-process. A fullpnpm run buildproduces the artifacts and enables the smoke command. - Write/sign/execute path absent. Policy denies these capabilities; no executor exists. Phase 5.
- Simulation stage empty.
chain:simulateis an allowed class but no simulator ships in this phase. - Approval resume absent. Tasks park at
awaiting-approval; resume is Phase 5 with the write path. - Memory recall is lexical. No embeddings or vector search yet.
- Persistence is file-based. No PostgreSQL/Redis.
- No dashboard. Phase 4.
- No MCP integration. Investigated and planned as Phase 2.
Next steps
- Run
pnpm run buildin an environment with adequate memory, then bootdsh --profile avalanche doctorand record its output. - Phase 2: MCP documentation source behind the catalog with source-labeled evidence.
- Phase 3: transaction preparation + fork simulation + approval resume.
- Phase 4: Vite + React + TypeScript dashboard.
- Phase 5: Rust signer boundary and guarded Fuji-only write execution.
- Keep generated catalogs and translation records in sync as the package group evolves.