View memory

Instructions for AI Assistants

Current state: Memory loaded
Next action: Read the memory content above. To search more, fetch /recall.
Fetch this URL: /memory/bd0da7cf-dc49-4a33-a966-20af00a635db

Memory

## Phase W1 Complete — Work Engineering Core Port (VERIFIED) **Date:** 2026-09-09 **Status:** **Phase W1 complete, all green** **Related:** Consolidated Implementation Plan (e38e72e0), Phase 0 Complete (e7fb47bb), Work Engineering Design Reconciliation (e9fa8b66) --- ## Code (repo, uncommitted) - **`src/workspace/we/types.ts`** — Vocabularies (`STATIONKINDS`, `FINALLOTVERDICTS`, `EDGERELS`, `GATEVERDICTS`, `ALLOCROLES`), `{ok,err}` envelopes, typed record interfaces (WorkObject, Contract, Workstation, Routing, Allocation, Evidence, Characteristic, Lot, Edge, Revision, RunLog). - **`src/workspace/we/engine.ts`** — `WorkEngineering` class over thin `WeDb` interface: - All **22 reference verbs** ported verbatim from `server.js` (error catalogue word-for-word). - **Callsign threading** — `by` field on all mutations, revisions, run_log entries. - **Hybrid contracts** — `defineContract` gains `inputs`, `outputs`, `rules`, `evidenceRequirements`, `operatorIndependence`; characteristics keep `target`+`method` and require `contractId`. - **`claimWorkstation`** — Enforced only at quality stations; `OPERATOR_NOT_BOUND` error if gate evaluated without prior claim. - **`operatorIndependence: 'required'`** — Enforced when set; rejects gate evaluation if same callsign did preceding production work. - **Rework re-evaluability** — Deliberate deviation from reference (see below). - **Dev-only `resetAll()`** — Guarded by `WE_ALLOW_RESET` env flag. - **Both fixtures verbatim** — `seedFixture` (meeting audio to notes) + `seedFixturePrReview` (PR review and merge). - **`src/workspace/workspace.ts`** — `SphereWorkspaceBase`: - WE tables in `ensureSql` (`records`, `edges`, `revisions`, `run_log`). - DO-side `work_items` table **dropped** (Q-H decision). [mikesecondbrain:1] - Flat verb RPC surface (`createWorkObject`, `defineContract`, `createWorkstation`, `defineRouting`, `addAllocation`, `recordEvidence`, `defineCharacteristic`, `startLot`, `evaluateGate`, `markLotVerdict`, `findMap`, `graphView`, `getRecord`, `linkRecords`, `reviseRecord`, `appendRunLog`, `getRunLog`, `getReport`, `seedFixture`, `seedFixturePrReview`, `resetAll`). - `allowReset` via `WE_ALLOW_RESET`. - **`src/env.ts`** — `WORKSPACE` optional (restores documented shape after `wrangler types` regen). --- ## Tests **`test/unit/work-engineering.test.ts`** — 15 proof-sequence tests over real SQLite (`node:sqlite`): 1. Quality independence (production station characteristic rejected) 2. Gate direction (failed gate blocks, no advance) 3. Rework re-eval (reworked lot can be re-evaluated, not dead-ended) 4. Multi-char all-pass (all characteristics must pass before advancing) 5. Supersession (revision creates new record, supersedes edge, old marked supersededBy) 6. Operator independence (when `operatorIndependence: 'required'`, same callsign rejected at quality gate) 7. Claim rules (quality station requires claim before gate) 8. Provenance (`by` field recorded on mutations/revisions/run_log) 9. Persistence (state survives fresh instance) 10. Reset guard (`resetAll` throws unless `WE_ALLOW_RESET=true`) 11. Follows chain (routing station order preserved via `follows` edges) 12. Lot auto-advance (production stations auto-advance, quality halts) 13. Invalid station kind (rejected) 14. Invalid gate verdict (rejected) 15. Invalid lot verdict (rejected) **Guard test extension:** `updated-at-coalesced` extended for WE `records` table (its own NOT-NULL rule). **Results:** `vitest run` → 126 files, **1518 passed / 1 skipped / 0 failed**; `npm run typecheck` clean. --- ## Deliberate deviations (decision-backed) 1. **Rework re-evaluability** — The reference dead-ends after `markLotVerdict('rework')` (subsequent `evaluateGate` returns `LOT_NOT_OPEN`). Per P4-002 decision ("back to queue"), reworked lots are now re-evaluable (lot verdict returns to `open`, blocked flag cleared, current step reset to failed station). [mikesecondbrain:2] 2. **Seed fixtures claim quality stations** — Reference fixtures do not call `claimWorkstation` before `evaluateGate` (claims were not required). Now, per Q-C decision (explicit claim at quality), both fixtures claim quality stations before gate evaluation. --- ## Worksphere log - **Run record:** `/runs/2026-09-09-w1-we-core-port.md` (+ memory `5ad3a24e`, canonical) - **IMPLEMENTED.md:** Updated with Phase W1 section --- ## Next: Phase W2 **Scope:** 1. **D1 `work_items` new columns:** `routing_id`, `workstation_id` (tracks lot's current station), `lot_id`, `contract_id`, `rejection_reason` (Q-D, Q-E). [mikesecondbrain:1] 2. **`start_work` join:** Idempotent `startLot` via DO stub; `working_on` tag = routing/station context. 3. **Status mirroring, lot authoritative (Q-E):** `open→open`, `blocked→blocked`, `accepted→review` (completable), `rework→open`, `rejected→closed` + `rejection_reason`. `complete_work` rejected unless lot accepted. 4. **`get_attention` enrichment for bound items:** Current station, gate state, next action. 5. **Grouped MCP tools (Q-I):** `we_brief/we_define/we_run/we_map`, Zod structured inputs, callsign-attributed. 6. **Promotion anchors:** On `markLotVerdict accepted` + quality evidence → derived memory entry with `part_of_project` edge to project anchor. 7. **`create_project` provisioning:** `/README.md` + `/contracts/_TEMPLATE.md`, `/decisions/_TEMPLATE.md`, `/runs/_TEMPLATE.md` + WE map bootstrap. 8. **Audit fixes:** Default-to-current-project for `recall`/`list_recent`/`list_documents`; `ingest` slug `"default"`→`personal`; store `create_work` description; `get_project` counts. --- **Note:** Phase W1 is now complete and verified. All 15 proof-sequence tests pass. Ready to proceed with Phase W2.

Tags: phase-w1, complete, work-engineering, core-port, verified, sqlite, tests, proof-sequence, phase-w2-next, volatility:durable, kind:episodic, status:canonical — Source: mcp — 2026-09-09 01:11:32 UTC

Connected memories

What would you like to do next?