Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
138540a
docs(reports): open workspace_discovery with the probe architecture
LittleCoinCoin Nov 12, 2026
13cee0a
docs(roadmap): author the workspace_discovery campaign skeleton
LittleCoinCoin Nov 12, 2026
31f4084
chore(roadmap): open the workspace_discovery level-1 dispatch window
LittleCoinCoin Nov 12, 2026
f55aad7
refactor(server): record workspace-signal probe behind COLGREP_MCP_PROBE
LittleCoinCoin Nov 12, 2026
4d25c90
test(tests): pin probe inertness and add probe_workspace harness driver
LittleCoinCoin Nov 12, 2026
4a3e363
docs(roadmap): record the probe-verifier signature as outstanding int…
LittleCoinCoin Nov 13, 2026
4cbe1ac
docs(reports): document workspace-channel verdicts from pinned evidence
LittleCoinCoin Nov 13, 2026
8bab501
docs(reports): publish the probe-verifier UNSOUND verdict and its gap…
LittleCoinCoin Nov 13, 2026
483cf39
docs(reports): persist the amendment review verdict and repair the ba…
LittleCoinCoin Nov 13, 2026
aac40f8
fix(server): make probe record columns reflect measured truth
LittleCoinCoin Nov 13, 2026
b62cb71
fix(server): make the probe record path survive hostile snapshots
LittleCoinCoin Nov 13, 2026
b691059
chore(server): withdraw the unsound workspace-signal probe pending ha…
LittleCoinCoin Nov 13, 2026
766ce8f
test(tests): add the probe calibration oracle and retire the blind le…
LittleCoinCoin Nov 13, 2026
9dd191a
docs(reports): point signature rows at the ca3cb40 history entries di…
LittleCoinCoin Nov 13, 2026
96d97b5
fix(tests): stamp stub provenance and let gap rows round-trip the val…
LittleCoinCoin Nov 13, 2026
77d6b6b
docs(reports): close the workspace_discovery campaign with the live p…
LittleCoinCoin Nov 13, 2026
d879257
test(tests): record the dump-only probe signature at the client surface
LittleCoinCoin Nov 27, 2026
a283957
docs(roadmap): fold the measured meta per-call solution into the roadmap
LittleCoinCoin Nov 13, 2026
4093c53
Merge task/probe-hardening into agents/workspace-discovery-resolution…
LittleCoinCoin Nov 27, 2026
ffd4ca0
chore(repo): record claude harness probe artifacts
LittleCoinCoin Nov 27, 2026
6b3c74c
chore(repo): record codex harness probe artifacts
LittleCoinCoin Nov 27, 2026
7a03f16
docs(reports): consolidate harness probe matrix
LittleCoinCoin Nov 27, 2026
7128b66
Merge task/collect-harness-evidence into agents/workspace-discovery-r…
LittleCoinCoin Nov 27, 2026
6c1cb8a
feat(server): resolve the default root from per-call request meta
LittleCoinCoin Nov 27, 2026
30aad59
feat(server): resolve per-call roots without the first-call race
LittleCoinCoin Nov 27, 2026
157b0a9
feat(search): land the per-call resolution ladder with guided failure
LittleCoinCoin Nov 27, 2026
d759d5e
fix(server): keep the probe record truthful on meta roots and silent …
LittleCoinCoin Nov 27, 2026
636b95d
Merge task/per-call-resolution into agents/workspace-discovery-resolu…
LittleCoinCoin Nov 27, 2026
30dab02
docs(reports): adjudicate workspace-resolution rungs from probe fleet
LittleCoinCoin Nov 27, 2026
950b6e4
docs(reports): fix gap cell typo in harness probe findings
LittleCoinCoin Nov 27, 2026
ec1faf8
Merge task/findings-report into agents/workspace-discovery-resolution…
LittleCoinCoin Nov 27, 2026
3f35c65
fix(server): honor absolute paths entries without consulting the ladder
LittleCoinCoin Nov 27, 2026
1e9d845
fix(server): drop client roots that name no directory from the ladder
LittleCoinCoin Nov 27, 2026
544d308
fix(server): give every concurrent first call the bounded root reassu…
LittleCoinCoin Nov 27, 2026
c9247e9
docs(reports): close workspace_discovery with the knowledge transfer
LittleCoinCoin Nov 27, 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
146 changes: 146 additions & 0 deletions __reports__/workspace_discovery/00-architecture_v0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
# Dynamic workspace discovery — Architecture Analysis (v0)

