Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
df745a3
refactor: remove private subc runtime dependency
ahrav Aug 25, 2026
cffc09e
fix(mc-host): close three client boundary gaps from review
ahrav Aug 25, 2026
29e6f4a
fix: address second review round on the direct mc-host boundary
ahrav Aug 25, 2026
11ba1ef
style: satisfy biome on the files this branch moved
ahrav Aug 25, 2026
d79c109
fix(mc-module): bound the whole subscribe attempt and keep TimedOut
ahrav Aug 25, 2026
6f0a02c
test(evidence): re-pin the v84 crash-campaign implementation digest
ahrav Aug 25, 2026
0f1c5ba
fix(mc-host): retire the stream watcher on every settle path
ahrav Aug 25, 2026
35af65f
fix: close the fallback vocabulary and stop harness errors masking ca…
ahrav Aug 25, 2026
994e48c
fix(mc-host): accept any valid Ping priority and echo it in the Pong
ahrav Aug 25, 2026
4ed39dd
fix(mc-host): deliver a zero-length stream item instead of retiring
ahrav Aug 25, 2026
946d2e8
fix: address review quick-wins across tests, doctor guidance, and docs
ahrav Aug 25, 2026
803065e
fix: reject out-of-range timeouts, pre-cancelled streams, binary setu…
ahrav Aug 25, 2026
ef7980c
chore: regenerate the committed schema and re-pin the crash evidence
ahrav Aug 25, 2026
d504283
fix: report only spawned recovery, share the wire cap, coalesce statu…
ahrav Aug 25, 2026
879b6af
fix(mc-host): reject a pre-cancelled unary before admission
ahrav Aug 25, 2026
acba024
fix: close the five deferred client and discovery findings
ahrav Aug 25, 2026
fba57ff
fix(mc-host): enforce the channel-zero body cap and bound the auth de…
ahrav Aug 25, 2026
6307a6e
fix(mc-host): keep the client's send classification honest under races
ahrav Aug 25, 2026
d7257ba
fix(mc-host,mc-module): stop claiming settlement and stop replaying a…
ahrav Aug 25, 2026
0cc0959
Merge branch 'main' into task/direct-mc-host-boundary
ahrav Aug 25, 2026
c72b797
fix(mc-module): charge a JSON response body before materializing it
ahrav Aug 25, 2026
53318a8
fix(mc-host,mc-module): stop discarding terminals and stranding host …
ahrav Aug 25, 2026
d56e57c
docs(mc-module): describe how a JSON output is actually measured
ahrav Aug 25, 2026
ae5ccd7
fix(mc-module): keep a failed replay dial from erasing the ambiguity
ahrav Aug 25, 2026
9d404a4
fix: bound uncancellable discovery, gate cancelled firings, align sym…
ahrav Aug 25, 2026
c37b9bc
fix(e2e): skip Rust-mode suites on every non-Linux platform
ahrav Aug 25, 2026
8e7842e
fix: abandon cancelled route opens safely and redact auth proofs
ahrav Aug 25, 2026
c517967
fix(mc-module): count a fixture release only when the run resumes
ahrav Aug 25, 2026
539d731
fix(mc-host): reserve queued bytes for control frames
ahrav Aug 25, 2026
248e92c
fix: require proof a run stopped before fallback, and verify the Carg…
ahrav Aug 25, 2026
a743fb6
fix: declare the module's retained bytes and stop leaking launch iden…
ahrav Aug 25, 2026
0b572dd
fix(mc-module): charge the request tree before materializing it
ahrav Aug 25, 2026
b4f3f32
refactor(mc-host): single-source path hardening and frame charge admi…
ahrav Aug 25, 2026
066debe
refactor: derive shutdown admission from the token, single-source aut…
ahrav Aug 25, 2026
1dbeb52
refactor(mc-host): share the bounded frame-read mechanics
ahrav Aug 25, 2026
ff2923a
fix: repair the macOS build and refresh the stale crash-claims evidence
ahrav Aug 25, 2026
afe7ab0
fix(mc-host): create the test FIFO through a portable interface
ahrav Aug 25, 2026
527866f
fix(mc-host): release a route bound for an abandoned control open
ahrav Aug 25, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .beads/interactions.jsonl
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,6 @@
{"id":"int-957b99e48af7d10119aa3146ba385e7e","kind":"field_change","created_at":"2026-08-23T21:07:58.638698062Z","actor":"AhravDutta","issue_id":"magic-context-ymc.1","extra":{"field":"status","new_value":"closed","old_value":"in_progress","reason":"Closed"}}
{"id":"int-adf3e410823be79e2f65962c00ee00ac","kind":"field_change","created_at":"2026-08-24T13:41:22.526618118Z","actor":"AhravDutta","issue_id":"magic-context-ymc.3","extra":{"field":"status","new_value":"closed","old_value":"in_progress","reason":"Closed"}}
{"id":"int-fd51b14afbf32b43a54c33c665d47e22","kind":"field_change","created_at":"2026-08-24T20:56:41.646974108Z","actor":"AhravDutta","issue_id":"magic-context-c50.12","extra":{"field":"status","new_value":"closed","old_value":"in_progress","reason":"Compile matrix passed at main tip 574569d5; inventory matches evidence in docs/evidence/subc-compiler-closure/ (87 rows: 83 exact/3 changed/1 private-unknown). Completeness gate on c50.4 cleared."}}
{"id":"int-5eed966629542898b21c355dc0b781fb","kind":"field_change","created_at":"2026-08-25T06:56:29.585492666Z","actor":"AhravDutta","issue_id":"magic-context-c50.4","extra":{"field":"status","new_value":"closed","old_value":"in_progress","reason":"Implemented direct mc-host boundary: host-owned Rust wire/auth/discovery/client, direct McHandler adapter and historian, host-owned TS API, direct Rust/E2E fixtures, dependency/docs closure; workspace, TS, E2E, specialist and ponytail reviews complete."}}
{"id":"int-606a80a74abee403db373ff1892c729b","kind":"field_change","created_at":"2026-08-25T13:55:26.811161159Z","actor":"AhravDutta","issue_id":"magic-context-qhh","extra":{"field":"status","new_value":"closed","old_value":"open","reason":"All five landed in acba0244, each with a test that fails without it.\n\nHandshake deadline now starts before discovery, with the snapshot on the blocking pool under the shared budget. Connection file opens with O_NONBLOCK; the EAGAIN concern does not apply because checked_stat proves S_IFREG before any read. Control-request Cancel is no longer emitted at all, because a 0/0 identity has no legal frame and the host settles on its own deadline. Route handles publish under the lock close drains, with the closure recheck inside it; no route Goodbye is owed because close already sends the connection Goodbye. Replay reconnect releases the old generation first, which is safe because the frozen daemon id is a parameter rather than read off the old connection.\n\nTwo things the verification corrected. The FIFO test first passed for the wrong reason: open_parent requires an owner-only leaf parent, so a default-mode temp dir was rejected before open_file ran. With the dir chmodded to 0700 the un-fixed code hangs (timeout exit 124), confirming the block. The test now probes on a worker thread with a bounded join so the regression fails instead of wedging the suite.\n\nAlso learned while verifying: open_parent already does descriptor-relative per-component traversal with is_safe_ancestor on each, so the Rust reader does provide the ancestor safety the doc requires. The gap is TypeScript-only, as reported on that thread."}}
{"id":"int-c2635f98ed31c8e93f8f96b8f6d0a5ab","kind":"field_change","created_at":"2026-08-25T05:36:49.319396531Z","actor":"AhravDutta","issue_id":"magic-context-dc6","extra":{"field":"status","new_value":"closed","old_value":"in_progress","reason":"Closed"}}
60 changes: 50 additions & 10 deletions .beads/issues.jsonl

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ Magic Context is an `@opencode-ai/plugin` (entry `src/index.ts`) that rewrites t
- **Hidden subagents** (`historian`, `historian-editor`, `dreamer`, `sidekick`) do the heavy LLM work out of band; the transform itself does no LLM calls.
- **Runtime SQLite backend** (`src/shared/sqlite.ts`): `bun:sqlite` under Bun, `node:sqlite` (`DatabaseSync`) under Node (Pi) and Electron (Desktop). The non-Bun branch adds a savepoint-aware `transaction()` shim and `readonly`→`readOnly` mapping; otherwise identical. No native module, no prebuild.
- **Pi parity:** `packages/pi-plugin/` mirrors OpenCode semantics, importing shared core from `@magic-context/core`. Intentional divergences are tracked in `packages/pi-plugin/PARITY.md`. Provider prefixes are translated between canonical (OpenCode) and Pi configuration models via `src/shared/harness-provider-map.ts` at configuration read/write edges to keep shared model configurations portable. Pi implements session state inheritance on branch clone forks by copying filtered tags, compartments, and pending marker states, whereas OpenCode `/fork` does not yet inherit context state.
- **Rust module and host migration.** A harness-agnostic Rust workspace in `crates/` re-implements the cache-stability transform and autonomous historian. The current `ck-mc` production path still runs under the subconscious daemon (`subc`), while `crates/mc-host/` now provides the reusable directly linked host runtime that owns secure publication, authentication, wire v2 framing, global routes, bounded dispatch, and shutdown. The `McHandler` adapter, production binary wiring, and TypeScript client cutover remain staged follow-up work.
- **Experimental Rust runtime mode.** Gated by `transform_mode: "rust"`, currently routes the entire Magic Context transform pipeline for a project through the ck-mc Rust module over subc. The TypeScript layer serves as a coordinator that manages state sync, ordinal tracking, and Last Known Good (LKG) fallbacks.
- **Direct Rust host boundary.** A harness-agnostic Rust workspace in `crates/` implements the cache-stability transform and autonomous historian. `crates/mc-host/` owns secure publication, authentication, wire v2 framing, global routes, bounded dispatch, managed clients, and shutdown. `McHandler`, Synapse, and Broca compose directly under that host with no provider process or private `subc-*` runtime dependency. Production launcher wiring remains follow-up work.
- **Experimental Rust runtime mode.** Gated by `transform_mode: "rust"`, routes the Magic Context transform pipeline through the direct mc-host boundary. TypeScript remains coordinator for state sync, ordinal tracking, and Last Known Good (LKG) fallbacks.

