Commit Graph
587 Commits
Author SHA1 Message Date
james.maesandClaude Opus 4.7 2a872fc597 docs(session-state): point to GitHub Issues; preserve handoff narrative
Adds a note at the top declaring GitHub Issues as the live tracker.
Replaces the Pending Work bullet list with a crosswalk to issue numbers.
Narrative paragraphs (session-handoff history) preserved unchanged.

Refs #4..#63

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-12 14:17:38 -05:00
james.maesandClaude Opus 4.7 60f179cf39 docs(todo): deprecate TODO.md — issues moved to GitHub
All open work has migrated to GitHub Issues. This file is replaced by a
crosswalk from former sections to issue numbers. Historical content is
preserved in git history (see docs/TODO.md at commit 8d94c1c or earlier).

Refs #4..#63

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-12 14:13:07 -05:00
james.maesandClaude Opus 4.7 4f4a5581c1 docs(claude.md): declare GitHub Issues as canonical tracker
Adds a new "Issue tracking" section near the top declaring
github.com/KofTwentyTwo/Jarvis/issues as the canonical tracker for all
bugs, audit findings, and feature work going forward. docs/TODO.md is
retained for historical reference only.

Refs #4..#63 (migration epics + audit findings + carry-forward bugs
filed 2026-05-12).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-12 14:12:06 -05:00
james.maes 50c2783a8c feat(devoverlay): wire DevSnapshotEmitter end-to-end + add tabbed view
The DevOverlay panel has been silently rendering DevSnapshot.initial since
Phase 4 because three independent breaks left the data path open-circuit
(see .planning/audit-2026-05-12/devoverlay-diagnosis.md for the full trace).

Slice 2 closes all three:

1. AppDelegate constructs `DevSnapshotEmitter` in `installAgent` and
   stores it on the delegate. Provider/model is set from configStore
   so the header row shows the active provider rather than a blank.

2. The `.devOverlay` broadcaster subscriber that previously drained to
   `/dev/null` now calls `emitter.apply(event)` for every event. This
   produces real DevSnapshots that flow through the bounded output
   channel (capacity 32, .dropOldest — AGENT-10 observational seam).

3. `DevOverlayWindow` now accepts the live emitter + BootHealthOrchestrator
   + a HudState reader closure. It instantiates its own DevOverlayBridge
   and attaches the bridge to `emitter.output` so viewModel.apply is
   actually called as snapshots arrive.

Also reshapes the SwiftUI surface as a TabView with three observational
panes (Agent, Tools, Health). The Health pane is read-only — the Status…
menu remains the place to trigger re-probes. The Logs pane lands in
Slice 3 (live log stream).

ViewModel extends with `bootHealth` + `hudStateLabel` slices, each with
its own single-writer mutator and `private(set)` enforcement.

Verification:
- swift test --package-path packages/DevOverlay → 14/14 pass
- swift test --package-path packages/AgentCore --filter DevSnapshotEmitterTests → 9/9 pass
- bash scripts/check-app-builds.sh → PASS
- 18/18 boundary gates green
2026-05-12 14:11:19 -05:00
james.maes 8d94c1c398 docs(devoverlay): diagnose why the panel renders nothing
Three independent breaks identified:
1. DevSnapshotEmitter exists but is never instantiated in App/AppDelegate.
2. The .devOverlay broadcaster subscriber drains every event to /dev/null
   (AppDelegate.swift:1808-1813 — wired-but-dead per Phase 9 audit pattern).
3. DevOverlayWindow constructs a fresh viewModel(.initial) with no
   DevOverlayBridge attached, so viewModel.apply(_:) is never called.

Slice 1 of the dev-overlay-end-to-end work. Slices 2 (wire it up) and 3
(live log stream) follow.
2026-05-12 13:54:07 -05:00
james.maesandClaude Opus 4.7 a5999e2dde fix(memory): drop broken FK on facts.source_turn_id — closes Toby-fact persistence
Root cause of "facts never persist" surfaced during 2026-05-12 dogfood:

  ERROR [memory.orchestrator] memory applyOp failed: applyOpFailed(
    underlying: Replay.SQLiteError.stepFailed(
      code: 19, message: "FOREIGN KEY constraint failed"))

The schema declared:
  source_turn_id INTEGER REFERENCES turns(id)

But the writer at MemoryExtractionOrchestrator.swift:125 inserts:
  let turnIdInt: Int64 = stableHash(job.turnId.rawValue)

`TurnID` is a UUID-string wrapper; the writer FNV-1a-hashes it to an
Int64 for the integer column. The hash space and `turns.id`
(AUTOINCREMENT) are disjoint number systems by design, so every
INSERT into `facts` violated the FK and SQLite rolled back the row.