Date: 2026-11-12

## Executive Summary

- **Problem**: colgrep-mcp's default root resolution silently lands on the server
process's own cwd (the plugin install tree) whenever `COLGREP_MCP_ROOT` is unset
and the client sends no roots, so every path-less tool call searches the wrong
project and the model must repeat the path. Confirmed this session:
`doctor` reported `default_root: .../agentPlugins/.../1a1c9036c4d (source: cwd)`
and path-less `search` returned only plugin-tree hits.
- **Proposed change**: probe which dynamic per-call workspace signals each target
harness actually sends (request `_meta`, `initialize` context, `roots/list` +
successor channels per the 2026-07-28 MCP revision), then resolve the default
root per tool call from the strongest available signal. Survey + fleet evidence
feed a findings report; this document fixes the resolution contract.
- **Non-goals**: no behaviour change in this campaign beyond a probe facility that
is inert unless `COLGREP_MCP_PROBE` is set; no skill/schema guidance asking the
model to pass `paths` (rejected as a token-priced workaround); no hook-based
workspace plumbing (Agent Plugins hosts ignore `hooks/`).
- **Biggest risks**: (1) probe code accidentally altering resolution behaviour —
guarded by a verifier dispatch against a dump-only oracle; (2) no dynamic
channel exists in some harness — the contract turns that into fail+guidance,
not a silent wrong root; (3) harness probe runs are flaky/timeout-prone —
artifacts record raw evidence, gaps are reported, not filled.
- **Validation approach**: `pytest` + `ruff` green per leaf; verifier attack on the
dump-only invariant; harness probe artifacts JSON-checked for completeness by a
deterministic predicate, not read by eye.

## Current State

```mermaid
graph TD
T[tool call] --> R[paths.resolve_target_paths]
R --> A["explicit paths?"]
A -->|no| B{"COLGREP_MCP_ROOT"}
B -->|unset| C{"roots/list (deprecated, best-effort)"}
C -->|empty/absent| D["server cwd = plugin install dir"]
D --> W[wrong project searched silently]
B -->|set static pin| P[correct, but stale on workspace switch]
```

## Proposed State

```mermaid
graph TD
T[tool call] --> R[resolve_default_root per call]
R --> R1[R1 request _meta / initialize workspace stamp]
R1 -.->|absent| R2[R2 roots: list_changed cache, lazy roots/list]
R2 -.->|absent| R3[R3 COLGREP_MCP_ROOT pin (env)]
R3 -.->|unset| R4[R4 guarded cwd]
R4 -->|cwd looks like install tree| E["ToolError ROOT_UNRESOLVED + guidance: pass an absolute paths entry"]
R1 --> OK[resolved root, root_source recorded]
R2 --> OK
R3 --> OK
```

## Key Flows

```mermaid
sequenceDiagram
participant M as Model
participant T as tool handler
participant P as resolve_default_root
participant H as harness
M->>T: search(query=...) (no paths)
T->>P: per-call resolution
P->>H: read _meta / roots cache (no extra round-trip when cached)
H-->>P: workspace root or nothing
alt no dynamic signal, no pin
P-->>T: ROOT_UNRESOLVED(error + remedy)
T-->>M: error naming how to proceed (set paths to the project dir)
else signal present
P-->>T: [root], root_source label
T-->>M: results scoped to the workspace
end
```

## Contracts & Invariants

