AVALANCHEAI
Phase 1 liveUpstream
DocsDeliveryPhase 0–1 report12 min read

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) over dsh-base, registered as PROFILE_TEMPLATES.avalanche.
  • Seven domains as separate packages because the build emits at most index + startup per 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/)

PackageSourceTests
avalanche-schemassrc/index.ts, src/types.ts— (types only)
avalanche-contextsrc/index.tstests/context.spec.ts
avalanche-memorysrc/index.tstests/memory.spec.ts
avalanche-policysrc/index.tstests/policy.spec.ts
avalanche-evidencesrc/index.tstests/evidence.spec.ts
avalanche-verificationsrc/index.tstests/verification.spec.ts
avalanche-networksrc/index.tstests/network.spec.ts
avalanche-toolingsrc/index.tstests/gate.spec.ts
avalanche-agentssrc/index.tstests/routing.spec.ts
avalanche-orchestratorsrc/index.tstests/orchestrator.spec.ts
avalanche-clisrc/index.ts (runner), src/startup.ts (parser)covered by composition test
avalanche-appsrc/index.ts (profile constant), cordis.patch.ymltests/loader-composition.spec.ts
7 × avalanche-domain-*src/index.ts eachcovered 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; plus docs/subsystems/avalanche.md and its Chinese pair, which own the generated service and event reference.
  • packages/avalanche/README.md and 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 — one PROFILE_TEMPLATES.avalanche entry.
  • 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 new docs/subsystems/avalanche.md page.
  • tsconfig.host.json — Host aggregate references for all 19 packages.
  • packages/README.md, packages/README.zh.md — package-group table carries the avalanche/ 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

DecisionReason
Policy gate registered in AvalancheTooling[Service.init] on tools/pre-executeThe executor is the one path every caller crosses; schema filtering and prompts are bypassable
Gate fails closed when avalanchePolicy is absentA missing policy must never mean "allow"
Network-bound policy resolves networkArgument through a resolver supplied by avalancheNetworksThe 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.injectRows activate asynchronously; binding to service availability removes the startup race without making the registry unmountable standalone
Evidence records every tools/result at the executorThe receipt cites what ran, not what the model said
Receipt digest over canonical JSON of every field except digest; fixed disclaimerTamper-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 decisionPrevents replay and request substitution
Orchestrator routing uses keyword scoring with id tie-breakModel-agnostic and assertable
Task records write-through to tasksDir with a serialized queue; TaskHandle.done awaits the queue and the evidence flushA 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 transportA write cannot be smuggled through a tool argument
Mainnet descriptor writeEnabled: false; policy denies tx:sign/chain:write/infra:operate on mainnetThis 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-id verifier are present;
  • agent list --json prints all seven domains;
  • a task routes to developer, executes avalanche_chain_status against a stub Fuji transport, returns the scripted model text;
  • exactly one tool-call evidence record exists, the receipt cites it, the granting rule is allow-read-and-generate, verification is verified/chain-id, and the disclaimer is present;
  • the task JSON and evidence JSONL persist; a second process task inspect reads the record and a third process evidence verify reports evidence chain: ok.

Known limitations

  • No built lib/ artifacts in this checkout. A literal pnpm exec tsx apps/cli/src/bin.ts --profile avalanche doctor fails in upstream base packages (typert build outputs missing) before avalanche rows load. The Loader composition test covers the same boot path in-process. A full pnpm run build produces 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:simulate is 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

  1. Run pnpm run build in an environment with adequate memory, then boot dsh --profile avalanche doctor and record its output.
  2. Phase 2: MCP documentation source behind the catalog with source-labeled evidence.
  3. Phase 3: transaction preparation + fork simulation + approval resume.
  4. Phase 4: Vite + React + TypeScript dashboard.
  5. Phase 5: Rust signer boundary and guarded Fuji-only write execution.
  6. Keep generated catalogs and translation records in sync as the package group evolves.