Phase 0 Baseline and Documentation Map

Codex·GPT-5.6-sol·kernelKain·yesterday·14hr 53min·4 Checkpoints·125 file changes·+5336/-3027·354.1K tokens
yesterday

# Phase 0 prompt — Protect the baseline and establish canonical documentation

Implement only Phase 0 of the Unfinished Business roadmap. This phase protects the current product, records its actual architecture and behavior, and establishes the documentation structure required by later phases. Do not implement the asynchronous Maker, redesign, new onboarding, recommendation engine, or deployment changes yet.

## Outcome

Produce a verified baseline and a canonical documentation map that later agents can update without creating contradictory plans. Preserve all current application behavior unless a minimal documentation/test-fixture correction is necessary to make the baseline reproducible.

## Inspect before editing

1. Read repository instructions and `docs/prompts/implementation-phases/README.md`. 2. Inspect `git status`, current branch/HEAD, recent history, manifests, lockfile, runtime configuration, source tree, tests, deployment configuration, and existing documentation. 3. Pay special attention to user-owned changes in `docs/ENGINEERING_BLUEPRINT.md` and `.backboard/`; preserve them and do not incorporate or delete them without clear evidence that they belong to this phase. 4. Run the existing typecheck, tests, build, and safe preflight. Record the exact baseline and distinguish local proof from unverified external integrations. 5. Inspect the persisted-state schema and identify migration and backup requirements without altering user data.

## Work to perform

- Create a short current-state architecture description covering browser, server, OpenCode boundary, persistence, Sentry, Render, and trust boundaries. - Record the current user journeys and failure states, especially OpenCode authentication and the synchronous Maker wait. - Create a canonical documentation ownership map. Use these future canonical names unless existing facts justify a focused alternative: - `docs/PRODUCT_BRIEF.md` - `docs/ARCHITECTURE.md` - `docs/IMPLEMENTATION_PLAN.md` - `docs/OPENCODE_INTEGRATION.md` - `docs/LOCAL_SETUP.md` - `docs/HOSTED_DEPLOYMENT.md` - `docs/TOOL_CATALOG.md` - `docs/UX_AND_VISUAL_SYSTEM.md` - `docs/OPERATIONS_AND_RECOVERY.md` - `docs/DEMO_AND_SUBMISSION.md` - `docs/DECISIONS.md` - `docs/CHANGELOG.md` - Create only the documents needed to establish ownership now. Do not duplicate complete content from legacy documents merely to populate files. - Add a migration table mapping every existing document to keep, revise, merge, supersede, or archive. Do not archive or delete legacy files in this phase. - Define state-schema versioning, backup, and forward migration rules for later phases. - Record supported OpenCode and Node versions as inspected facts. Mark assumptions and unstable external facts for re-verification. - Update the root README so it points to canonical documents while still preserving links needed for current behavior. - Add a decision-log entry explaining OpenCode-only scope and the distinction between local full execution, hosted demo, and private hosted deployment.

## Documentation requirements

At minimum, update or create the canonical architecture, implementation plan, decisions, and changelog documents, and update `README.md` plus `docs/prompts/README.md` when links or ownership change. Keep `docs/ENGINEERING_BLUEPRINT.md` authoritative until its content has been deliberately migrated in Phase 9.

Document:

- inspected facts versus proposed future state; - current risks and known blockers; - where each later phase must record its API, schema, UX, setup, operations, and release changes; - the exact commands that establish a clean local baseline.

## Non-goals

- No product feature implementation. - No prompt runtime rename. - No dependency additions or upgrades unless required to repair a broken baseline and explicitly justified. - No deployment, credential configuration, account changes, publication, or submission. - No destructive cleanup or blanket formatting.

## Verification and acceptance

- Existing behavior and persisted data remain intact. - `npm run typecheck`, `npm test`, and `npm run build` pass or a pre-existing failure is documented with evidence. - Documentation has one declared owner for every subject; there are no two documents both claiming to be the canonical future plan. - All legacy documents have a migration disposition. - README links resolve. - A later agent can identify current architecture, future architecture, phase order, migration policy, and documentation obligations without reading chat history.

Finish with the required phase handoff and stop. Do not start Phase 1.

yesterday·3.2s

I’m implementing Phase 0 only: first I’ll inventory the repository and its instructions, then prove the existing baseline, and finally make the smallest documentation-only changes needed for a canonical handoff. I’ll preserve docs/ENGINEERING_BLUEPRINT.md, .backboard/, application behavior, and persisted data.