- **Resolution ladder** (the only place this lives: `paths.py`):
`explicit paths > dynamic workspace signal (verbatim, per call) > COLGREP_MCP_ROOT pin > guarded cwd`
. Relative `paths` entries resolve against the chosen default root. Multiple dynamic roots select by
`paths` containment first, else `roots[0]`, surfaced in `root_source`.
- **Invariants**: probe facility changes nothing when `COLGREP_MCP_PROBE` is unset
(dump-only oracle: `Client.list_tools()/list_resources()` JSON diff vs base is
empty; resolved paths identical with probe on/off). `root_source` is recorded on
every result as it is today. Resolution errors name the remedy the model can act
on (`paths` with an absolute directory), fail+guidance — neither silence nor a
bare loud fail.
- **Probe dump schema** (JSONL, one record per tool call; file not stdout):
`{ts, server_pid, tool, raw_paths, env: {COLGREP_MCP_ROOT, ..., spawn_env_digest},
init_capabilities, request_meta, roots_list: {static: "declared|empty|error", items},
resolved: {root, source}, cwd}`. Raw values only — the record measures what the
harness sent, never what we wish it sent.
- **Error model**: `PATH_NOT_FOUND` keeps its current contract. New `ROOT_UNRESOLVED`
(advisory id, exact code settled at implementation) fires only when no rung can
produce a root, carrying the ghid: "no default workspace resolved; pass an
absolute paths entry" plus the ladder source that failed.
- **Per-harness measurement matrix** (columns fixed now, filled by the probe):
harness × {initialize capabilities, request `_meta` keys, `roots/list` verdict,
successor-of-roots per 2026-07-28 revision (via `protocol_survey`), spawn env}.
Harnesses: (1) VS Code/Copilot Agent Plugins load (this session), (2) `claude -p`
with the Claude Code plugin manifest (`${CLAUDE_PROJECT_DIR}` pin expected),
(3) `codex exec` per stacked `palette`/`codex/` extensions.

## Alternatives Considered

