docs: add reviewed architecture backlog and first execution wave

This commit is contained in:
Boki 2026-10-22 13:24:49 -04:00
parent b7aeca4888
commit 1148673245
75 changed files with 6435 additions and 0 deletions

View file

@ -0,0 +1,26 @@
# Reusable implementation-agent brief
This is a role instruction, not a new agent framework. It authorizes nothing on its own.
## Invocation packet
Planner supplies: task ID/file, manifest revision, approved ADR IDs, base commit, branch/worktree path, reserved file locks, predecessor merge commits, acceptance scenarios, baseline failures and authorized test/commit/PR permissions.
## Procedure
1. Confirm global execution authorization, task readiness/claim and architecture approval. Read the task, relevant ADRs, quality gates and actual code. If evidence has drifted, report it before changing scope.
2. Work only in the assigned worktree. Preserve user/unrelated changes. Do not edit canonical task status or shared contracts owned by another agent.
3. Reproduce the defect or establish the current behavior. Implement the smallest cohesive change and its regression tests. Keep useful calculations, fixtures and recovery behavior.
4. Use the approved financial core and contracts. Do not create fallback accounting, change rounding/clock/ownership policy or expose broker execution to strategies.
5. Run mandatory task tests plus relevant gates; use disposable DB/queues. Record exact commands and failures. A missing dependency or skipped test is not success.
6. Review your own diff for unrelated edits, stale documentation, artifacts/secrets and backward compatibility.
7. If commits/PRs are authorized, produce a focused commit and PR against the assigned integration branch, referencing task ID, dependency commits, tests and limitations. Otherwise leave changes uncommitted and hand off a diff; do not infer permission.
8. Request independent review. Do not merge yourself or mark done.
## Stop / handoff conditions
Architecture ambiguity, blocked dependency, unexpected shared-contract change, failing economic invariant, unavailable isolation or irreconcilable baseline drift: report task ID, evidence, attempted checks, smallest decision needed and safe remaining work. Do not silently widen scope.
Unfinished handoff includes branch/worktree, base and latest commit or uncommitted diff, files touched, tests run, failing case, fixture expectations and next concrete step. Do not discard unfinished work.
First-wave prompts and exact writable/read-only boundaries are in [FIRST-WAVE.md](../FIRST-WAVE.md). Merged IDs are not work items. Do not add a compatibility toggle to preserve a correctness defect, or populate missing benchmark counters with zeros.

View file

@ -0,0 +1,30 @@
# Reusable integration-agent brief
One integrator owns the shared integration branch and canonical contract sequencing. No two agents modify tightly coupled canonical financial contracts concurrently. The first-wave Rust legacy terminal fix and TS legacy fee guard are disjoint corrections, not concurrent design of the new contract.
## Isolation and claim rules
After owner approval, planner atomically assigns one task and write locks in the canonical manifest on the coordination branch. Create a branch/worktree from the recorded integration commit, for example `plan/C01-terminal-equity` and a sibling worktree. These are examples for later execution, not commands run by this planning task.
Each implementation worktree edits only its code scope, never task status. The planner alone writes status/assignment changes; implementation PRs cannot overwrite a stale manifest. Acquire both symbolic locks and concrete-file ownership. SQL migration numbering/registry is assigned by the integrator.
## Integration sequence
1. Require dependencies merged and ADRs approved. Shared contract tasks merge before their consumers; no “probably compatible” simultaneous F01/F02/F04 changes.
2. Require independent review and exact task acceptance evidence.
3. Rebase/merge onto current integration base in dependency order; handle textual and semantic conflicts together. For contract overlap, pause a branch and let the contract owner resolve the design—never choose a side blindly.
4. Run relevant combined native/TS/SQL/browser gates, plus economic/decision hash fixtures. Test mixed old/new stored data where compatibility is claimed.
5. Update task completion through planning owner only after tests pass on the integrated commit. Record commit, review and gate references.
6. Recompute readiness and release locks. Do not unlock downstream implementation merely because a PR exists.
PR creation, commits and merges require explicit execution authorization; this plan does not grant it. No force-reset of user work. Rollback uses a deliberate compatible deployment/commit, not destructive rewriting of historical financial state.
## Safe concurrency
Recommend **3 implementation agents maximum**, with one of them holding the single financial-core lane. A fourth concurrent slot can be a read-only reviewer when available; otherwise rotate review between implementation batches. Do not independently spawn nested implementation teams.
Typical parallel lanes: Rust financial owner; web/product owner; data/tests/benchmark or metadata owner. See [FIRST-WAVE.md](../FIRST-WAVE.md) for the four exact independent assignments; rotate the fourth through the three implementation slots. Shared API DTOs, `libs/core/types`, worker protocol, run service and SQL registry serialize when they overlap—even if task lock names differ.
## Failed integration
Leave task in review/blocked with explicit failing combined test and owner. Preserve worktree and artifacts. No status “done except integration.” Paper/live state is never used as an integration fixture.