I’m also using the Community Wisdom skill because this is a non-trivial repository/documentation baseline task; it requires a brief check of relevant developer experience before the final wrap-up.

The Community Wisdom gateway is not exposed in this session, so I can’t perform its DEV-source lookup without inventing provenance; I’ll proceed with the repository evidence and note that limitation in the handoff rather than substituting unrelated sources.

I’m now capturing repository state and reading all governing instructions before touching files.

The code inspection confirms the key baseline: React browser → Hono/Node API → authenticated OpenCode v2 client; project state is a single schema-version-1 JSON record with revision checks and one .previous snapshot; Maker currently holds the HTTP request open for up to three minutes while OpenCode runs, then inspects the diff and optionally runs node --test.

I’m running the four required local gates now. These establish local reproducibility only; they will not be presented as proof of real OpenCode inference, Sentry delivery, or Render deployment.

All required local gates pass: typecheck, 22 tests, build, and safe preflight. The build has a pre-existing 708 kB chunk warning; preflight proves CLI startup and local prerequisites only, with live OpenCode/model, Sentry, Render, Backboard, and Entire checkpoint integration still unverified.

One concurrent/user-owned repository change landed during verification: main advanced from 9dd4b9e to 2205774 (“Track OpenCode sessions with Entire on OpenCode 2”), absorbing the pre-existing .opencode plugin move. I’m treating that commit as external to Phase 0 and will not rewrite it.

The documentation structure is now clear. I’ll create six focused canonical files: architecture, implementation plan/ownership map, OpenCode integration, operations/recovery, decisions, and changelog. The remaining canonical names will be reserved in the ownership map and created only by the phase that has verified content for them. docs/ENGINEERING_BLUEPRINT.md remains authoritative legacy material through Phase 9; I will not edit it.

The canonical map now assigns one owner to every subject, gives every pre-existing Markdown document (plus README/LICENSE) an explicit disposition, and keeps uncreated owners reserved instead of filling them with duplicate prose. Relative links across all 28 Markdown files resolve.

I’m doing the clean-install verification sequence exactly as documented now, including npm ci, so the handoff can distinguish a reproducible lockfile baseline from the earlier checks against the existing install.

The clean install and all four gates pass. npm ci also surfaced six moderate-severity advisories in the complete dependency tree, while no dependency was changed. I’m checking whether those are production or development-only so the baseline risk statement is precise; Phase 0 will document, not upgrade.

Phase 0’s acceptance checks are satisfied: the clean install sequence passes, schema v1 data and its previous snapshot validate read-only, all relative links resolve, every pre-existing document has a migration disposition, and every canonical subject has exactly one declared owner. No product code, dependency, runtime prompt, deployment config, or persisted record changed.

I’m taking the final Git snapshot for the required handoff; I will not commit because this session did not explicitly authorize a phase commit.

Phase 0 handoff

Phase result: VERIFIED_UNCOMMITTED

Phase 0 is complete. No product features, dependencies, runtime prompts, deployment settings, APIs, or persisted records were changed.

Documentation completed

Created:

Updated:

The ownership map covers all requested canonical names, gives every existing document a migration disposition, and reserves later canonical files without creating duplicate stubs.

Preserved pre-existing work

  • ENGINEERING_BLUEPRINT.md remains authoritative legacy material through Phase 9 and was not edited by this phase.
  • .backboard/ and the implementation prompt pack were not modified.
  • A concurrent/user-owned commit advanced main during inspection to 2205774 (“Track OpenCode sessions with Entire on OpenCode 2”). It was not rewritten or incorporated into the Phase 0 diff.

Verification

The documented clean baseline passed:

Results:

  • Typecheck: passed
  • Tests: 22/22 passed
  • Build: passed; existing approximately 708 kB chunk warning remains
  • Preflight: exited 0 as PREFLIGHT_ONLY
  • Markdown links: all relative links across 28 files resolve
  • Migration map and canonical-owner completeness check: passed
  • Persisted state: read-only validation passed for schema v1/revision 6 and previous schema v1/revision 5
  • git diff --check: passed

npm audit reports six moderate Sentry-chain advisories through glob/minimatch, with no high or critical advisories. No breaking automated dependency fix was applied.

Migrations

  • State schema: none; remains version 1
  • API: none
  • Environment variables: none
  • User data: untouched
  • Backup and forward-migration rules are now binding in the operations document.

Remaining external checks

Live OpenCode inference and native permission behavior, Sentry delivery/source maps, Render deployment, Backboard, and Entire checkpoint capture remain externally unverified. The DevRelay Community Wisdom gateway was unavailable, so no unsupported community-source claims were added.