- **A. Prompt/schema guidance demanding `paths`** — rejected (user decision): still
costs model tokens and reasoning every call; compensates instead of fixes.
- **B. Recommended per-machine env pin** — accepted as lever #2 (precedence rung 3:
explicit pin outranks inference). Static per server lifetime; user refreshes on
switch, which is a documented limit of any default, not a bug. Complementary, not
sufficient alone.
- **C. Hook-written workspace state** — rejected as primary: Agent Plugins 1.0
(`§6/§7`) ignores `hooks/`; Cursor needs manual `settings.json` porting (`D8`,
harness-wiring); `WorktreeRemove` is one-host. Retained only as future fallback.
- **D. Per-call protocol resolution (this campaign's target)** — wins because all
three ecosystems ship the same server over one wire; pack-time expansion is
frozen (spec 1.0 `§9.2`), so the protocol is the only portable dynamic headroom.
Tradeoff accepted: rung 1/2 may be empty in some harnesses — the matrix says so,
and rung 4 + fail+guidance keeps that honest.

## Risks & Mitigations

- Probe code perturbs resolution silently → verifier dispatch must sign a
dump-only oracle; probe path excluded from the resolve chain when env unset.
- Harness CLI prompts flaky → artifacts keep raw output; incomplete rows report `—`
and never synthesize.
- SDK already wraps the 2026-07-28 channel → `protocol_survey` pins the SDK version
tested and cites spec sections, so later re-probes are comparable.
- `dirtree-rdm` grammar rigidity → leaf consistency checks run `uv run ruff check`,
`uv run pytest -q`, and `test -s` probes as literally written; no check depends on
a not-yet-existing deliverable except where exempt.

## Roadmap Recommendation

Campaign `__roadmap__/workspace_discovery/` (Tier 2): root leaves
`probe_instrumentation` (server probe + tests, Agentic-Small) and `protocol_survey`
(MCP spec/SDK channel research, Reasoning-Medium) run in parallel; then
`evidence/collect_harness_evidence` (raw JSONL per harness, Agentic-Small) runs
depth-ordered after both. Findings report (batch 01) authored by the lead from
probe artifacts; architecture revised as `02-architecture_v1.md` if evidence
contradicts a rung. Adversarial-verifier dispatch is pledged for
`probe_instrumentation` (measurement semantics + silent-failure risk).
109 changes: 109 additions & 0 deletions __reports__/workspace_discovery/01-findings_harness_probe_v0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# Harness probe — Findings (v0)

Date: 2026-11-27

---
type: findings
topic: workspace_discovery
date: 2026-11-27
version: v0
prior-version: none
key-metric: dynamic_channels_work: 0 harnesses with a live dynamic rung (prior: N/A, delta: N/A)
decision-required: confirm
---

## Headline Result

metric: dynamic_channels_work
value: 0 — all three fleet harness rows measured silent on every dynamic channel
unit: harnesses with a live dynamic rung measured (of 3 fleet rows; both across-run static cells also `—`)
prior: N/A
direction: new

## Results Tables

### Harness × workspace-signal matrix (fleet rows, condensed from the probe matrix)

Every gap cell is `—` (silence — gap record, no R01-schema fields emitted), or a measured
row is absent from the raw store. No cell is inferred from R03b or any prior run.

| harness | initialize capabilities | request `_meta` keys | `roots/list` verdict | successor (2026-07-28) | spawn env relevant vars | Resolution Picks | Notes |
|:--------|:------------------------|:---------------------|:----------------------|:------------------------|:-------------------------|:------------------|:------|
| `claude` | — | — | — | — | — | `fail+guidance` | gap record `claude_tool-20261127_141546.jsonl`:`{"error": "claude completed but no probe record written"}` — no R01-schema fields emitted |
| `codex` | — | — | — | — | — | `fail+guidance` | gap record `codex_tool-20261127_141606.jsonl`:`{"error": "codex completed but no probe record written"}` — no R01-schema fields emitted |
| `copilot-agent-plugins` | — | — | — | — | — | `fail+guidance` | no `copilot_tool-*.jsonl` present in raw store; reuse-by-filename-match absent, row recorded as `—` |

### Channel map (R02 station ids, per R01 §Per-harness measurement matrix)

| Channel | Station (R02) | Verdict (R02) | Fleet measurement |
|:--------|:--------------|:--------------|:------------------|
| initialize capabilities | Station 3 | static — once per spawn | `—` (no measured cell) |
| request `_meta` keys | Station 2 | dynamic if host stamps | `—` (no measured cell) |
| `roots/list` + successor | Station 1 | static (R02, superseded at the lab level by R03b) | `—` (no measured cell) |
| spawn env `COLGREP_MCP_ROOT` pin | env (launch pin) | static — process lifetime | `—` (no measured pin) |

## Observations

| Signal | Baseline / Expected (R01 ladder) | Observed [source] | Interpretation |
|:-------|:--------------------------------|:------------------|:---------------|
| `request _meta` vendor keys (rung 1: dynamic) | R01 proposed the server read a workspace stamp from per-call `_meta` (R02 Station 2: dynamic input) | `—` in all three fleet rows; gap records `claude_tool-20261127_141546.jsonl` / `codex_tool-20261127_141606.jsonl` hold only `{"error": "… completed but no probe record written"}`; the `copilot-agent-plugins` row has no record at all [source: `probe_data/harness/matrix.md`; `probe_data/harness/raw/claude_tool-20261127_141546.jsonl`; `probe_data/harness/raw/codex_tool-20261127_141606.jsonl`] | No fleet harness was measured stamping a per-call workspace value. The wire mechanism is proven cooperating-client-only (R03b); a real host stamping `_meta` is unmeasured, so the ladder's rung 1 is not exercised by any fleet row and the pick falls past it. |
| `roots/list` per call (rung 2: dynamic) | R01 proposed lazy per-call roots, awaiting the round-trip (rung 2 consumes the R03b race fix) | `—` in all three fleet rows — no `roots/list` verdict recorded for any harness [source: `probe_data/harness/matrix.md`] | The per-call roots channel R03b saw on a cooperating client was not reproduced by any fleet harness run. Rung 2 is unmeasured in the fleet; per-call roots remain a consumption-side capability awaiting a host that answers. |
| `initialize` capabilities (rung source, Station 3) | R01: once-per-spawn announcement, static (R02 Station 3) | `—` in all three fleet rows [source: `probe_data/harness/matrix.md`] | No fleet harness contributed an `initialize` capability probe either; the static rung is unmeasured at the fleet level, so no harness qualifies an initialize-stamped dynamic source. |
| `roots` successor post-2026-07-28 (rung 2 source) | R01 named the successor as a prerequisite before rung 2 promotes roots over the fallback | `—` in all three fleet rows [source: `probe_data/harness/matrix.md`] | No successor channel was observed on any fleet harness. R02's Station-1-open question (name the successor) stays open at the fleet level; the ladder keeps roots as at-best-static during this run. |
| spawn env `COLGREP_MCP_ROOT` pin (rung 3: pin) | R01 rung 3: a static explicit pin outranks inferred signals; only lever if server reads it | `—` in all three fleet rows — no launch env vars measured [source: `probe_data/harness/matrix.md`] | No fleet harness run supplied/measured a `COLGREP_MCP_ROOT` pin. The pin rung is a consumption-side, spawn-time lever; with none measured it is not the pick any harness earned this run. |
| Guarded-cwd fallback + fail+guidance (rung 4) | R01 rung 4: guarded cwd fires `ROOT_UNRESOLVED` + guidance (remedy names an absolute `paths` entry) only when no higher rung produced a root | All three fleet rows fell to the bottom of the ladder: no dynamic signal, no pin → guarded cwd → fail+guidance contract [source: `probe_data/harness/matrix.md`; consumption side already landed on this branch at `157b0a9` (ladder + guided failure)] | With both dynamic channels silent and no pin measured, the ladder's only honest landing for every fleet row is the guarded-cwd rung whose contract is `fail+guidance`: an error naming `paths` with an absolute directory, never a silent wrong root. This is what the measurement dictates, not an invented success. |

### Slice counts (picks distribution)

| R01 rung id | Harnesses it qualifies (measured) |
|:------------|:----------------------------------|
| `dynamic` | 0 |
| `pin` | 0 |
| `guarded-cwd` | 0 (as a *successful* resolution rung — no harness resolved a root) |
| `fail+guidance` | 3 (the bottom contract every silent row falls to) |

## Charts & Visualizations

```mermaid
graph TD
T[tool call, no explicit paths] --> D["dynamic workspace signal (rung 1, request _meta; rung 2, per-call roots)"]
D -.->|absent in all 3 fleet rows measured| P["COLGREP_MCP_ROOT pin (rung 3)"]
P -.->|no pin measured| C["guarded cwd (rung 4)"]
C -->|guard: cwd is install tree| F["ROOT_UNRESOLVED + guidance: pass an absolute paths entry"]
D --> RK[resolved root, root_source recorded]
P --> RK
```

Caption: measured fall of the fleet harnesses — every row landed past `dynamic` and `pin` (both `—`) onto the guarded-cwd rung's `fail+guidance` contract; no dynamic channel was measured live, so `dynamic_channels_work` counts 0. Units: fraction of the 3 fleet rows exercising each rung = 0/3 for rungs 1–3, 3/3 reaching the guarded-cwd fail+guidance.

## Contradictions & Surprises

- Mechanism vs fleet silence: R03b measured both per-call channels working on the wire (`request _meta` vendor keys and per-call `roots/list`, in `live_lab-a/b_tool-search.jsonl` and both wire transcripts), yet the fleet harness rows are uniformly `—`. The protocol carries the signal; no fleet harness emitted a probe record — the all-`—` matrix reflects sample availability, not a measured absence of the channels.
- R02's Station-1 "static, no successor" verdict was superseded at the lab level by R03b, but the fleet rows still record Station 1 as `—`: supersession happened on a cooperating client, not on any fleet harness — both statements coexist without contradiction once the layer (lab wire vs fleet harness) is named.
- Fleet census gap: two of the three harnesses were transport-auth-gated ("OAuth session expired" for `claude -p`, "401 Unauthorized" for `codex exec`) in the R03b run and reappear here as probe-record gaps; Copilot measured silent in R03b (fell to `cwd` = plugin install tree). A re-probe from authenticated sessions is the only path that can open `—` cells.

## Steering Questions

- [now] Confirm the next-campaign ship scope: obtain live dynamic signals by replaying the two auth-gated harnesses (Claude Code, Codex) against the instrumented server, and re-running the Copilot host probe — until then every fleet row stays `—` and ships nothing new.
- [now] Adopt `fail+guidance` as the production default for all three harnesses meanwhile: with no dynamic channel and no pin measured, the rung-4 contract (error names `paths` with an absolute directory — the pivot the sponsor specified over a bare loud failure) is the only safe resolution, already landed on this branch at `157b0a9`.
- [next run] Name the roots successor (R02 Station 1 opener): only then can rung 2 promote roots over the current fallback; the fleet `—` keeps it deactivated as a rung source for now.
- [next run] Measure the launch pin: the fleet recorded no `COLGREP_MCP_ROOT` value; a spawn-time pin probe would isolate whether rung 3 (pin) needs host support or is purely a server consumption-side lever.
- [later] Decide the serve-side `_meta`-consume and roots race-fix integration timing (lab-proven in R03b, landed in `6c1cb8a`/`30aad59`) against host-side stamping once a fleet harness actually stamps one of the channels.

## Pointers

- [matrix](../../__reports__/workspace_discovery/probe_data/harness/matrix.md)
- [claude gap record](../../__reports__/workspace_discovery/probe_data/harness/raw/claude_tool-20261127_141546.jsonl)
- [codex gap record](../../__reports__/workspace_discovery/probe_data/harness/raw/codex_tool-20261127_141606.jsonl)
- [live lab a](../../__reports__/workspace_discovery/probe_data/harness/raw/live_lab-a_tool-search.jsonl)
- [live lab b](../../__reports__/workspace_discovery/probe_data/harness/raw/live_lab-b_tool-search.jsonl)
- [wire 2026-07-28](../../__reports__/workspace_discovery/probe_data/harness/raw/wire-2026-07-28.log)
- [wire 2025-11-25](../../__reports__/workspace_discovery/probe_data/harness/raw/wire-2025-11-25.log)
- [R02 protocol survey](../../__reports__/workspace_discovery/01-findings_protocol_survey_v0.md)
- [R03b live probe](../../__reports__/workspace_discovery/03-findings_live_probe_v0.md)
- [dump-only signature](../../__reports__/workspace_discovery/04-findings_dump_only_signature_v0.md)
- [R01 architecture](../../__reports__/workspace_discovery/00-architecture_v0.md)

## Decision

**decision-required = confirm**: ship the next campaign from the fleet's measured silence. `dynamic_channels_work` counts 0 — every fleet harness row is `—` on request `_meta`, per-call roots, and the rest; the per-harness `Resolution Picks` are all `fail+guidance`, the rung R01's ladder falls to when both dynamic channels and any pin are silent. So the next campaign's per-call resolution ship scope is: wire `resolve_target_paths` to consume the lab-proven channels only where a fleet harness actually stamps one (the `request _meta` consume and per-call roots await/cache landed at `6c1cb8a`/`30aad59`; the ladder + `ROOT_UNRESOLVED` guided failure at `157b0a9`), and default every harness that still ships `—` to the fail+guidance contract — an error naming `paths` with an absolute directory as the remedy (the sponsor-specified pivot, never a bare loud failure and never a silent wrong root) — until a re-probed, authenticated fleet run yields live dynamic signals that promote a harness onto the `dynamic` rung.
Loading
Loading