The BootHealth probe reports the symptom honestly ("26 turns, 0/0
facts") but couldn't flag this as a failure — 0 facts is the
legitimate empty-history case. The bug stayed invisible until the
user asked "is Toby a fact in the database?" and search returned
nothing despite asynchronous extraction running.

This bug was latent for the entire project history — the original
RESEARCH §1 schema specified the FK, but the writer was never wired
to use real `turns.id` rowids. Reintroducing the FK without first
fixing the writer (forward through MemoryStore.appendTurn returning
the rowid, then plumbed back to MemoryExtractionCoordinator) would
just re-break persistence.

Fix: drop the REFERENCES on `source_turn_id`. The column is now
documented as a "correlation tag", not a hard foreign key. The
`superseded_by REFERENCES facts(id)` constraint stays — that one
IS valid because supersede chains use `priorFact.id` (a real
AUTOINCREMENT rowid).

Existing DBs: `CREATE TABLE IF NOT EXISTS` won't ALTER an existing
table; the user must delete `~/Library/Application Support/Jarvis/
jarvis.db*` and relaunch. Their facts table has 0 rows so nothing
of value is lost. A proper migration framework (PRAGMA user_version)
is deferred to M-1+.

Follow-up (M-1+): plumb the real `turns.id` rowid through
`MemoryStore.appendTurn` → orchestrator state → coordinator →
applyOp so `source_turn_id` becomes a real FK again. Requires
changes across 4 files; not in scope for this hotfix.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-12 12:07:44 -05:00
james.maesandClaude Opus 4.7 b76327364d docs(style): code-commenting style guide — felt orientation in 30s
Research pass produced a 583-line normative style guide capturing
the project's commitment to in-code documentation over external
markdown. The adversarial benchmark: a new developer reading any
one file must understand WHY every non-obvious line exists,
without opening a Plan ledger or a PR description.

Synthesized from:
  * Apple's Swift API design guidelines + DocC
  * Code Complete / Clean Code / Knuth literate programming
  * Reference Swift OSS (swift-nio, swift-log, swift-async-algorithms)
  * Survey of existing Jarvis files to characterize current state

Coverage:
  1. Five principles (lead with what+why, audit IDs as footnotes,
     felt orientation, no comment rot, no fluff).
  2. Five comment shapes (file header, type docstring, method
     docstring, inline //, MARK: -) with good/bad/rewritten examples.
  3. ASCII diagrams for orchestration / state machines / multi-actor
     flows — when they pay for themselves and when they don't.
  4. DocC cross-references for jump-to-definition from comments.
  5. Concurrency / actor / single-writer invariants worth always
     calling out.
  6. "Before you edit" invariants block — explicit anti-patterns
     per load-bearing file.
  7. What NOT to comment.
  8. Comment-rot prevention.
  9. Migration plan — leads with AppDelegate (the install-chain
     cliff), then load-bearing actors, then leaf packages
     opportunistically. One file = one atomic commit.

Anti-goals (explicit): not building ARCHITECTURE.md, ONBOARDING.md,
or a wiki. The code teaches itself. The guide itself is meta
(documentation about how to comment) and is allowed at
.planning/code-commenting-guide.md as a planning artifact, not
runtime documentation.

Follow-ups (next sessions):
  * Add TL;DR section to CLAUDE.md so future agents inherit the
    convention automatically.
  * Apply the guide to AppDelegate.swift as the first atomic
    rewrite commit — proves the convention on the steepest cliff.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-12 11:57:02 -05:00
james.maesandClaude Opus 4.7 1557302e63 fix(build): force ProcessInfoPlistFile before pre-codesign
Symptom: app hard-blocks at boot with "JarvisEntitlementsVerified
missing/false" after every incremental build, even though the build
log shows pre-codesign writing YES into the bundle Info.plist.

Root cause: Xcode 26's new build system schedules the built-in
ProcessInfoPlistFile task (which copies App/Info.plist into
Contents/Info.plist) independently from postBuildScripts. On
incremental builds with no Swift compile work, ProcessInfoPlistFile
ran AFTER pre-codesign, codesign, post-codesign, AND
verify-codesign-settings — silently clobbering the bundle Info.plist
with the source one. Source App/Info.plist carries
<key>JarvisEntitlementsVerified</key><false/> by design as the
static-state default; pre-codesign is supposed to flip it to <true/>
inside the bundle. With the new ordering, the bundle ended every
build at <false/> (and the signature was also stale relative to
that plist, though codesign --verify happened to still pass).

Fix: declare $(TARGET_BUILD_DIR)/$(INFOPLIST_PATH) as an inputFile
of the pre-codesign phase, plus a per-build stamp file as its
outputFile. This forces Xcode to make ProcessInfoPlistFile a
prerequisite of pre-codesign, and chains codesign (also gaining
the stamp as inputFile) deterministically behind it. Xcode 26's
"mutable output but no other virtual output node" check rejects
naming the plist as both input and output of the same phase, so
the separate stamp file is required.

Verified: clean and incremental builds both produce a bundle
with JarvisEntitlementsVerified=true and a valid signature.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-12 11:50:56 -05:00
james.maesandClaude Opus 4.7 beb9d51aa5 test(agent-core): update qwen2.5-coder literal to q8_0 variant
Two test assertions still expected `"qwen2.5-coder:32b"` after commit
8d0a959 flipped ModelID.qwen25coder32b to
`"qwen2.5-coder:32b-instruct-q8_0"`. Same shape of fix as commit
5718bdd (qwen36 rename). The other "qwen2.5-coder:32b" occurrences
in NDJSONDecoderTests and OllamaImageBlockEncodingTests are
fixture JSON strings used as decoder input — not asserted against,
so they don't break.

After:
  swift test --package-path packages/AgentCore --filter LLMEventTests
  → 10/10 pass
  swift test --package-path packages/AgentCore --filter OllamaProviderTests
  → 38/38 pass

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-12 11:14:07 -05:00
james.maesandClaude Opus 4.7 740bed4cbf fix(round-4): tag-agnostic ollama probe + mcp probe counts in-process tools
Two false-positive degraded reports surfaced during the second
Round 4 dogfood run:

1. Ollama probe was exact-string matching against required model
   names. `requiredModels` had `"nomic-embed-text"` (no tag), but
   `/api/tags` returns `"nomic-embed-text:latest"` (with default
   tag) — so the probe reported "missing models: nomic-embed-text"
   even after `ollama pull` succeeded. Fix: when a required name
   has no `:tag`, accept any tag (`name == required OR
   name.hasPrefix(required + ":")`). Required names that DO
   include a tag (e.g., `qwen3.6:latest`) keep their strict match.

2. MCP probe was reading ONLY `runtime.client.registeredToolNames()`
   — the stdio side (3 helpers: get_clipboard, get_time,
   run_applescript). The other 4+ in-process tools (self-knowledge
   + memory) live in `InProcessToolRegistry` and are routed
   through `InProcessAwareToolDispatcher` (commit 1b7fb81's B-01b
   fix). Probe now reads both registries, unions the names, and
   reports the combined count. Evidence line breaks out stdio vs
   in-process counts so the operator can see the split.

Verified: app build clean, app target compiles. Re-launch should
show ollama=ok (all 3 models present) and mcp=ok (8 tools after
self-knowledge tools register at install step 15).

The Toby fix verification mid-dogfood: the model received the
degradation summary in its system prompt and truthfully reported
"my memory subsystem is currently degraded (nomic-embed-text is
missing)" instead of yesterday's fake "Got it" promise. Round 4
slice 3 confirmed working end-to-end.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-12 10:29:58 -05:00
james.maesandClaude Opus 4.7 a9531e65e3 feat(round-4): menu-bar icon turns red when subsystems are degraded
Slice 4 of Round 4 — the visible polish. With Slices 1–3 the agent
preamble + non-dismissible banner cover the "agent must know +
user must see" loop, but a closed HUD with no banner visible can
still hide the warning. This slice paints the menu-bar icon red so
the warning is glanceable from anywhere on the screen.

Option A from the slice plan (single-writer-safe):

- `MenuBarIconController.applyHealth(_ health: OverallHealth)` paints
  `button.contentTintColor = NSColor.systemRed` for `.loud` and
  `.critical`, clears the tint for `.ok` and `.soft`. Template images
  recolor automatically with `contentTintColor` so no second icon
  asset is needed.
- `currentHealth: OverallHealth?` exposed read-only for tests.
- `AppDelegate.runBootHealth` calls `menuBarController?.applyHealth(
  snapshot.overallHealth)` after computing the degradation summary,
  so the icon updates on every probe sweep (cold boot + Status panel
  re-probe).

Single-writer invariant for HudState (HUD-08) is intact:
`contentTintColor` lives on `NSStatusItemButton`, not in HudState.
`scripts/check-single-writer-hudstate.sh` is green.

1 new test in MenuBarIconControllerTests:
  * test_applyHealthTintsRedForLoudAndCritical — exercises all four
    OverallHealth cases and asserts contentTintColor toggles correctly.

Boundary gates 18/18 green; App target compiles cleanly.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-11 15:59:48 -05:00
james.maesandClaude Opus 4.7 23b4ca7712 feat(round-4): agent system prompt knows when subsystems are degraded
Slice 3 of Round 4 — the Toby-the-dog fix. With Slice 1 the probes
report severity and with Slice 2 banners route by severity, but the
critical behavioral change is here: the agent's system prompt itself
must carry the degradation truth so the model can't confidently lie
about features that don't work.

The Toby case in detail: user said "remember my dog Toby is a golden
retriever". The Ollama probe correctly reported missing nomic-embed-text
(degraded). The memory extractor tried to embed Toby, the embed call
failed, no row was inserted in `facts`. But the agent's system prompt
said "you are Jarvis with memory" and the model answered "Got it —
Toby." A lie, dressed up as competence.

Implementation:

- `AgentOrchestrator` gains a private `var degradationSummary: String?`
  + a public `setDegradationSummary(_:)` actor-isolated setter. Mutable
  because installAgent runs BEFORE runBootHealth in the boot order;
  the orchestrator is constructed with `nil` and AppDelegate pushes
  the summary in post-construction. Re-probes from the Status panel
  update the value mid-session.
- `runTurn` prepends the summary BEFORE `composedSystem` (which already
  includes the UntrustedWrapper nonce + locked self-aware preamble),
  so the warning lands at the very top of the system message — outranks
  the preamble, outranks presence/memory enrichment.
- `AppDelegate.runBootHealth` now calls
  `orchestrator.setDegradationSummary(buildDegradationSummary(snapshot:))`
  after every probe sweep. The builder produces text like:

    CRITICAL — SUBSYSTEMS DEGRADED:
    - memory: failed (vec0 missing) — DO NOT promise to use memory
    - ollama: degraded — missing models: nomic-embed-text
    Be honest. Do not claim to use tools that are unavailable. Do not
    pretend memory works if it doesn't.

  When every subsystem is `.ok`, the function returns `nil` and the
  orchestrator's behavior is identical to pre-Round-4.

- Cache-hints invariant preserved: the locked preamble is ~700 chars,
  the worst-case degradation summary is <500 chars; sum stays well
  under the 4096-char Anthropic cache-eligibility boundary so adding
  the summary doesn't unintentionally flip `cache_control` emission.
  CacheHintsEligibilityTests/preambleDoesNotEnableCacheUnintentionally
  remains green.

4 new tests in AgentOrchestratorDegradationPreambleTests (all pass):
  * DP1: initial summary threaded into first turn's system message
  * DP2: nil summary leaves prompt unchanged (no "CRITICAL" / "DO NOT")
  * DP3: setDegradationSummary updates the next turn's prompt
  * DP4: setting summary back to nil clears it from the next turn

Boundary gates 18/18 green. `swift test --package-path packages/AgentCore`
runs 242/240 (4 new minus 2 pre-existing unrelated failures from
qwen2.5-coder model-ID literal drift, present before Round 4).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-11 15:47:58 -05:00
james.maesandClaude Opus 4.7 79955b67b7 feat(round-4): non-dismissible banners for critical subsystem failures
Slice 2 of Round 4. With Slice 1 the probe layer now reports severity;
this slice routes severity to the banner system so the user CANNOT
silently dismiss a "your memory is dead, Jarvis will lie to you" warning.

- `BannerContent.nonDismissible: Bool` (default false).
- `HUDBanner` hides the dismiss X when `content.nonDismissible == true`.
- `HUDBannerCoordinator.dismissCurrent()` no-ops on non-dismissible
  banners; the banner stays on screen until programmatically cleared
  (`clear()` on app quit, or a re-probe finding the subsystem healthy
  enqueues a different banner that pre-empts it).
- Two new presets:
  * `bootHealthCritical(subsystem:reason:)` — priority 1, non-dismissible.
    Title format: "Memory: critical failure". Body promises that the
    agent will be warned not to rely on this subsystem (Slice 3).
  * `bootHealthLoud(subsystem:reason:)` — priority 3, dismissible.
- Existing `bootHealthFailed(...)` preset kept as backwards-compat
  fallback (no current call sites after this slice).
- `AppDelegate.enqueueFailedBootHealthBanners` rewritten to iterate
  every non-ok subsystem and route by severity:
    .critical → bootHealthCritical + `[system] CRITICAL` log line
    .loud     → bootHealthLoud
    .soft     → no banner (Status panel only)
  Previously only `.failed` cases enqueued banners, which silently
  dropped `.degraded` (the Toby case) entirely.

Two new tests in HUDBannerCoordinatorTests cover the new behavior:
  * test_nonDismissibleBannerIgnoresDismiss
  * test_criticalBannerPreemptsLowerPriorityCurrent
(Note: `xcodebuild test -only-testing JarvisAppTests` is pre-existing-
broken on this checkout due to onnxruntime static-link duplication —
confirmed by `git stash` before this slice. The test code compiles
cleanly via the regular App build; SPM-target tests for the
AgentCore-side severity model are green.)

Boundary gates 18/18 green. `swift test --package-path packages/AgentCore
--filter BootHealthOrchestratorTests` → 13/13.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-11 15:36:43 -05:00
james.maesandClaude Opus 4.7 cfd469f72b feat(round-4): probe severity model — ok/soft/loud/critical
Round 4 of boot-health work. The Toby-the-dog incident — Jarvis said "Got
it" while the embedder model was missing and the fact never persisted —
proved that Round 2's probe banner was too quiet. Probes were already
reporting `.degraded` correctly; what was missing was a way for the App
layer to route a critical failure differently from a soft one (e.g.,
non-dismissible banner for memory off vs. silent Status row for camera
TCC not yet requested).

This slice introduces a severity axis without changing behavior:

- `FailureSeverity { critical, loud, soft }` on `ProbeStatus`'s non-ok
  cases (degraded/failed/unknown). `.ok` carries no severity.
- `ProbeStatus.severity` accessor (nil for `.ok`).
- `BootHealthSnapshot.overallHealth: OverallHealth { ok, soft, loud,
  critical }` — worst severity wins; `.ok` only if every subsystem ok.
- Each concrete probe annotates its failure modes:
  * Memory: failed → .critical (agent grounding; the Toby case)
  * Anthropic: missing/empty key → .critical (agent can't run)
  * Ollama: missing models → .loud (fact extraction broken, chat fine)
  * Voice: mic denied → .loud; dormant install → .soft
  * Vision: TCC denied → .soft (vision is optional)
  * MCP: 0 tools → .critical; <minimum → .loud
  * Replay: init failed → .critical; missing file → .loud
  * Webview: mismatched/timedOut → .critical; sentHello → .soft
- DormantSubsystemProbe gains `severity` parameter (default .soft);
  AppDelegate wires memory-dormant as .critical.

No behavioral change yet — banners still treat all failures equally;
the agent system prompt is unchanged. Slices 2 + 3 land those.

Tests: 13/13 in BootHealthOrchestratorTests pass, including 4 new tests
for overallHealth + severity accessor + JSON roundtrip with severity.
2 pre-existing failures in LLMEventTests/OllamaRequestBodyTests are
unrelated (qwen model-ID literal drift from commit 8d0a959, present
before this slice — confirmed via git stash).

Boundary gates 18/18 green.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-11 15:24:43 -05:00
james.maesandClaude Opus 4.7 b2f0abb670 fix(round-2): await probe registration inline to close runAll race
registerBootHealthProbes was spawning 8 fire-and-forget Task blocks,
each doing `await bootHealthOrchestrator.register(...)`. Then
runBootHealth called `await bootHealthOrchestrator.runAll()` —
which could fire BEFORE any register Task landed, yielding an empty
snapshot. Worst case: silent failure (no log lines, no banners,
empty Status panel).

The dogfood pass on commit 67748f5 happened to land all 8 register
Tasks before runAll fired (race won), but that's accidental — the
JS task queue scheduling is not load-bearing.

Fix: convert registerBootHealthProbes to `async` and await each
register call inline. runBootHealth then awaits the helper before
calling runAll. The orchestrator's runAll fan-out continues to use
TaskGroup for parallel probe execution, so this change has no
runtime perf impact.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-11 14:35:00 -05:00
james.maesandClaude Opus 4.7 67748f5336 feat(round-3): Status… menu item + NSPanel — live re-probe on open
New AppKit panel (NSPanel + SwiftUI hosting view) renders the live
BootHealthSnapshot, re-probes on every appearance, and offers
"Re-probe all" + "Copy report" buttons. Operator/dev tool, not a
user-facing surface — AppKit deliberately so it doesn't ride the
R3F render pipeline.

Anti-fake-status carries forward from Round 2: the panel's `.task`
modifier fires a fresh `runBootHealth()` sweep on every open, never
showing a cached boot snapshot. Cmd+R re-probes; Cmd+Shift+C copies.

Non-modal: NSPanel with [.titled, .closable, .resizable,
.nonactivatingPanel] + makeKeyAndOrderFront(_:) — no runModal calls.
scripts/check-no-modal-presentation.sh stays green.
isReleasedWhenClosed=false so the user can close and re-open without
re-creating the model (preserves "Copied X B" caption + last
snapshot across opens, in addition to surviving the AppKit
"window deallocs on close" default that would otherwise crash on
second open).

Files:
  - App/MenuBar/StatusPanel.swift (new):
    * StatusPanelModel — @MainActor ObservableObject, owns the
      snapshot + isProbing + copyConfirmation @Published state.
      `probeRunner` closure injected so "Re-probe all" hits the
      production AppDelegate.runBootHealth() path (single source
      of truth — panel + boot use the same code).
    * StatusPanelView — SwiftUI body. Scrollable rows, header
      with spinner during probe, footer with re-probe + copy
      buttons + caption.
    * SubsystemRow (private) — glyph (✓/⚠/✗/?), name, status
      label, latency, evidence, reason. Colors per status
      (green/orange/red/gray). Multi-line evidence + reason.
    * StatusPanel: NSPanel — hosts the SwiftUI view, `present()`
      method centers + brings front + activates app.
  - App/MenuBar/MenuBarContextMenu.swift:
    * `build` now takes a `statusAction:` closure (5th param).
    * "Status…" NSMenuItem between "Settings…" and "Show Dev Overlay".
  - App/AppDelegate.swift:
    * statusPanel: StatusPanel? lazy property.
    * openStatusPanel() method — lazy-creates panel on first click,
      passes self.runBootHealth as the probe runner closure.
    * installMenuBar's MenuBarContextMenu.build call updated for
      the new param.
  - Jarvis.xcodeproj/project.pbxproj: PBXBuildFile + PBXFileReference
    for StatusPanel.swift, added to MenuBar PBXGroup + Sources phase.

Verification:
  - bash scripts/check-app-builds.sh: PASS
  - bash scripts/check-no-modal-presentation.sh: OK
  - bash scripts/check-install-order.sh: PASS
  - bash scripts/check-no-leftover-stubs.sh: PASS

Dogfooding next: cold-launch → right-click menu bar icon → Status…,
verify rows render with concrete evidence (mic device name, model
ID list, etc.); click Re-probe and confirm rows refresh with new
latency values; click Copy report and paste into a text editor to
verify JSON is well-formed and complete.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-11 14:12:37 -05:00
james.maesandClaude Opus 4.7 687b80b3f0 feat(round-2): boot-phase health probes — NOT FAKED, structured logs
After all install Tasks join, runs one live probe per subsystem and
emits structured `BootHealth: subsystem=X state=Y latencyMs=Z evidence="..."`
log lines. Any subsystem reporting .failed enqueues a non-modal banner
via HUDBannerCoordinator (priority 3 — sits between hotkey-bind-failed
and ollama-url-rejected). The snapshot is stored on bootHealthOrchestrator
so Round 3's Status menu can read + re-probe.

Anti-fake-status invariant is type-level: ProbeStatus is a sum type with
.ok / .degraded(reason:) / .failed(reason:) / .unknown(reason:) — every
non-ok case carries a reason string, so a snapshot can never report
state=unknown without explaining why. A probe that can't execute MUST
return .unknown — never .ok with a fake evidence line.

New types in packages/AgentCore/Sources/AgentCore/BootHealth.swift:
  - ProbeStatus, ProbeOutcome, BootHealthProbe protocol
  - SubsystemHealth (Codable for Round 3 "Copy report"), BootHealthSnapshot
  - BootHealthOrchestrator actor — parallel TaskGroup fan-out,
    registration-order-preserved snapshot, injectable clock for tests

Eight concrete probes in App/Boot/BootHealthProbes.swift:
  - MemoryBootHealthProbe — MemoryStatsStoreAdapter.getMemoryStats round-trip
  - AnthropicBootHealthProbe — Keychain structural check (no billable
    network call at boot; Round 3 panel offers explicit network re-probe)
  - OllamaBootHealthProbe — GET /api/tags, 3s timeout, asserts qwen3.6 +
    qwen2.5-coder + nomic-embed-text all present
  - VoiceBootHealthProbe — AudioGraphOwner state + mic TCC
  - VisionBootHealthProbe — camera TCC + DiscoverySession (read-only,
    does NOT prompt TCC per RESEARCH §Example 2)
  - MCPBootHealthProbe — runtime.client.registeredToolNames count
  - ReplayBootHealthProbe — replay.sqlite presence + parent-dir writability
  - WebviewBootHealthProbe — WebviewBridge.handshakeState (.armed = live)
  - DormantSubsystemProbe — placeholder for subsystems whose actor was nil
    at probe-registration; reports .unknown honestly rather than skipping

AppDelegate wiring (step 16, runs after selfKnowledgeInstallTask which
transitively awaits every other install Task):
  - bootHealthOrchestrator: BootHealthOrchestrator stored property
  - bootHealthTask: Task<Void, Never>? cancelled in applicationWillTerminate
  - runBootHealth() async: registers probes (idempotent — re-probes from
    Round 3 reuse the existing registry), runs, logs, enqueues banners
  - emitBootHealthLog / enqueueFailedBootHealthBanners helpers

Tests (packages/AgentCore/Tests/AgentCoreTests/BootHealthOrchestratorTests.swift):
  - 8/8 passing (210ms wall — 3×200ms parallel probes prove TaskGroup
    fan-out works; serial would be 600ms+)
  - Coverage: runAll invokes every probe, snapshot preserves registration
    order, parallel execution timing, lastSnapshot persistence, .failed
    propagation, .unknown not coerced to .ok, deterministic clock
    injection for latencyMs, JSON round-trip for all 4 ProbeStatus variants

Verification before commit:
  - swift test --package-path packages/AgentCore --filter
    BootHealthOrchestratorTests: 8/8 PASS (0.210s)
  - swift test --package-path packages/Memory --filter
    MemoryExtractorTests: 11/11 PASS
  - bash scripts/check-app-builds.sh: PASS
  - 18/18 boundary gates: PASS

Dogfooding next: cold-launch + grep system.log for `BootHealth:
subsystem=` lines; force a failure (e.g. kill Ollama) and verify
banner appears. Status menu (Round 3) is next session task.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-11 14:03:24 -05:00
james.maesandClaude Opus 4.7 5718bdd820 test(memory): rename qwen25Coder32B test to qwen36
Matches commit 8d0a959 model flip — extractor default is now
ModelID.qwen36 ("qwen3.6:latest"). The previous test name + assertion
were stale and failed on `swift test --package-path packages/Memory`
with the "Optional(qwen3.6:latest)) is not equal to (qwen2.5-coder…)"
diff. No production code change.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-11 14:02:57 -05:00
james.maesandClaude Opus 4.7 70dd0d41c6 docs(handoff): scope Rounds 2 (boot health) + 3 (status menu) for fresh session
Context-budget hand-off. Round 1 (model split) shipped in 8d0a959. The
'NOT FAKED — 100% real only' ethos is preserved as the load-bearing
design constraint for both deferred rounds.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-11 10:37:40 -05:00
james.maesandClaude Opus 4.7 8d0a959a19 feat(model): qwen3.6 for memory extractor; q8_0 for agent-loop fallback
Round 1 of the post-D-5/D-6 model strategy split. The user has both
`qwen3.6:latest` (~22GB MoE) and `qwen2.5-coder:32b-instruct-q8_0` (~32GB)
pulled. CLAUDE.md previously pinned the entire local-model strategy to
the base `qwen2.5-coder:32b` because of an April 2026 Ollama tool-call
bug affecting Qwen 3 / 3.5 / Gemma 4. That ban was correct then; today
(2026-05-11) it isn't.

**Empirical retest 2026-05-11:** POST /api/chat (non-streaming) against
qwen3.6:latest with a representative `apply_memory_ops` tool definition
returned a clean tool_calls array, well-formed JSON args, no leaked
<think> tags. Upstream Ollama appears to have closed the relevant
issues (#14493 / #14601 / #14745 / #15315) in the interim. Documented
in ModelID.qwen36 doc comment.

Two-model strategy:

- **MemoryExtractor default → qwen3.6:latest** (`ModelID.qwen36`)
  Single-turn, single-tool, no cap recovery — the lowest-risk place to
  validate the newer model. If extraction stays stable for a few days
  of dogfooding, we revisit the agent-loop fallback.
- **Agent-loop Ollama fallback → qwen2.5-coder:32b-instruct-q8_0**
  (`ModelID.qwen25coder32b`'s rawValue is now the Q8_0 variant the user
  already has — higher fidelity than the default Q4_K_M, same model
  family, same tool-call wire format). The agent loop has multi-turn
  tool chains, cap recovery, tool_choice=none paths, and streaming all
  in scope — kept conservative until Qwen3.6 is verified there too.

Changes:
- packages/AgentCore/Sources/AgentCore/ModelID.swift
    + `qwen36` constant for qwen3.6:latest with empirical retest doc.
    ! `qwen25coder32b` rawValue is now `qwen2.5-coder:32b-instruct-q8_0`
      (same constant name, the Q8_0 raw value). All ModelID.qwen25coder32b
      consumers pick up the change automatically.
- packages/Memory/Sources/Memory/MemoryExtractor.swift
    - `model: ModelID = .qwen25coder32b` → `.qwen36`.
    Docstring updated to explain the empirical retest + why the
    extractor is the safest place for the newer model.
- packages/Harness/Sources/Harness/Runners/LiveOllamaRunner.swift
    `requiredModelID` constant now sources from
    `ModelID.qwen25coder32b.rawValue` so a future single-edit on the
    canonical model name propagates here automatically. Doc updated to
    point at the q8_0 variant + ~32GB pull size.

User-facing note: no model pulls required for this commit; both
models are already on the user's machine.

Round 2 (boot-phase health check) and Round 3 (Status menu dialog)
deferred to a fresh session for context budget — handoff doc to follow.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-11 10:36:30 -05:00
james.maesandClaude Opus 4.7 cb584a2ac8 feat(d5d6): real memory database — vec0 statically linked, hard-fail boot, stats tool
Closes D-5 / D-6 (sqlite-vec dylib bundling) carry-forwards from the
2026-05-04 audit by adopting jkrukowski/SQLiteVec as a SPM dependency.
The package's CSQLiteVec target compiles sqlite3.c + sqlite-vec.c into
one statically-linked C target with `core_vec_init()` registering vec0
as an auto-extension. All sqlite3_* calls in Replay's SQLiteConnection
and Memory's MemoryStore resolve to this bundled SQLite (vec0 always
available) instead of Apple's stripped /usr/lib/libsqlite3.dylib.

The retired hand-rolled approach (dlsym pathway + JARVIS_VEC0_STUB_PATH
env-flag + Bundle.module placeholder text file) never worked on macOS
because Apple stripped sqlite3_load_extension from the system libsqlite3.
Memory init has been silently dormant since Phase 7 (2026-04 onward),
which is what made B-02 (history threading) appear permanently broken
to the user during dogfooding even after the 48ad8d6 tactical patch
landed.

Live verification 2026-05-11: fresh launch with empty jarvis.db creates
schema, persists turn rows across submits, B-02 multi-turn context
resolves correctly ("what breed is Toby?" → "Golden Retriever" after
prior turn established Toby is a Golden Retriever), and the new
get_memory_stats tool reports `turnsCount=6, vecVersion=v0.1.6,
sqliteVersion=3.51.0`.

Changes:

- packages/Replay/Package.swift
    + SQLiteVec SPM dependency (from: "0.0.14")
    + CSQLiteVec product wired into Replay target
- packages/Replay/Sources/Replay/SQLiteConnection.swift
    - import SQLite3
    + @_exported import CSQLiteVec
    All sqlite3_* call sites unchanged — linker now resolves to our
    bundled sqlite3 with vec0 statically linked in.
- packages/Memory/Package.swift
    + SQLiteVec SPM dependency (named product so MemoryStore can import
      CSQLiteVec directly for the core_vec_init() one-shot call)
    - resources: PLACEHOLDER.txt copy (defunct vec0.dylib stub slot)
- packages/Memory/Sources/Memory/MemoryStore.swift
    - import SQLite3 → import CSQLiteVec
    + _vecAutoExtensionRegistered static-let one-shot: calls
      CSQLiteVec.core_vec_init() which registers vec0 via
      sqlite3_auto_extension on the first MemoryStore construction.
      Idempotent (static-let initializer fires exactly once).
    - loadVecExtension(on:) dlsym/JARVIS_VEC0_STUB_PATH/Bundle.module
      pathway (retired; ~70 lines removed)
    Updated docstring to reflect the new hard-fail boot policy.
- packages/Memory/Sources/Memory/Resources/PLACEHOLDER.txt — deleted
- App/AppDelegate.swift installMemory()
    Reverses Track-D D-1 (75a10be, 2026-05-04): MemoryStore.init failures
    are now FATAL via Logger.critical + TCCAlertService.presentHardBlock
    + NSApp.terminate. The graceful-degradation path that kept the app
    booting with memoryStore=nil hid the entire B-02/B-04/B-05 silent-
    failure bug class. Aligns with the 2026-05-07 API-first pivot
    thesis: "no silent failures".
    `store` is now non-optional throughout installMemory; downstream
    callers no longer need `if let store = store`.
- packages/MCP/Sources/MCP/InProcess/GetMemoryStatsTool.swift (new)
    + MemoryStatsDispatching protocol
    + MemoryStats Codable struct (turnsCount, factsTotal, factsActive,
      sessionsCount, dbFileBytes, vecVersion, sqliteVersion,
      lastTurnAtUnixMs, lastFactAtUnixMs)
    + GetMemoryStatsTool conforming to InProcessTool
- App/MCP/InProcessMemoryAdapters.swift
    + MemoryStatsStoreAdapter — bridges the protocol to MemoryStore's
      public queryRowCount / querySingleString seams and FileManager
      for the on-disk file size. Read-only, no confirmation.
- App/AppDelegate.swift installSelfKnowledgeTools()
    + Registers GetMemoryStatsTool with MemoryStatsStoreAdapter.
- packages/Memory/Tests/MemoryTests/*
    Retired the JARVIS_VEC0_STUB_PATH XCTSkipUnless guards from 9 tests
    (vec0 is always available now — no need to env-gate). Rewrote
    MemoryStoreTests to drop the now-impossible "init throws when vec
    missing" case and assert facts_vec virtual table creation +
    vec_version() readback. Added seedTurnRow helper to
    MemoryStoreApplyOpTests so the now-enforced
    `facts.source_turn_id REFERENCES turns(id)` foreign key is honored
    in tests that previously passed when FK enforcement was dormant.

Test summary: Memory full suite 91 tests, 10 skipped (env-gated real-
Ollama tests), 0 failures. App target builds clean. Substrate verified
end-to-end via live launch (vec_version: v0.1.6 logged at boot;
get_memory_stats returns actual schema row counts).

Pending D-7 carry-forward: ollama pull nomic-embed-text (~270MB) for
embedder; user already has qwen2.5-coder:32b-instruct-q8_0 which is
a higher-quality variant of the project's hardcoded
qwen2.5-coder:32b — small ModelID config delta to follow.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-11 10:25:56 -05:00
james.maesandClaude Opus 4.7 48ad8d631c fix(b-02): thread recent turns into AgentOrchestrator messages array
Carry-forward bug B-02 (live evidence 2026-05-07): conversation
continuity broken — "yes" / "why 4.5?" lose prior turn context because
AgentOrchestrator.process(_:) built [system, user(input.userText)]
with no history fetch.

Tactical patch outside the M-0..M-7 migration sequence, per
JARVIS-API-MIGRATION-PLAN.md §3 and UQ-2 (option B). Lands on develop
directly. M-4 (Memory surface) will reframe this path against the new
API contract but the user-visible bug closes today.

Substrate gap discovered + addressed in-scope. The `turns` table was
unwritten (schema present at MemorySchema.swift, FTS5 trigger ready,
read API at MemoryStore.recentTurnsForSession, but no INSERT site
anywhere in the codebase). The migration plan assumed turn writes
existed; they did not. Patch adds the missing writer plus the read
side wiring.

Changes:

- packages/Memory/Sources/Memory/MemoryQueries.swift
    + turnInsertSQL — single-row INSERT into turns
- packages/Memory/Sources/Memory/MemoryStore.swift
    + appendTurn(sessionId:role:content:source:createdAt:)
    Single-row INSERT; FTS5 trigger mirrors content into turns_fts
    automatically. T-06-05-03: function MUST NOT log content.
- packages/AgentCore/Sources/AgentOrchestrator/AgentOrchestrator.swift
    + PriorTurn struct + SessionHistoryLookup typealias
    + emptySessionHistoryLookup default (preserves pre-B-02 test setups)
    + sessionHistoryLookup ctor parameter
    Replaces the [system, user] messages-array build with prior-history
    hydration: system + chronological prior user/assistant rows + current
    user. Lookup throws -> warning log + empty history (matches D-3
    PriorFactsLookup resilience contract).
- App/AppDelegate.swift
    + sessionHistoryLookup closure: recentTurnsForSession(limit: 10),
    reverse DESC -> chronological, filter to user/assistant only, return
    [PriorTurn]
    + extends existing turnContent flush closure with appendTurn calls
    (rides on memory-extraction drain path; assistant row offset +1 ms
    so DESC + id-tiebreaker preserves user->assistant order)

Tests:

- packages/AgentCore/Tests/AgentOrchestratorTests/HistoryThreadingRegressionTests.swift
    HT-1: third turn includes prior user/assistant pairs in chronological
    order. 3/3 PASS.
    HT-2: empty-history default produces [system, user] (pre-B-02
    baseline preserved).
    HT-3: three-turn happy path emits zero LLMProviderError
    .streamTruncatedFinal events. Pins R-006 / Phase E gate behavior:
    patch grows messages array, not finalSystem, so
    CacheHints.eligibleForSystemPrompt(finalSystem) is unchanged.
- packages/Memory/Tests/MemoryTests/MemoryStoreAppendTurnTests.swift
    AT-1: appendTurn round-trips via recentTurnsForSession.
    AT-2: user/assistant pair reverses to chronological.
    AT-3: session_id scoping isolates rows.
    AT-4: turns_fts trigger fires on append.
    All env-gated on JARVIS_VEC0_STUB_PATH per existing MemoryStore-test
    convention; skip cleanly without vec0.dylib.

Verification:

- check-app-builds.sh PASS.
- Boundary gates sampled (check-no-leftover-stubs, applescript-confirm,
  corpus-secrets, bus-protocol-version, single-memory-mutated-emit,
  single-writer-hudstate) PASS.
- AgentCore affected-subset (Submit/Retry/TextEnd2End/CapRecovery/
  HistoryThreading) 26/26 PASS, 0 failures.
- Memory full suite 92 run, 23 skipped (env-gated), 0 failures.

Degradation contract: when MemoryStore is nil (dormant memory — vec0
or Ollama unavailable), turn persistence is also dormant; the
appendTurn call is guarded by memoryStore != nil. When D-5/D-6 close
and memory comes up live, persistence activates without further code
changes.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-11 08:50:40 -05:00
james.maesandClaude Opus 4.7 46590cd9aa docs(architecture): API design swarm output — v1.0 contract locked
Six-agent design swarm executed end-to-end on 2026-05-07 evening per
.planning/architecture/HANDOFF-2026-05-07.md. The architectural pivot
to API-first reaches lock state: v1.0 = JARVIS-API-DESIGN-v0.1.md +
JARVIS-API-DESIGN-v0.2.md (UQ-1..UQ-5 answered).

Swarm output (.planning/architecture/):

  - INVENTORY.md (~190 capabilities, file:line cited; ALIVE/DEAD/
    DEFERRED/RETIRED-CANDIDATE classification)
  - JARVIS-API-DESIGN-v0.1.md (1036 lines; 7 surfaces — Turn / Voice /
    Memory / Vision / Settings / Diagnostics / Self; CQRS framing;
    TurnID universal correlation; typed Results)
  - REVIEW-API-CORRECTNESS.md (21 findings: 2 BLOCKING, 5 HIGH)
  - REVIEW-MIGRATION-RISK.md (19 findings: 1 BLOCKING, 7 HIGH;
    M-0..M-7 cutover sequence)
  - REVIEW-TEST-CONTRACT.md (16 findings: 2 BLOCKING, 5 HIGH; harness
    shape recommendation)
  - JARVIS-API-DESIGN-v0.2.md (synthesis delta; every critic finding
    dispositioned ACCEPT/DEFER/USER-DECISION; UQ-1..UQ-5 locked in §5)
  - JARVIS-API-TEST-CONTRACT.md (~70 scenarios across 7 surfaces +
    cross-surface; B-02..B-08 reproduction matrix)
  - JARVIS-API-MIGRATION-PLAN.md (M-0..M-7 + B-02 tactical patch;
    ~52 distinct gates; 19-26 engineer-day estimate)
  - README.md (artifact index + reading order)

Locked decisions:

  - UQ-1: runtime gate JARVIS_HARNESS=1 (single binary)
  - UQ-2: B-02 tactical patch outside migration + streamTruncated
    regression test; B-04 stays in M-6
  - UQ-3: explicit Voice.synthesizeTurn(turnId:text:tier:) command
  - UQ-4: Settings owns ALL configuration mutation; Voice retains only
    runtime-control verbs (pttDown/pttUp/cancelTTS/synthesizeTurn);
    bargeIn migrates to Turn surface
  - UQ-5: parametric harness mandated — every scenario runs
    .inProcessActor AND .jsonRoundTripWebView

Tools/jarvis-diag/ — Swift Package skeleton authored by Phase 5:
type signatures + scenario stubs only, no implementation logic.
Compiles green (swift build under Tools/jarvis-diag/). M-0 step 3
wires it against packages/JarvisAPI/ once that package exists.

Constraints honored: zero code changes outside .planning/architecture/
and Tools/jarvis-diag/. No fixes to B-02..B-08 inline. Parallel agents
wrote disjoint files (.continue-here.md anti-pattern preserved).

Next session: cross-AI peer review of v1.0 (GPT-5 Pro / Gemini 2.5 Pro
/ fresh Opus), then B-02 tactical patch on develop, then M-0 (pre-
migration gates), then M-1 (Self surface) on its own feature branch.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-07 16:21:45 -05:00
james.maes b36e8ebbe5 docs(handoff): architectural pivot to API-first — close session 2026-05-07
After two days of fix → test green → relaunch → still broken loop, the
verification gate (executor self-reports + boundary gates) cannot detect
substrate failures. Today's substrate fixes (B-01a / B-01b — tool catalog
enumeration + dispatch routing) shipped and live-verified, but live testing
surfaced B-02..B-08: history threading, camera click, voice input, TTS
output, chat scroll, voice menu, model-name paraphrase. Stop-loss decision:
pivot to API-first architecture.

This commit packages the session-end state for clean handoff:

- .planning/architecture/HANDOFF-2026-05-07.md — primary handoff doc.
  Specifies the 6-agent design swarm (inventory → architect → 3 critics in
  parallel → synthesis → test contract + migration in parallel) that the
  next session dispatches. Goal: JARVIS-API-DESIGN.md v1.0 +
  test contract + migration plan, implementation-ready by midnight.

- docs/SESSION-STATE.md — updated with 2026-05-07 session-end state and a
  ▶ Next Session pointer to the handoff. Earlier 2026-05-04 entry preserved
  below the line.

- docs/TODO.md — top-of-file pivot directive + B-01 closures + B-02..B-08
  carry-forward + Phase 10 status + housekeeping loose ends.

Branch: develop @ 1b7fb81 (B-01b dispatch routing fix). Tree clean.
Substrate alive for tool calls; remaining bugs deferred to fix against
the new API contract once locked.
2026-05-07 14:01:11 -05:00
james.maes 1b7fb81408 fix(10-02c): wire InProcessAwareToolDispatcher into runtime — closes B-01b
Prior B-01a fix (e0c0310) wired tool catalog ENUMERATION so the model gets
schemas for in-process tools. But ROUTING was still broken: MCPRuntimeWiring's
ToolRegistry only knew about the 3 stdio tools (get_time / get_clipboard /
run_applescript), so when the model emitted tool_use for get_active_audio_route
the inner MCPToolDispatcher returned "tool unknown" and the model surfaced the
failure as visible chat text ("the audio route tools are erroring out").

This commit lands the dispatch wire-up. With the types from 0961fef, 6503b23,
3cf0d39 already in place:

- App/AppDelegate.swift: eager-default-init inProcessToolRegistry at property
  declaration so the SAME actor reference is shared between installMCP (passes
  it to MCPRuntimeWiring.build for the composite dispatcher) and installMemory
  / installSelfKnowledgeTools (register tools into it). Refactor installMemory
  to populate INTO the existing registry via a new populateMemoryTools helper
  rather than constructing a fresh one. The pre-existing
  buildInProcessToolRegistry static delegates through the same helper for
  back-compat.

- App/MCP/MCPRuntimeWiring.swift: build() takes a new inProcessRegistry
  parameter (defaulted nil for tests). When supplied, the inner stdio
  MCPToolDispatcher gets wrapped by InProcessAwareToolDispatcher so name-routing
  picks in-process tools first, falls through to stdio. Confirmation gating,
  bus emission, and observer hooks fire identically on both paths because the
  composite sits INSIDE ConfirmingToolDispatcher's outer chain.

- .planning/phases/10-self-awareness-diagnostics/10-02c-PLAN.md: skeleton plan
  documenting the surgical fix.

Build: swift test --package-path packages/MCP PASS (91/91 XCTest + 6 swift-test).
bash scripts/check-app-builds.sh PASS.

Live verification deferred to user — relaunch + ask "what mic are you using?"
expects real device name in reply (no JSON blob), tool_use + tool_result for
get_active_audio_route in the log tail.
2026-05-07 13:12:23 -05:00
james.maes 0961fef40b feat(10-02c): add InProcessAwareToolDispatcher composite for B-01b dispatch routing
- Composite ToolDispatcher: name-routes between InProcessToolRegistry (memory
  + four self-knowledge tools) and inner stdio dispatcher (MCPToolDispatcher).
- Sits INSIDE ConfirmingToolDispatcher's chain so confirmation gating, bus
  emission, and observer hooks fire identically on both paths.
- In-process result bytes flow through the same SanitizeForModel.prepareForBoundary
  + ToolResultObserver pipeline as stdio results (audit-trail parity).
- Tools registered AFTER composite construction are still routable because
  the composite holds the registry actor reference and queries by name on
  every dispatch (resolves the installSelfKnowledgeTools-runs-after-installAgent
  install-order wrinkle).
- Closes 5/5 cases in InProcessAwareDispatchRoutingTests.
2026-05-07 11:19:13 -05:00
james.maes 6503b23301 feat(10-02c): add InProcessConfirmationCache for sync confirmation lookup
- Lock-protected Set<String> mirror of registered tools' requiresConfirmation flags.
- InProcessToolRegistry.register(_:) now writes through to the cache so the
  upcoming InProcessAwareToolDispatcher can answer requiresConfirmation(toolName:)
  synchronously from a nonisolated context (ToolDispatcher protocol contract).
- OSAllocatedUnfairLock: low-overhead, available since macOS 13.
2026-05-07 11:19:09 -05:00
james.maes 3cf0d396ea test(10-02c): add InProcessAwareDispatchRoutingTests for B-01b regression coverage
- 5 cases at the dispatch routing boundary: in-process route, stdio fallthrough,
  confirmation gate preservation, late-registration timing, observer parity.
- All FAIL until InProcessAwareToolDispatcher composite + InProcessConfirmationCache land.
- Bug: B-01 wired catalog enumeration (10-02b) but missed dispatch routing —
  MCPToolDispatcher only knows the 3 stdio tools, so when the model emitted
  tool_use for get_active_audio_route, dispatch failed and the failure
  surfaced as visible chat text.
2026-05-07 11:15:54 -05:00
james.maesandClaude Opus 4.7 9a59648f60 docs(10-02b): record substrate fix B-01 PLAN + SUMMARY
Plan 10-02b is a single-task surgical fix between Plans 10-02 and
10-03 addressing B-01 (App/AppDelegate.swift:1274 hardcoded
availableTools: []). Both PLAN and SUMMARY land here with the
authored task list, the four-layer substrate change rationale, and
the human-verify Live Verification gate.

Tasks 1-5 complete (commits 260350b, c5c5072, 043402c, 3eeb3c1,
e0c0310). Task 6 is the human-verify checkpoint — see
10-02b-SUMMARY.md "Live Verification" for the exact relaunch +
question script. AC-05 retroactive PASS for Plan 10-02 will be
recorded once the user re-verifies.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-07 08:29:35 -05:00
james.maesandClaude Opus 4.7 e0c0310b64 fix(10-02b): wire availableTools from runtime catalog at AppDelegate
Plan 10-02b / B-01 root-cause fix.

App/AppDelegate.swift:1274 previously constructed AgentOrchestrator
with `availableTools: []` — a hardcoded empty array. The 2026-05-07
live verification of Plan 10-02 surfaced this as the substrate bug
silencing every tool call across the agent: get_time, get_clipboard,
run_applescript, search_memory, forget_fact, vision tools, and the
four Phase 10-01 self-knowledge tools (list_audio_devices,
get_active_audio_route, get_self_state, list_camera_devices).

The model saw the system-prompt preamble naming tools but had no
schemas in the API tools[] field, so it hallucinated JSON tool
definitions into chat ("I'll check that for you. {\"name\": \"get_active_audio_route\", \"arguments\": {}}")
instead of dispatching real tool_use blocks.

Fix: source the catalog lazily via the new
`availableToolsResolver:` parameter from BOTH:
  - mcpRuntime.client.toolCatalog() — stdio helper tools
  - inProcessToolRegistry.toolSchemas() — memory + self-knowledge tools

The resolver fires once per outer-loop iteration in
AgentOrchestrator.runTurnLoop, NOT per stream event. By the time the
user submits their first turn, the install-order chain
  installMemory → installVision → installAgent → installVoice
                                              → installSelfKnowledgeTools
has populated all 7 in-process tools and all 3 stdio tools (10 total
catalog entries) — no install-order coupling needed at construction
time.

Verification:
- bash scripts/check-app-builds.sh PASS
- All 16 standalone boundary gates PASS
- Live re-verification of AC-05 ("What microphone are you using?")
  is the human-verify gate; see Live Verification section in
  10-02b-SUMMARY.md.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-07 07:42:39 -05:00
james.maesandClaude Opus 4.7 3eeb3c178e feat(10-02b): add availableToolsResolver for late-bound tool catalogs
Plan 10-02b / B-01: AgentOrchestrator gains an optional
`availableToolsResolver: (@Sendable () async -> [ToolSchema])?` init
parameter that, when set, supersedes the static `availableTools:`
array on every outer-loop iteration of runTurnLoop.

The static array continues to work for tests (and is the default), but
production wires the resolver so the in-process registry's late-bound
self-knowledge tools (registered AFTER installAgent runs the
orchestrator constructor) reach the request body's tools[] payload.

Without this, the install-order dependency chain
  installMemory → installVision → installAgent → installVoice
                                              → installSelfKnowledgeTools
would force the orchestrator to capture an empty snapshot of the
in-process registry at construction time. By the time the user submits
their first turn, the four self-knowledge tools have registered — but
the orchestrator's frozen array would not see them.

The resolver is invoked once per outer turn iteration (not per stream
event), so the cost is one actor hop per LLM round-trip — negligible.

Test coverage:
- test_availableToolsResolver_supersedesStaticArrayPerTurn: seeds the
  resolver with empty on turn 1, populates 4 tools before turn 2, and
  asserts the provider sees the correct snapshot for each turn.
- All 222 AgentCore tests pass unchanged.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-07 07:37:01 -05:00
james.maesandClaude Opus 4.7 043402c670 feat(10-02b): retain stdio Tool defs in MCPClient + add toolCatalog()
Plan 10-02b / B-01: MCPClient previously discarded the Tool definitions
returned by each helper's tools/list response, retaining only the
toolToServer name→server lookup. The Anthropic / Ollama provider
request bodies need name + description + inputSchema for each stdio
tool, but with the definitions lost there was nothing to feed the
catalog wiring at App/AppDelegate.swift:1274.

Changes:
- MCPClient gains a private `toolDefinitions: [String: Tool]` cache
  populated from each helper's listTools() response alongside
  toolToServer.
- New `toolCatalog() -> [ToolSchema]` re-encodes Tool.inputSchema
  (Value, JSON-encodable) to bytes and projects to the AgentCore
  ToolSchema shape. Empty descriptions degrade to a placeholder
  ("MCP tool '...' (no description provided by helper).") so we
  never drop a tool from the catalog.
- shutdown() also clears toolDefinitions (lifecycle parity with
  toolToServer / registry).
- Imports AgentCore for ToolSchema (asymmetric dep already declared
  in Package.swift; mirrors MCPToolDispatcher.swift's usage).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-07 07:33:28 -05:00
james.maesandClaude Opus 4.7 c5c5072b5d feat(10-02b): add toolDescription to InProcessTool + toolSchemas() projection
Adds the substrate that the production fix at App/AppDelegate.swift:1274
needs to source the tool catalog from the in-process registry instead of
the hardcoded empty array.

Protocol change:
- InProcessTool gains `var toolDescription: String { get }` — a
  human-readable one-line description surfaced in the Anthropic / Ollama
  tools[] payload's `description` field. Named `toolDescription` (not
  `description`) to avoid colliding with CustomStringConvertible.

All 7 production InProcessTool implementations updated with descriptions
calibrated to drive correct tool selection by the model:
- list_audio_devices, get_active_audio_route, get_self_state,
  list_camera_devices (Phase 10-01 self-knowledge tools)
- search_memory, forget_fact, search_conversation (Phase 7 memory tools)

Registry change:
- InProcessToolRegistry.toolSchemas() projects every registered tool to
  a ToolSchema(name, description, inputSchema) suitable for the LLM
  request body. Returns name-sorted for prompt-cache determinism.
- Adds AgentCore import to InProcessToolRegistry for the ToolSchema type.

Test coverage:
- InProcessToolRegistrySchemasTests asserts all 7 tools project
  correctly with non-empty descriptions and inputSchema bytes.
- All 85 existing MCP tests pass unchanged.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-07 07:28:20 -05:00
james.maesandClaude Opus 4.7 260350b3dc test(10-02b): add AvailableToolsWiringTests regression for B-01
The 2026-05-07 live verification of Plan 10-02 surfaced that
App/AppDelegate.swift:1274 constructed AgentOrchestrator with a
hardcoded availableTools: [] empty array. The model saw the system
prompt naming tools but had no schemas in the API tools[] field, so
it hallucinated JSON tool definitions into chat instead of dispatching
real tool_use blocks.

These tests assert at the orchestrator → provider boundary: schemas
passed to AgentOrchestrator(availableTools:) MUST reach the
LLMProvider.stream(... tools:) call on the first turn. The previous
in-process registry test asserted at the wrong layer (registry was
correctly populated, but its catalog never reached the orchestrator).

Both tests pass at HEAD because the orchestrator's wiring of
availableToolsList → toolsForCall → provider.stream is sound. They
exist to catch any future regression at this layer.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-07 07:18:45 -05:00
james.maes a75ae0a08b docs(10-02): record AC-06 PASS / AC-05 FAIL on substrate bug B-01
Live verification 2026-05-07 with build artifact f22bf2e.

AC-06 PASS: model denies text-only and names mic + speakers + camera +
introspection capabilities verbatim.

AC-05 FAIL: model emits {"name": "get_active_audio_route"} as visible
chat text instead of round-tripping a real tool_use block. Root cause:
App/AppDelegate.swift:1274 constructs AgentOrchestrator(...
availableTools: [], ...) with a hardcoded empty array. The four
self-knowledge tools register correctly in InProcessToolRegistry
(Plan 10-01's unit test asserts on the wrong layer) but the
orchestrator never sources them into the Anthropic API tools[] field.
Same bug almost certainly silenced ALL prior tool calls (get_time,
get_clipboard, run_applescript, search_memory, forget_fact, vision
tools) since whenever this line landed.

Plan 10-02 own scope (preamble + composer + AppDelegate rewire +
cache regression test) is complete and correct. AC-05 cannot pass
until availableTools is wired from InProcessToolRegistry — that is
a follow-up substrate fix outside Plan 10-02 authored scope.

Carry-forward bugs surfaced during this verification (B-01..B-05):
- B-01: availableTools: [] hardcoded — blocks every tool call
- B-02: conversation continuity broken across turns
- B-03: HUD camera button click delivers nothing
- B-04: voice input dead despite b92d062 requestAccess fix
- B-05: TTS silent — Jarvis never speaks audibly

Recommendation: open Plan 10-02b (substrate audit) before continuing
Plans 10-03/04/05. Diagnostic UI on a dead substrate produces empty
diagnostic UI.
2026-05-07 07:11:26 -05:00
james.maes f011ce2a77 docs(10-02): provisional SUMMARY pending human Live Verification
Tasks 1-2 (Wave-0 RED test + GREEN preamble + AppDelegate rewire) are
complete and committed at 5bb9371 + f22bf2e. Task 3 is the
checkpoint:human-verify gate — the human must relaunch the app, ask
"What microphone are you using?" and "Are you a text-only assistant?",
and observe the live model behavior to flip AC-05 / AC-06 from PENDING
to PASS.

This SUMMARY pre-populates everything except the human-observed evidence
block: pre-checks (all PASS), reset (N/A — no hardware capture surface
touched), relaunch instructions, the two verbatim questions to ask,
expected log lines, expected response shape, and the placeholder
PENDING markers for AC-05 / AC-06. STATE.md / ROADMAP.md plan-counter
advance is deferred until the human signals "approved".
2026-05-06 18:13:39 -05:00
james.maes f22bf2ea3b feat(10-02): add self-aware preamble + ContextBuilder.systemPrompt(for:)
Replaces the hardcoded "You are Jarvis, a personal macOS assistant."
literal at App/AppDelegate.swift:1265 with a locked self-aware preamble
emitted by AgentCore's new ContextBuilder. The preamble names Jarvis,
lists capabilities (mic, camera, speakers), names the seven introspection
tools (list_audio_devices, get_active_audio_route, get_self_state,
list_camera_devices, get_time, get_clipboard, run_applescript) so the
model has handles, and ends with "You are not a text-only assistant."
Closes the 2026-05-05 / 2026-05-06 user-quoted failure modes.

Implements:
- ContextBuilder.selfAwarePreamble: locked Swift string constant (D-13).
  No JSON file, no localization, no runtime mutation. Length ~660 chars,
  well under the 4096-char cache-eligibility boundary (Pitfall #4 / A4).
- ContextBuilder.systemPrompt(for:): composes preamble FIRST, then
  presence enrichment, then memory hydration (D-12 — two distinct
  concatenation steps preserve cache_control breakpoints).
- TurnContext envelope with .empty static for the AppDelegate site
  (per-turn enrichment plumbing through orchestrator init is out of
  scope per D-12 fallback; AppDelegate calls .systemPrompt(for: .empty)).
- AppDelegate.swift orchestrator init now sources systemPrompt from
  ContextBuilder.

Rule 3 deviation (auto-fix blocking issue): the new
AgentCore.ContextBuilder name-collides with the pre-existing
JarvisVision.ContextBuilder (cloud-opt-in / frame-attach detector) at
two call sites that previously used bare `ContextBuilder()`. Both call
sites disambiguated to `JarvisVision.ContextBuilder()`:
- packages/AgentCore/Sources/AgentOrchestrator/AgentOrchestrator.swift:212
- App/AppDelegate.swift:1620
And the dependent test:
- packages/AgentCore/Tests/AgentOrchestratorTests/AgentOrchestratorVisionDispatchTests.swift:209

Wave-0 test preambleDoesNotEnableCacheUnintentionally flips RED→GREEN.
All 17 boundary gates green; check-app-builds.sh PASS.

Closes SELF-05, SELF-06 (Plan 10-02 implementation tasks).
2026-05-06 18:10:27 -05:00
james.maesandClaude Opus 4.7 4249bc27ab docs(mcp): list Phase 10 self-knowledge tools in package README
- Split InProcess registry rows: contract / registry / memory tools /
  unwired SearchConversationTool / four self-knowledge tools (74b9ac2)
- Note App-side dispatcher adapters in InProcessSelfStateAdapters.swift
- Notable files: list the four new InProcess tool sources

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-06 16:11:31 -05:00
james.maesandClaude Opus 4.7 c7d62bdb47 docs(architecture): list Phase 10 self-knowledge in-process tools
- MCP subsystem section: enumerate in-process tools with availability gates
  and cite 74b9ac2 (Phase 10 Wave 1 four-tool landing)
- Note SearchConversationTool as code-present-but-unwired
- Cheat sheet: add row for adding an in-process MCP tool

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-06 16:11:26 -05:00
james.maesandClaude Opus 4.7 35330b3511 docs(readme): refresh status + MCP tool catalog post Phase 10 Wave 1
- Status line: nine planned phases shipped, Phase 10 mid-flight; cite 3974a15
- MCP tools row: split helpers vs in-process; add the four self-knowledge
  tools landed in 74b9ac2 (list_audio_devices, get_active_audio_route,
  get_self_state, list_camera_devices)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-06 16:11:21 -05:00
james.maes 5bb9371e39 test(10-02): add Wave-0 RED preambleDoesNotEnableCacheUnintentionally
VALIDATION map row SELF-06 / T-10-CACHE-01. Asserts the soon-to-land
ContextBuilder.selfAwarePreamble does not flip cache-marker emission
relative to the prior literal "You are Jarvis, a personal macOS
assistant." (Pitfall #4 / Assumption A4 / PATTERNS AP-04), enforces the
D-13 lock anchor (hasPrefix "You are Jarvis"), the D-14 no-tool-catalog
constraint (no Markdown triple-backtick), and the D-12 composition
order (selfAwarePreamble FIRST in systemPrompt(for:)).

RED: ContextBuilder symbol does not exist yet — fails to compile.
2026-05-06 16:08:11 -05:00
james.maes 3974a1537c docs(10-01): complete MCP self-knowledge tools plan
Per-plan SUMMARY.md for Plan 10-01. Documents the four read-only
self-knowledge MCP tools (list_audio_devices, get_active_audio_route,
get_self_state, list_camera_devices) wired against live runtime
references via the Track D-2 module-boundary bridge pattern. Live
verification (D-26 / SPEC AC-13) populated with cold-launch evidence:
all four tools registered ~1ms after `installVoice: VoiceController
started` (confirms voice → self-knowledge ordering works), AC-01..04
PASS with system_profiler cross-validation.

State updates: completed_plans 43 → 44, percent 90 → 92, current_plan
1 → 2 of 5; ROADMAP plan-progress updated for Phase 10.
2026-05-06 15:59:59 -05:00
james.maes 74b9ac2ff5 feat(10-01): wire four self-knowledge MCP tools into live runtime
App-side adapters bridge JarvisMCP's self-knowledge dispatcher protocols
to concrete runtime sources, mirroring the InProcessMemoryAdapters.swift
Track D-2 pattern (commit 707c45b). JarvisMCP stays unaware of
Voice/AVFoundation/CoreAudio.

- App/MCP/InProcessSelfStateAdapters.swift (NEW):
  - CoreAudioIntrospection.snapshotDevices() — full
    AudioObjectGetPropertyData enumeration, one entry per
    (device, direction) pair with name/uid/sampleRate/channels and
    isDefault/isActive flags resolved from
    kAudioHardwarePropertyDefaultInput/OutputDevice.
  - CoreAudioIntrospection.defaultDeviceUID(isInput:) — used by
    AudioGraphRouteAdapter to fill the route's input/output UID + name.
  - CoreAudioDeviceListAdapter — wraps snapshotDevices() (SELF-01).
  - AudioGraphRouteAdapter (actor) — hops into AudioGraphOwner for the
    probed sample rate + channels, combines with the CoreAudio default
    device UIDs for the active route (SELF-02).
  - SelfStateAdapter — closure-injected probes for provider, voice loop
    state, TTS tier, STT backend, wake-word mute. Uses captured launch
    Date for app uptime (NOT ProcessInfo.systemUptime which is host
    uptime per D-11). buildMode reads #if DEBUG. (SELF-03).
  - AVCaptureDeviceListAdapter — DiscoverySession enumeration; metadata-
    only, does NOT trigger camera TCC prompt (SELF-04).

- packages/Voice/Sources/Voice/AudioGraph/AudioGraph.swift: store the
  probedFormat on AudioGraph so AudioGraphOwner can expose it. Additive
  public let; no behavior change.

- packages/Voice/Sources/Voice/AudioGraph/AudioGraphOwner.swift:
  - new public ActiveRouteSnapshot Sendable struct (sampleRate, channels)
  - new public actor accessor activeRouteSnapshot() returns the probed
    input format. Hardware-identity (UID/name) intentionally lives in
    the App-side adapter so Voice doesn't take on CoreAudio-introspection
    concerns.

- App/AppDelegate.swift:
  - launchInstant: Date captured at AppDelegate construction time for
    SELF-03 app-uptime reporting (D-11).
  - selfKnowledgeInstallTask + installSelfKnowledgeTools() registers the
    four tools into the existing inProcessToolRegistry built by
    installMemory. Runs after voiceInstallTask so audioGraphOwner is
    available; degrades gracefully when audioGraphOwner is nil
    (registers the three tools that don't depend on it). All four tools
    declare requiresConfirmation:false (D-10 / AP-12); no caching
    (D-09 / AP-11). Provider identity reads from configStore.perTurn();
    voice loop state hops VoiceController.state; wake-word mute reads
    UserDefaults `features.voice.wakeWordMuted` (mirrors MuteWakeWord's
    persistence key).

Verification:
- swift test --package-path packages/MCP — all suites GREEN incl.
  registersFourSelfKnowledgeTools.
- swift test --package-path packages/Voice — 26 tests in 7 suites GREEN
  (AudioGraph probedFormat additive change, no regressions).
- bash scripts/check-app-builds.sh — PASS.
- All 18 boundary gates exit 0 (incl. check-applescript-confirmation,
  check-no-leftover-stubs, check-install-order, check-no-null-voice-
  adapters, check-no-evaluate-javascript).
2026-05-06 15:50:30 -05:00
james.maes b9ac76d07e feat(10-01): implement four self-knowledge MCP in-process tools
- ListAudioDevicesTool / list_audio_devices — wraps `AudioDeviceListing`
  dispatcher; encodes `{"devices": [...]}`. AudioDeviceEntry holds
  name/uid/isDefault/isActive/isInput/sampleRate/channels.
- GetActiveAudioRouteTool / get_active_audio_route — encodes
  `{"route": <route|null>}` with explicit nil-key emission so the model
  can disambiguate "graph closed" from "graph open with missing fields".
- GetSelfStateTool / get_self_state — SelfState carries all 11 D-11
  fields (appName, appVersion, buildMode, pid, uptimeSeconds,
  llmProvider, llmModel, ttsTier, sttBackend, wakeWordMuted,
  voiceLoopState).
- ListCameraDevicesTool / list_camera_devices — encodes
  `{"cameras": [...]}`. CameraDeviceEntry holds
  localizedName/uniqueID/isConnected/position.

All four declare `requiresConfirmation = false` explicitly per D-10
(read-only, no side effects; AP-12 — never default the flag).
JSONEncoder uses `.sortedKeys` for stable test fixtures. No caching
(D-09 / AP-11). All 6 Wave-0 tests GREEN; existing MCP suites unchanged.
2026-05-06 15:23:04 -05:00
james.maes 1952e74c8a test(10-01): add Wave-0 RED stubs for four self-knowledge MCP tools
- ListAudioDevicesToolTests, GetActiveAudioRouteToolTests,
  GetSelfStateToolTests, ListCameraDevicesToolTests — Stub-style
  dispatchers (D-31) drive each tool through its JSON encode path.
- MCPRuntimeWiringTests/registersFourSelfKnowledgeTools — asserts the
  four tool names register in InProcessToolRegistry AND each carries
  requiresConfirmation == false (D-10).
- All five fail to compile until Task 2 ships the production types
  (AudioDeviceListing/Entry, ActiveAudioRouteDispatching/Route,
  SelfStateDispatching/State, CameraDeviceListing/Entry, four tool
  structs). RED confirmed via `cannot find type ...` diagnostics.
2026-05-06 15:18:33 -05:00
james.maes 1e23605b17 docs(phase-10): create phase plan (5 plans, 5 waves, serial) 2026-05-06 15:00:44 -05:00
james.maes 25cc58efae docs(phase-10): add validation strategy 2026-05-06 14:15:05 -05:00
james.maesandClaude Opus 4.7 94a30185a4 docs(phase-10): add RESEARCH.md grounding 5-plan execution
Maps every Phase 10 requirement (SELF-01..06, DIAG-01..04) to concrete
file:line citations: InProcessTool registration pattern via
SearchMemoryTool, DevSnapshotEmitter wiring gap at AppDelegate.swift:
1325-1330, voice subsystem publish callsites, NSWindow/NSHostingView
mirror of DevOverlayWindow, CoreAudio + AVCaptureDevice introspection.

DIAG-02 root cause confirmed via source read: DevSnapshotEmitter exists
in packages/AgentCore/Sources/AgentOrchestrator/ but is never
instantiated; broadcaster's .devOverlay subscriber Task is a no-op
drain; toggleDevOverlay constructs window without bridge.attach().

Includes Validation Architecture (Nyquist) section enumerating Wave 0
test gaps and stash@{0} salvage triage per D-05 (file-by-file).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-06 14:12:03 -05:00
james.maes e784b3b040 docs(phase-10): capture phase context (--auto, 31 decisions locked)
CONTEXT.md captures all implementation decisions for Phase 10
(Self-Awareness & Live Diagnostics) under --auto single-pass:

- 5 plans, serial: SELF tools → system prompt → DevOverlay fix
  → diagnostic menu items → Voice Log window
- In-process MCP adapter pattern (Track D-2 analog) for the four
  read-only self-knowledge tools; no caching, no confirmation
- System prompt preamble as locked code constant emitted before
  presence enrichment (preserves cache_control boundaries)
- DevOverlay fix is read-only investigation first, surgical diff
  second — no rewrite
- AppKit + NSHostingView for Voice Log (mirrors DevOverlay; no new
  WKContentWorld); actor + AsyncStream subscribers; in-memory
  2000-event FIFO; rate-limit RMS at publisher
- Live-launch verification = locked "Live Verification" section in
  every plan SUMMARY.md; tccutil reset before mic/camera relaunches
- stash@{0} salvaged file-by-file per plan, never via stash apply
- All 18 boundary gates stay green; no new gate (procedural
  enforcement via SUMMARY schema)

DISCUSSION-LOG.md preserves the alternatives considered for human
audit. Downstream agents read CONTEXT.md + SPEC.md, not this log.

Refs SPEC.md acceptance criteria AC-01..AC-14, blocking
anti-patterns acknowledged from .continue-here.md.
2026-05-06 13:55:27 -05:00
james.maesandClaude Opus 4.7 d6535aa691 wip: phase-10 self-awareness-diagnostics paused at SPEC.md (0/0 plans)
End-of-session handoff. Phase 10 SPEC.md is locked (10 requirements,
14 acceptance criteria, ambiguity 0.18). Next step is /gsd-discuss-phase
10 --auto, then /gsd-plan-phase 10. Plans MUST run serially with
live-launch verification at each boundary (SPEC AC-13) — direct response
to today's tests-green-but-broken pattern.

Today's runtime fixes already pushed:
- d8983af stream:true on Anthropic body (root cause of streamTruncatedFinal)
- cb7ee6f mic-regrant phantom rebuild (killed wake-word stream within 2s)
- b92d062 explicit TCC requests + honest wizard copy

Three blocking constraints recorded in .continue-here.md for the resuming
agent's mandatory understanding check:
- tests-green != production-works
- parallel agents on shared files produce partial work
- Info.plist alone doesn't trigger TCC prompts

Stashed partial work from failed parallel dispatch lives at stash@{0};
review for salvage when implementing DIAG-01 (Voice Log) and DIAG-02
(DevOverlay), discard otherwise.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-06 13:38:14 -05:00