Git state

  • Branch: main
  • HEAD: 2205774012160d8355a3a7f22ebc37de27fd558f
  • Relation: one commit ahead of origin/main
  • Phase 0 changes remain uncommitted because no explicit commit authorization was given.

The exact Phase 1 prerequisite is review and repository-policy acceptance/commit of this Phase 0 documentation, followed by a fresh worktree and schema-v1 inspection. Phase 1 was not started.

Phase 1 prompt — Build a reliable asynchronous Maker and live Run Inspector

Implement only Phase 1 of the Unfinished Business roadmap. Replace the blocking Maker request with a durable asynchronous OpenCode run lifecycle and a user-visible Run Inspector. Reliability is the priority; do not begin the broad visual redesign or tool recommendation work.

Prerequisite

Verify Phase 0's baseline and canonical documentation exist and match the repository. Inspect current state rather than trusting a summary. If the state-schema migration or documentation ownership is unresolved, stop and report the blocker.

Outcome

Starting Maker must return immediately, persist an identifiable run and OpenCode session, stream understandable progress, survive refresh/restart, interrupt the actual OpenCode session when cancelled, and finish with evidence. A timeout must never silently lose the native session.

Inspect before editing

  • Read the current Maker frontend, experience service, OpenCode guide/client/operation helpers, persistence layer, API routes, tests, and relevant docs.
  • Verify the installed OpenCode client/server API for session creation, events, status, interrupt, permissions, diff, and usage. Use the pinned version's actual types/docs rather than memory.
  • Inspect current user data without mutating it. Design a forward migration and backup before changing stored records.
  • Preserve unrelated and user-owned changes.

Backend work

  • Introduce a durable run record with states such as QUEUED, CONNECTING, RUNNING, WAITING_PERMISSION, VERIFYING, SUCCEEDED, FAILED, CANCELLED, and UNKNOWN.
  • Make POST /api/runs validate authorization, persist the queued run, and return 202 with a stable run ID without waiting for model completion.
  • Persist the OpenCode session/message identifiers before sending work that can mutate files.
  • Run work through a bounded in-process coordinator appropriate to the current single-process architecture. Do not add Temporal or another service in this phase.
  • Subscribe to OpenCode events when supported; otherwise use the smallest safe status reconciliation required by the installed version.
  • Normalize events into a versioned, append-only application event shape with sequence/cursor, timestamp, category, public summary, redacted metadata, and evidence references.
  • Add authenticated SSE for run events with heartbeat, cursor/Last-Event-ID resume, snapshot resync, and terminal closure behavior.
  • On process restart, reconcile non-terminal runs against OpenCode rather than retrying them automatically.
  • Make cancellation call OpenCode's native interrupt API. Do not mark a run cancelled until the native outcome is observed or explicitly becomes unknown.
  • Make duplicate action IDs idempotent. Prevent double-submit and unsafe retries.
  • Record diff, verification results, duration, model/session identity, usage/cost when available, and honest limitations at terminal status.
  • Redact prompts, secrets, headers, cookies, environment values, and unrestricted tool arguments/results from stored events and telemetry.

Frontend work

  • Replace the global frozen waiting state with immediate run acknowledgement.
  • Add a Run Inspector drawer or tab showing queued, connection, session, model response summaries, tool activity, permission waits, file changes, verification, and final evidence.
  • Never show hidden chain-of-thought. Render operational facts and concise user-visible summaries only.
  • Reconnect after reload using the run ID and event cursor.
  • Provide clear cancel, retry-after-reconciliation, authentication repair, and terminal next actions.
  • Replace “This is taking longer than usual” with meaningful live state. A slow run may show elapsed time and the last confirmed event, but must not imply that nothing is happening.
  • Keep the existing stage workflow functional and accessible at narrow and wide widths.

Required tests

Add focused unit/integration tests for:

  • immediate 202 response and persisted queued run;
  • state transitions and invalid transitions;
  • SSE ordering, reconnect, gap resync, heartbeat, and terminal behavior;
  • refresh and server restart recovery;
  • actual native interrupt handling;
  • timeout becoming reconcilable UNKNOWN, not fabricated failure;
  • duplicate submission/idempotency;
  • OpenCode unavailable, authentication failure, provider limit, missing model, permission denial, verification failure, and malformed event;
  • event and Sentry secret redaction;
  • state migration and backup.

Use deterministic fakes at the boundary; do not require paid inference for automated tests. Run one harmless live OpenCode proof only when the invoking environment already has authorized access.

Documentation requirements

