Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ tests/unit/*
!tests/unit/test-opencode-adapter.mjs
!tests/unit/test-session-distiller.mjs
!tests/unit/test-control-plane.mjs
!tests/unit/test-runtime-doctor.mjs
!tests/unit/test-metrics-worker.mjs
!tests/unit/test-cli.mjs
test-results/
Expand Down
13 changes: 12 additions & 1 deletion AI_INDEX.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
### HTTP server
- Entry: `src/server.mjs`
- Cross-platform path boundary checks: `src/path-security.mjs`
- Search: `createServer`, `/api/scan`, `/api/move`, `/api/delete`, `/api/save-markdown`, `/api/context-budget`, `/api/security-scan`, `/api/file-content`, `/api/session-preview`, `/api/export`
- Search: `createServer`, `/api/scan`, `/api/move`, `/api/delete`, `/api/save-markdown`, `/api/context-budget`, `/api/security-scan`, `/api/runtime-doctor`, `/api/file-content`, `/api/session-preview`, `/api/export`
- Tests: `tests/e2e/dashboard.spec.mjs`
- Connects to:
- Scanner — inventory via `scanAll()`
Expand Down Expand Up @@ -118,6 +118,16 @@
- Harness Doctor consent UI — `src/ui/app.js`, `src/ui/index.html`
- First-party Cloudflare Worker + D1 — deduplicates `(month, monthly_id)`

### Live Runtime Map / MCP Runtime Doctor
- Entry: `src/runtime-doctor.mjs`
- Search: `collectRuntimeDoctorReport`, `stopRuntimeSession`, `buildSessions`, `attachDirectMcpProcesses`, `findConnectedSessions`, `collectIntentProbeStatus`, `buildRuntimeFindings`, `commandLineHasSecret`
- Behavior: privacy-bounded Linux snapshot of same-user Claude Code, Codex, OpenCode, and DSH process trees; tree RSS/age/process attribution; configured direct-MCP matching; duplicate direct-instance summary; 1MCP cgroup health and persistent loopback client-socket attribution; IntentProbe install/daemon/hook readiness. Command lines, paths, raw sockets, and credential values are never returned.
- Stop contract: explicit UI confirmation plus opaque PID/start-time identity; server revalidates same user and harness identity and sends only `SIGTERM`; CCO refuses self-containing trees.
- Tests: `tests/unit/test-runtime-doctor.mjs`, `tests/e2e/dashboard.spec.mjs`
- Connects to:
- Server — `GET /api/runtime-doctor`, `POST /api/runtime/session/stop` in `src/server.mjs`
- Harness Doctor — session cards, direct/shared topology, duplicate MCP recommendations, IntentProbe readiness, resource/package/credential findings, and stop confirmation in `src/ui/app.js`

---

## Frontend
Expand Down Expand Up @@ -175,6 +185,7 @@
- `test-opencode-adapter.mjs` — OpenCode config, instruction, skill, MCP, and plugin discovery
- `test-dsh-adapter.mjs` — DeepSeek Harness settings, profiles, official skill roots, and capability gates
- `test-control-plane.mjs` — local privacy metrics and monthly signal behavior
- `test-runtime-doctor.mjs` — privacy-bounded 1MCP process, cgroup, config, and finding collection
- `test-metrics-worker.mjs` — collector validation, strict schema, and D1 writes

### E2E tests
Expand Down
5 changes: 4 additions & 1 deletion PRIVACY.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ You can disable metrics at any time in Harness Doctor. CCO does not use cookies,
## What It Accesses

- Reads selected config and customization files for supported harnesses, including `~/.claude/`, `$CODEX_HOME` (default `~/.codex/`), `~/.config/opencode/`, `$DSH_HOME` (default `~/.dsh/`), `$DSH_AGENTS_HOME` (default `~/.agents/`), and discovered project directories
- On Linux, Live Runtime Map reads same-user procfs metadata to group supported harness process trees and sum RSS, threads, age, and process counts. It may read same-user file-descriptor links plus `/proc/net/tcp*` to associate a persistent loopback 1MCP socket with a session. It reads configured MCP command markers only for local process matching. Command lines, working directories, raw socket details, and credential values are never returned to the browser.
- Runtime Doctor can also read a HOME-scoped 1MCP config, cgroup resource counters, its loopback health endpoint, and Claude settings to detect an IntentProbe hook. It checks command-line arguments in memory for credential-shaped values but returns only a count.
- “Stop session” is the only runtime-map mutation. After an explicit browser confirmation, CCO revalidates the same-user PID, process start identity, and supported harness executable, then sends `SIGTERM` to that one harness root. It never stops a session tree containing the CCO server itself.
- Writes only when you use an editing, move, delete, restore, export, backup, or harness-control action
- Runs an HTTP server bound to `127.0.0.1` (default port 3847) and rejects non-local browser requests

Expand All @@ -49,4 +52,4 @@ CCO does not upload the contents of your harness files. Optional monthly metrics

---

Last updated: 2026-09-11
Last updated: 2026-10-16
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@ Open **Harness Doctor** from the sidebar for a scope-level audit:
- **Explainable hygiene score** — every deduction is tied to a visible finding such as duplicate identities, missing discovery metadata, large context-bearing files, stale sessions, or setting overrides. It is a diagnostic heuristic, not a security certification.
- **Safe auto-repair** — only byte-identical artifacts with the same name, category, and scope are eligible. CCO archives the extra copy, fingerprints it, and provides Undo.
- **Cross-harness migration** — v1 copies portable `SKILL.md` bundles between Claude Code, Codex CLI, OpenCode, and DSH. It previews ready, conflicting, identical, and unsupported items and never overwrites by default.
- **Live Runtime Map** — on Linux, groups same-user Claude Code, Codex, OpenCode, and DSH process trees into live sessions; shows tree RSS, age, process/thread counts, matched direct MCPs, duplicate per-session MCP instances, and a shared 1MCP node. A loopback TCP snapshot can link persistent 1MCP clients to sessions; short-lived requests are explicitly reported as unobservable rather than guessed.
- **Runtime safety controls** — high-memory and 24-hour sessions are flagged. “Stop session” is always an explicit confirmation and revalidates the same-user PID, process start identity, and harness executable before sending graceful `SIGTERM`. CCO refuses to stop the process tree that contains itself.
- **IntentProbe readiness** — detects whether the runtime scanner, warm JSONL daemon, and Claude hook are present. Semantic “what is this session doing?” activity remains unavailable until a future receipt adapter is connected; process names are never presented as intent evidence.
- **1MCP Doctor** — checks cgroup memory/task pressure, unhealthy upstreams, floating `npx` versions, lazy-loading state, and credential-shaped command-line arguments. Command lines and credential values are never returned to the browser.
- **Private product signals** — optional metrics are off by default. Detailed daily event counts and coarse inventory buckets stay local. If enabled, CCO submits a deduplicated monthly activity signal containing only a rotating anonymous ID, UTC month, CCO version, and harness ID. The identifier changes every month, so it cannot build cross-month user histories.

## Context Budget: See How Many Tokens Claude Code Pre-Loads
Expand Down Expand Up @@ -401,6 +405,12 @@ MIT

## Updates

### Unreleased
- Added a Linux Live Runtime Map for Claude Code, Codex, OpenCode, and DSH sessions, including tree RSS, age, process/thread counts, direct MCP attribution, duplicate per-session MCP detection, and persistent 1MCP client-socket evidence
- Added explicit, identity-pinned graceful session stop; CCO revalidates UID, PID start time, and harness identity and refuses to stop its own containing process tree
- Added IntentProbe runtime readiness plus 1MCP cgroup, package-pinning, lazy-loading, upstream-health, and credential-exposure diagnostics
- Added privacy documentation and regression coverage; 405 tests pass (188 unit + 217 E2E)

### 2026-09-11
- v0.20.0: Added inventory-first OpenCode and DeepSeek Harness support and expanded Codex inventory, including custom agents, nested memories, skill enablement state, project/inline/plugin hooks, plugin-provided skills, and standalone profiles
- Added a source-labelled All Memories scope and local body search across Claude memory files
Expand Down
5 changes: 5 additions & 0 deletions docs/CONTROL_PLANE_PLAN.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Harness Doctor control-plane plan

> **Historical v0.20 slice.** This document records the original Harness Doctor
> contract. It no longer controls the product backlog. The canonical overall
> roadmap is [LIVING_PLAN.md](LIVING_PLAN.md), and its release/feature evidence
> gates are in [QA_PLAN.md](QA_PLAN.md).

## Outcome

CCO should answer four questions for any supported coding harness:
Expand Down
Loading
Loading