## Layers

Expand Down Expand Up @@ -164,7 +164,7 @@ Background maintenance (V2: per-task cron scheduling). A process-wide 15-min tim

Migration v84 keeps `memories` as current production reader projection while claims hold durable semantic history. OpenCode, Pi, dreamer, historian, identity repair, and module-mirror adapters own their outer immediate transactions and call dependency-light `memory/storage-memory-claims.ts`; kernel composes claim revisions/evidence, non-cascading `legacy_memory_claims` crosswalk, `memories` projection side effects, operation envelope, `claim_change_outbox`, one project-generation bump, and cursor/checkpoint changes atomically. `memory/storage-memory-projection.ts` remains leaf dependency, avoiding facade/kernel cycles. Search, mural, dreamer task gates, injection, and module serialization still read only `memories`; current-claim reads are independent reconciliation/U8-U9 surfaces, never production fan-out reads.

Ship OpenCode plugin, Pi plugin, CLI, and `ck-mc` from same release before any process applies v84. Transaction-scoped claims capability makes held-open legacy semantic writers fail; v84 also takes over pending v22 identity work. Production nonempty eager cutoff remains zero until full calibration is reviewed, so lazy recovery uses `magic-context doctor --check-claims-backfill` then `magic-context doctor --retry-claims-backfill` and restarts all harnesses. Pre-commit migration death reruns from complete v82; post-commit death rolls v84 forward; fence refuses downgrade. Back up with SQLite backup API, or stop writers, checkpoint, and retain `context.db`, `context.db-wal`, and `context.db-shm` together. Archive/delete retire compatibility rows while immutable claims remain; neither promises erasure. Erasure needs future privileged purge protocol.
Ship OpenCode plugin, Pi plugin, CLI, and the directly linked mc-host component from same release before any process applies v84. Transaction-scoped claims capability makes held-open legacy semantic writers fail; v84 also takes over pending v22 identity work. Production nonempty eager cutoff remains zero until full calibration is reviewed, so lazy recovery uses `magic-context doctor --check-claims-backfill` then `magic-context doctor --retry-claims-backfill` and restarts all harnesses. Pre-commit migration death reruns from complete v82; post-commit death rolls v84 forward; fence refuses downgrade. Back up with SQLite backup API, or stop writers, checkpoint, and retain `context.db`, `context.db-wal`, and `context.db-shm` together. Archive/delete retire compatibility rows while immutable claims remain; neither promises erasure. Erasure needs future privileged purge protocol.