Update in the same change:

  • docs/ARCHITECTURE.md for the coordinator, event stream, persistence, and trust boundary;
  • docs/OPENCODE_INTEGRATION.md for session/event/interrupt behavior and version constraints;
  • docs/OPERATIONS_AND_RECOVERY.md for restart, reconciliation, cancellation, retention, and unknown outcomes;
  • docs/LOCAL_SETUP.md for required OpenCode server configuration;
  • docs/IMPLEMENTATION_PLAN.md with completed acceptance evidence and remaining work;
  • docs/DECISIONS.md for SSE and in-process coordination choices;
  • docs/CHANGELOG.md and README.md for visible Maker behavior.

If a canonical document does not yet exist, create it with only verified and phase-relevant content. Do not update only the old blueprint.

Acceptance

  • The user sees a saved run and first status within 500 ms under normal local conditions.
  • Refresh resumes the same run.
  • Restart reconciles rather than duplicating work.
  • Cancel invokes OpenCode interrupt.
  • Timeout cannot erase the native session reference.
  • A terminal result includes diff and verification evidence or explicitly explains why they are unavailable.
  • All automated checks pass and documentation matches the implemented API/state schema.

Finish with the required phase handoff and stop. Do not start Phase 2.

yesterday·5.3s

I’ll first re-audit Phase 0’s ownership map, migration policy, worktree, and current persisted state. The key gate is whether Phase 0 is now a stable repository baseline; if it remains mixed with unrelated uncommitted work in a way that makes schema migration unsafe, I’ll stop rather than layer Phase 1 over an unresolved baseline.

I’m also reusing the Community Wisdom skill for this non-trivial async/recovery design. I’ll only cite sources returned by its gateway; if that gateway is still unavailable, repository and pinned OpenCode evidence will remain the basis.

The DevRelay gateway is still not exposed, so I won’t invent community citations. I’m proceeding from the pinned OpenCode package, repository tests, and local type definitions.

Next I’m checking whether Phase 0 was checkpointed between turns and whether its schema/ownership policy is now a stable prerequisite.

Phase 0’s substantive prerequisite is satisfied: canonical ownership is explicit, schema v1 migration/backup rules are defined, and the existing state validates without mutation. Its files are still uncommitted, but the user’s Phase 1 instruction explicitly advances the roadmap and the blocking conditions named by this prompt are resolved. I’ll preserve the Phase 0 diff as a separate pre-existing layer and keep Phase 1 changes identifiable.

I’m now reading the pinned OpenCode 2.0.32 client types to design around its real session, event, and interrupt APIs.

The pinned client confirms Phase 1 can use supported APIs directly: global typed event subscription, durable session events, session.prompt with a caller-supplied message ID, session.wait, session.diff, session.get, permission events, usage/cost fields, and session.interrupt() returning whether interruption occurred. That lets the implementation persist both session and message IDs before the mutating prompt is sent.

I’m starting with the durable schema and migration layer, including a verified v1 backup manifest, before changing runtime behavior.

The durable foundation is in place: schema v2 adds append-only run/event records; v1 migration creates a checksum-verified backup and manifest before atomic replacement; workflow writes are serialized for the in-process coordinator. No live server has been started, so the existing local schema-v1 files remain untouched.

I’m now wiring the immediate 202, native event normalization, SSE resume, restart reconciliation, and native interrupt path into the UI.

The core Phase 1 lifecycle is now wired end to end. I’m at the verification pass: styling the inspector, compiling the current edits, then I’ll repair the existing fakes and add focused lifecycle, SSE, migration, recovery, interruption, and redaction tests before updating the canonical docs.

The existing 22-test suite still passes after the async conversion, and TypeScript now compiles. I’m adding the Phase 1-specific tests next; these will exercise the real HTTP contract and persistence coordinator with deterministic OpenCode fakes, including restart, timeout, interrupt, idempotency, and failure classification.

The new lifecycle suite is green: 42 tests now cover the immediate 202, idempotency, ordered/resumable SSE, heartbeat and terminal closure, restart recovery, native interruption, timeout-to-UNKNOWN, migration backup, failure modes, verification evidence, and event/Sentry redaction. I also tightened a cancellation race so a session still being created becomes UNKNOWN until it can actually be interrupted, rather than being falsely marked cancelled.

The documentation now reflects the implemented schema-v2 coordinator, SSE contract, native interruption, restart rules, local OpenCode setup, and ADRs. I found and fixed one UI concurrency issue during review: cancel/reconcile now fetch the latest project revision first, so live coordinator writes cannot make those buttons fail with a stale revision after a long run.