View file

@ -0,0 +1,23 @@
# Reusable planning-agent brief
Maintain the backlog, not application code. Read manifest, completed/reviewed changes, approved ADRs and newly discovered evidence.
## Source of truth and state
Only `backlog/manifest.json` owns scheduling state, dependencies, assignments, priorities and write locks. Task files own behavior/scope/acceptance. Roadmap/index/graphs are views; update them after metadata changes, never use them as a competing status board.
Merged IDs are traceability redirects and may never be claimed. Deferred optimization requires its measured activation decision. `dependencies` gate implementation; `release_gates` gate feature activation, not component integration/done.
States: ready -> claimed -> in_progress -> review -> done. blocked is for an actual unmet code/approval/environment prerequisite with a recorded reason; deferred requires its explicit future gate. All tasks also obey global `execution_authorized`. Initial ready means code-ready **after plan approval**, not permission to act.
## Work cycle
1. Check repository/task evidence drift and dependency completion. A task is ready only when required commits are integrated, ADRs approved and resources available.
2. Select a small ready batch with disjoint actual files and locks; prioritize economic correctness and early web value.
3. Assign owner/worktree/base/lock metadata in one serialized coordination update. Supply the implementation invocation packet.
4. Track blockers with evidence, smallest unblock decision and safe alternatives. Do not call a difficult task blocked merely to abandon it.
5. On accepted integration, record commit/review/test references, mark done and recalculate the DAG. On scope split, create a stable new ID and update edges; do not reuse IDs.
6. For an ADR change, obtain owner approval and identify every affected contract/task before reopening work.
7. Keep the first-wave/dependency views consistent; validate unique IDs, all references, no cycles, valid statuses and approved decision gates.
Do not launch coding agents, commit, open PRs or change application files unless the owner has separately authorized execution. P06 remains deferred until the measured gate and owner go/no-go are recorded.

View file

@ -0,0 +1,21 @@
# Reusable independent review-agent brief
Review the assigned task/approved ADRs and implementation diff independently. Do not implement fixes or approve your own financial change.
## Required review
- Re-derive financial fixture expectations; do not accept the engine output as its own oracle.
- Inspect time availability, same-bar execution, pending reservations, fees/rounding, owner basis, risk bypasses, ordering, partial failure and terminal marking.
- Check crash boundaries, idempotent identities, restore-before-decision and per-effect state. Native state must not advance past a rolled-back SQL transaction.
- Check API/schema compatibility, legacy provenance, data immutability and loading/error/empty UX. New browser pages must use the same API/core.
- Check sandbox boundary, actor permissions and no AI-to-live path.
- Look for unnecessary abstractions, duplicated calculation/simulation, unjustified deletions and scope creep.
- Re-run focused tests independently where available. Verify benchmark comparison uses identical semantics and inputs.
## Output
Return Accept / Changes requested / Blocked, with severity, file/line evidence, violated task criterion and required test. State what was and was not run. Approval requires all in-scope mandatory gates or an explicit owner-approved waiver that does not waive financial correctness.
A reviewer may suggest a future task but cannot silently amend ADRs or expand this PR. Communicate contract-impacting findings to integration/planning owner.
Check that remaining-cost residuals, target/order-mode exclusivity, immutable decision barriers and RNG restore are explicit. Distinguish component tests from release gates; do not require later UI/metrics/cache work to approve an independently correct component. Do not call statistical reporting outside Rust a competing simulator when it only consumes authoritative financial outputs.