## Session modes

Expand Down
236 changes: 3 additions & 233 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 0 additions & 12 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# Magic Context Rust workspace — the harness-agnostic MC module (CK-in / CK-out)
# that runs under the subc daemon. Lives in-repo alongside the bun `packages/`
# (the session/tooling is cwd-bound, and the build needs this repo's cache-stability
# context); the dashboard's Tauri crate is its own standalone build, excluded here.
[workspace]
resolver = "2"
members = ["crates/mc-core", "crates/mc-store", "crates/mc-host", "crates/mc-module", "crates/mc-tokenizer", "crates/mc-shm-transport", "packages/mc-shm-native"]
Expand All @@ -19,14 +15,6 @@ cortexkit-store = { path = "../commons/crates/cortexkit-store" }
cortexkit-store-types = { path = "../commons/crates/cortexkit-store-types" }
cortexkit-lease = { path = "../commons/crates/cortexkit-lease" }

# subc wire contract + module SDK. Path-deps to the same sibling source so
# subc-protocol/transport unify with subc-client-rs's transitive use (no [patch]).
subc-protocol = { path = "../subconscious/crates/subc-protocol" }
subc-control = { path = "../subconscious/crates/subc-control" }
subc-transport = { path = "../subconscious/crates/subc-transport" }
subc-client-rs = { path = "../subconscious/crates/subc-client-rs" }
subc-core = { path = "../subconscious/crates/subc-core" }

# Internal crates.
mc-core = { path = "crates/mc-core" }
mc-store = { path = "crates/mc-store" }
Expand Down
Loading
Loading