Skip to content

fix: deduplicate symlinked skills in the analysis index - #231

Merged
kunchenguid merged 2 commits into
kunchenguid:mainfrom
FocalFactotum:fm/backpass-202-skill-dedupe
Oct 25, 2026
Merged

kunchenguid merged 2 commits into
kunchenguid:mainfrom
FocalFactotum:fm/backpass-202-skill-dedupe

Conversation

@FocalFactotum

Copy link
Copy Markdown
Contributor

Intent

Fix the duplicate analysis skill-index entries described in #202. List a symlinked skill once by realpath across user-scope harness roots while preserving per-copy budget accounting and distinct same-name files. Closes #202.

What Changed

  • Deduplicate analysis skill-index entries by realpath, retaining the first loaded path while preserving per-copy budget accounting.
  • Keep distinct same-name files and unresolved paths separate, resolving relative paths against the repository root.
  • Document the behavior and add regression coverage for shared symlinked skills and retained entries.

Closes #202.

Risk Assessment

✅ Low: The focused rendering-only change deduplicates by realpath without mutating accounting inputs, preserves distinct files, and introduces no unnecessary components or new disclosure paths.

Testing

Targeted regressions and real-CLI generated-prompt/status checks confirmed the intended behavior, with pre-fix duplication reproduced and evidence retained. Downstream model execution stopped at an unavailable offline OpenCode adapter; no successful model analysis is claimed. No full suite or static checks were run.

  • Live validation: ✅ go - 4 of 4 scenarios driven live against the product
Scenario Result Live Evidence
Analyze a shared skill linked across three user harness roots; emit one index entry ✅ pass live shared-prompt.md; baseline-cli-prompt.md; live-results.json
Analyze distinct files with identical names, descriptions, and contents; retain both paths ✅ pass live mixed-prompt.md; live-results.json
Inspect and change a shared description; budget every loaded copy ✅ pass live cli-transcripts.json; live-results.json
Analyze with no skills; preserve the empty-library index ✅ pass live empty-prompt.md; cli-transcripts.json
Evidence: Verification method, results, and execution boundary
# Skill-index live verification

## Scope and isolation

Ran the real `node bin/backpass.js` CLI in a disposable working directory with a disposable HOME, user config, user memory, Pi transcript store, npm cache, and XDG directories, all inside the worktree. CLI cwd, user-scope root, and model cwd were different directories. No real user data/configuration or credentials were used. No product functions or acpx executables were mocked.

The observable contract under test is the generated analysis prompt, not model interpretation. The real CLI discovered a disposable session and persisted its final analysis prompt before invoking the real installed acpx. Downstream execution exited 1 because OpenCode's adapter package was unavailable in the deliberately offline empty npm cache (`ENOTCACHED`). Thus these are live CLI-generated prompt checks, **not successful LLM analyses**. The prompt generation and real `status --scope user --json` outputs fully expose the changed index and unchanged billing behavior. There is no visual/UI change, so evidence is CLI JSON and generated Markdown, not screenshots.

## Results

- **Shared symlinks, first path retained:** One SKILL.md in `.agents/skills/release-signing`, linked independently from `.claude/skills` and `.codex/skills`. `status` reports 3 loaded entries. `shared-prompt.md` contains only the canonical first path, once, and omits skill bodies. Against pre-fix source, `baseline-cli-prompt.md` contains all 3 paths for the same file.
- **Adversarial same-name/description/content collision:** Two genuinely distinct SKILL.md files with identical bytes, names, and descriptions were added in `.agents/skills/same-name` and `.claude/skills/same-name`. `mixed-prompt.md` contains both paths plus the shared skill once: 3 index entries from 5 loaded entries. Their distinct realpaths are recorded in `live-results.json`.
- **Per-copy budget remains honest:** Real CLI `status` output: empty surface 16 tokens, one shared-skill copy 30, three copies 58. Thus the description costs 14 tokens per copy, 42 for three. Editing the shared description increases the budget by 81 tokens with three copies, versus 27 with one copy. All original JSON outputs are in `cli-transcripts.json`.
- **Empty skill library:** `empty-prompt.md` retains `(this repo has no skills)` with no skill entries. `status` reports zero skills.

## Supporting regression checks

Ran only the three analysis-index tests selected by `--test-name-pattern='analysis (lists|retains|preserves)'` from `test/skills.test.js` with the project's hermetic preload. They passed on target source. Copied source into a disposable baseline directory, restored `src/skills.js` and `src/analyze.js` from commit `031523dfca5a2eab837f0f24628e0d840044a698`, and ran the same tests there. The shared-symlink regression failed specifically because it rendered 3 entries instead of 1. Logs: `targeted-tests.log`, `baseline-regression.log`.

Also drove the baseline CLI with the same shared-plus-distinct fixture and retained its generated prompt and CLI log. This independently reproduces the reported defect at the product boundary.

No linters, formatters, static analysis, full test suite, push, or other pipeline phases were run. No permanent source/test changes were made. Disposable fixtures and baseline copies were removed after collecting evidence.

## Reproduction driver

`drive.mjs` records the repeatable target CLI checks and assertions. From the worktree root, place it at `.local-test-202/drive.mjs` and run `node .local-test-202/drive.mjs`; remove `.local-test-202` afterwards. Its evidence output path is fixed to this run's evidence directory.
Evidence: Real CLI transcripts and budget outputs
[
  {
    "label": "empty-status",
    "command": "node bin/backpass.js status --scope user --json",
    "cwd": "~/.no-mistakes/worktrees/a6e58b984086/01M5RNQDTQZC11BZW90BHXXKGG/.local-test-202/sandbox/working-directory",
    "exit": 0,
    "signal": null,
    "stdout": "{\n  \"repo\": \"user\",\n  \"budgets\": [\n    {\n      \"path\": \".agents/user-memory.md\",\n      \"label\": \".agents/user-memory.md\",\n      \"capTokens\": 5000,\n      \"current\": 16,\n      \"projected\": 16,\n      \"delta\": 0,\n      \"withinBudget\": true,\n      \"over\": 0,\n      \"utilization\": 0.0032,\n      \"instructions\": 1,\n      \"pointerTo\": null,\n      \"separate\": false\n    }\n  ],\n  \"crossSurfaceDuplicates\": [],\n  \"evidence\": {\n    \"ok\": 0,\n    \"failed\": 0,\n    \"skipped\": 0\n  },\n  \"scanCacheEntries\": 0,\n  \"hosts\": {},\n  \"summary\": null,\n  \"proposal\": null,\n  \"rejections\": 0,\n  \"skills\": 0\n}\n",
    "stderr": "user scope: this checkout is not a write target; edits go to the user-level memory file and skills\n"
  },
  {
    "label": "empty",
    "command": "node bin/backpass.js analyze --scope user --harness pi --since all --analysis-agent opencode --jobs 1 --force --json",
    "cwd": "~/.no-mistakes/worktrees/a6e58b984086/01M5RNQDTQZC11BZW90BHXXKGG/.local-test-202/sandbox/working-directory",
    "exit": 1,
    "signal": null,
    "stdout": "",
    "stderr": "user scope: this checkout is not a write target; edits go to the user-level memory file and skills\n· analyzing 1 transcript(s) with opencode at jobs=1\n  1/1 analyzed\nerror pinned analysis agent opencode failed unexpectedly (acpx opencode exec failed (exit 1): [acpx] error: RUNTIME AGENT_STARTUP_FAILED ACP agent exited before initialize completed (exit=1, signal=null): npm error code ENOTCACHED npm error request to https://registry.npmjs.org/opencode-ai failed: cache mode is 'only-if-cached' but no cached response is available. npm error A complete log of this run can be found in: ~/.no-mistakes/worktrees/a6e58b984086/01M5RNQDTQZC11BZW90BHXXKGG/.local-test-202/sandbox/home/.cache/npm/_logs/2026-10-25T04_41_43_313Z-debug-0.log)\n  check the opencode/acpx failure above and retry; or pin a different harness: backpass --analysis-agent <agent>\n"
  },
  {
    "label": "one-copy-status",
    "command": "node bin/backpass.js status --scope user --json",
    "cwd": "~/.no-mistakes/worktrees/a6e58b984086/01M5RNQDTQZC11BZW90BHXXKGG/.local-test-202/sandbox/working-directory",
    "exit": 0,
    "signal": null,
    "stdout": "{\n  \"repo\": \"user\",\n  \"budgets\": [\n    {\n      \"path\": \".agents/user-memory.md\",\n      \"label\": \".agents/user-memory.md + skill descriptions\",\n      \"capTokens\": 5000,\n      \"current\": 30,\n      \"projected\": 30,\n      \"delta\": 0,\n      \"withinBudget\": true,\n      \"over\": 0,\n      \"utilization\": 0.006,\n      \"instructions\": 1,\n      \"pointerTo\": null,\n      \"separate\": false\n    }\n  ],\n  \"crossSurfaceDuplicates\": [],\n  \"evidence\": {\n    \"ok\": 0,\n    \"failed\": 0,\n    \"skipped\": 0\n  },\n  \"scanCacheEntries\": 1,\n  \"hosts\": {},\n  \"summary\": null,\n  \"proposal\": null,\n  \"rejections\": 0,\n  \"skills\": 1\n}\n",
    "stderr": "user scope: this checkout is not a write target; edits go to the user-level memory file and skills\n"
  },
  {
    "label": "three-copies-status",
    "command": "node bin/backpass.js status --scope user --json",
    "cwd": "~/.no-mistakes/worktrees/a6e58b984086/01M5RNQDTQZC11BZW90BHXXKGG/.local-test-202/sandbox/working-directory",
    "exit": 0,
    "signal": null,
    "stdout": "{\n  \"repo\": \"user\",\n  \"budgets\": [\n    {\n      \"path\": \".agents/user-memory.md\",\n      \"label\": \".agents/user-memory.md + skill descriptions\",\n      \"capTokens\": 5000,\n      \"current\": 58,\n      \"projected\": 58,\n      \"delta\": 0,\n      \"withinBudget\": true,\n      \"over\": 0,\n      \"utilization\": 0.0116,\n      \"instructions\": 1,\n      \"pointerTo\": null,\n      \"separate\": false\n    }\n  ],\n  \"crossSurfaceDuplicates\": [],\n  \"evidence\": {\n    \"ok\": 0,\n    \"failed\": 0,\n    \"skipped\": 0\n  },\n  \"scanCacheEntries\": 1,\n  \"hosts\": {},\n  \"summary\": null,\n  \"proposal\": null,\n  \"rejections\": 0,\n  \"skills\": 3\n}\n",
    "stderr": "user scope: this checkout is not a write target; edits go to the user-level memory file and skills\n"
  },
  {
    "label": "shared",
    "command": "node bin/backpass.js analyze --scope user --harness pi --since all --analysis-agent opencode --jobs 1 --force --json",
    "cwd": "~/.no-mistakes/worktrees/a6e58b984086/01M5RNQDTQZC11BZW90BHXXKGG/.local-test-202/sandbox/working-directory",
    "exit": 1,
    "signal": null,
    "stdout": "",
    "stderr": "user scope: this checkout is not a write target; edits go to the user-level memory file and skills\n· analyzing 1 transcript(s) with opencode at jobs=1\n  1/1 analyzed\nerror pinned analysis agent opencode failed unexpectedly (acpx opencode exec failed (exit 1): [acpx] error: RUNTIME AGENT_STARTUP_FAILED ACP agent exited before initialize completed (exit=1, signal=null): npm error code ENOTCACHED npm error request to https://registry.npmjs.org/opencode-ai failed: cache mode is 'only-if-cached' but no cached response is available. npm error A complete log of this run can be found in: ~/.no-mistakes/worktrees/a6e58b984086/01M5RNQDTQZC11BZW90BHXXKGG/.local-test-202/sandbox/home/.cache/npm/_logs/2026-10-25T04_41_44_280Z-debug-0.log)\n  check the opencode/acpx failure above and retry; or pin a different harness: backpass --analysis-agent <agent>\n"
  },
  {
    "label": "mixed-status",
    "command": "node bin/backpass.js status --scope user --json",
    "cwd": "~/.no-mistakes/worktrees/a6e58b984086/01M5RNQDTQZC11BZW90BHXXKGG/.local-test-202/sandbox/working-directory",
    "exit": 0,
    "signal": null,
    "stdout": "{\n  \"repo\": \"user\",\n  \"budgets\": [\n    {\n      \"path\": \".agents/user-memory.md\",\n      \"label\": \".agents/user-memory.md + skill descriptions\",\n      \"capTokens\": 5000,\n      \"current\": 72,\n      \"projected\": 72,\n      \"delta\": 0,\n      \"withinBudget\": true,\n      \"over\": 0,\n      \"utilization\": 0.0144,\n      \"instructions\": 1,\n      \"pointerTo\": null,\n      \"separate\": false\n    }\n  ],\n  \"crossSurfaceDuplicates\": [],\n  \"evidence\": {\n    \"ok\": 0,\n    \"failed\": 0,\n    \"skipped\": 0\n  },\n  \"scanCacheEntries\": 1,\n  \"hosts\": {},\n  \"summary\": null,\n  \"proposal\": null,\n  \"rejections\": 0,\n  \"skills\": 5\n}\n",
    "stderr": "user scope: this checkout is not a write target; edits go to the user-level memory file and skills\n"
  },
  {
    "label": "mixed",
    "command": "node bin/backpass.js analyze --scope user --harness pi --since all --analysis-agent opencode --jobs 1 --force --json",
    "cwd": "~/.no-mistakes/worktrees/a6e58b984086/01M5RNQDTQZC11BZW90BHXXKGG/.local-test-202/sandbox/working-directory",
    "exit": 1,
    "signal": null,
    "stdout": "",
    "stderr": "user scope: this checkout is not a write target; edits go to the user-level memory file and skills\n· analyzing 1 transcript(s) with opencode at jobs=1\n  1/1 analyzed\nerror pinned analysis agent opencode failed unexpectedly (acpx opencode exec failed (exit 1): [acpx] error: RUNTIME AGENT_STARTUP_FAILED ACP agent exited before initialize completed (exit=1, signal=null): npm error code ENOTCACHED npm error request to https://registry.npmjs.org/opencode-ai failed: cache mode is 'only-if-cached' but no cached response is available. npm error A complete log of this run can be found in: ~/.no-mistakes/worktrees/a6e58b984086/01M5RNQDTQZC11BZW90BHXXKGG/.local-test-202/sandbox/home/.cache/npm/_logs/2026-10-25T04_41_44_946Z-debug-0.log)\n  check the opencode/acpx failure above and retry; or pin a different harness: backpass --analysis-agent <agent>\n"
  },
  {
    "label": "edited-three-copies-status",
    "command": "node bin/backpass.js status --scope user --json",
    "cwd": "~/.no-mistakes/worktrees/a6e58b984086/01M5RNQDTQZC11BZW90BHXXKGG/.local-test-202/sandbox/working-directory",
    "exit": 0,
    "signal": null,
    "stdout": "{\n  \"repo\": \"user\",\n  \"budgets\": [\n    {\n      \"path\": \".agents/user-memory.md\",\n      \"label\": \".agents/user-memory.md + skill descriptions\",\n      \"capTokens\": 5000,\n      \"current\": 153,\n      \"projected\": 153,\n      \"delta\": 0,\n      \"withinBudget\": true,\n      \"over\": 0,\n      \"utilization\": 0.0306,\n      \"instructions\": 1,\n      \"pointerTo\": null,\n      \"separate\": false\n    }\n  ],\n  \"crossSurfaceDuplicates\": [],\n  \"evidence\": {\n    \"ok\": 0,\n    \"failed\": 0,\n    \"skipped\": 0\n  },\n  \"scanCacheEntries\": 1,\n  \"hosts\": {},\n  \"summary\": null,\n  \"proposal\": null,\n  \"rejections\": 0,\n  \"skills\": 5\n}\n",
    "stderr": "user scope: this checkout is not a write target; edits go to the user-level memory file and skills\n"
  },
  {
    "label": "edited-one-copy-status",
    "command": "node bin/backpass.js status --scope user --json",
    "cwd": "~/.no-mistakes/worktrees/a6e58b984086/01M5RNQDTQZC11BZW90BHXXKGG/.local-test-202/sandbox/working-directory",
    "exit": 0,
    "signal": null,
    "stdout": "{\n  \"repo\": \"user\",\n  \"budgets\": [\n    {\n      \"path\": \".agents/user-memory.md\",\n      \"label\": \".agents/user-memory.md + skill descriptions\",\n      \"capTokens\": 5000,\n      \"current\": 71,\n      \"projected\": 71,\n      \"delta\": 0,\n      \"withinBudget\": true,\n      \"over\": 0,\n      \"utilization\": 0.0142,\n      \"instructions\": 1,\n      \"pointerTo\": null,\n      \"separate\": false\n    }\n  ],\n  \"crossSurfaceDuplicates\": [],\n  \"evidence\": {\n    \"ok\": 0,\n    \"failed\": 0,\n    \"skipped\": 0\n  },\n  \"scanCacheEntries\": 1,\n  \"hosts\": {},\n  \"summary\": null,\n  \"proposal\": null,\n  \"rejections\": 0,\n  \"skills\": 3\n}\n",
    "stderr": "user scope: this checkout is not a write target; edits go to the user-level memory file and skills\n"
  },
  {
    "label": "original-one-copy-status",
    "command": "node bin/backpass.js status --scope user --json",
    "cwd": "~/.no-mistakes/worktrees/a6e58b984086/01M5RNQDTQZC11BZW90BHXXKGG/.local-test-202/sandbox/working-directory",
    "exit": 0,
    "signal": null,
    "stdout": "{\n  \"repo\": \"user\",\n  \"budgets\": [\n    {\n      \"path\": \".agents/user-memory.md\",\n      \"label\": \".agents/user-memory.md + skill descriptions\",\n      \"capTokens\": 5000,\n      \"current\": 44,\n      \"projected\": 44,\n      \"delta\": 0,\n      \"withinBudget\": true,\n      \"over\": 0,\n      \"utilization\": 0.0088,\n      \"instructions\": 1,\n      \"pointerTo\": null,\n      \"separate\": false\n    }\n  ],\n  \"crossSurfaceDuplicates\": [],\n  \"evidence\": {\n    \"ok\": 0,\n    \"failed\": 0,\n    \"skipped\": 0\n  },\n  \"scanCacheEntries\": 1,\n  \"hosts\": {},\n  \"summary\": null,\n  \"proposal\": null,\n  \"rejections\": 0,\n  \"skills\": 3\n}\n",
    "stderr": "user scope: this checkout is not a write target; edits go to the user-level memory file and skills\n"
  }
]
Evidence: Measured scenario results
{
  "surface": "Real backpass CLI emitted analysis prompts; actual acpx was invoked with isolated HOME and offline npm. No model response is required to inspect this generated input contract.",
  "processCwd": "~/.no-mistakes/worktrees/a6e58b984086/01M5RNQDTQZC11BZW90BHXXKGG/.local-test-202/sandbox/working-directory",
  "userScopeRoot": "~/.no-mistakes/worktrees/a6e58b984086/01M5RNQDTQZC11BZW90BHXXKGG/.local-test-202/sandbox/home",
  "modelCwd": "~/.no-mistakes/worktrees/a6e58b984086/01M5RNQDTQZC11BZW90BHXXKGG/.local-test-202/sandbox/home/.config/backpass/user",
  "empty": {
    "skills": 0,
    "indexEntries": 0,
    "messagePreserved": true
  },
  "shared": {
    "loadedCopiesReportedByCLI": 3,
    "indexEntries": [
      "- release-signing (~/.no-mistakes/worktrees/a6e58b984086/01M5RNQDTQZC11BZW90BHXXKGG/.local-test-202/sandbox/home/.agents/skills/release-signing/SKILL.md) :: Use when signing a release or rotating its signing key."
    ],
    "firstPathWins": true,
    "bodyOmitted": true
  },
  "distinct": {
    "sameBytes": true,
    "distinctRealpaths": [
      "~/.no-mistakes/worktrees/a6e58b984086/01M5RNQDTQZC11BZW90BHXXKGG/.local-test-202/sandbox/home/.agents/skills/same-name/SKILL.md",
      "~/.no-mistakes/worktrees/a6e58b984086/01M5RNQDTQZC11BZW90BHXXKGG/.local-test-202/sandbox/home/.claude/skills/same-name/SKILL.md"
    ],
    "loadedEntries": 5,
    "indexEntries": [
      "- release-signing (~/.no-mistakes/worktrees/a6e58b984086/01M5RNQDTQZC11BZW90BHXXKGG/.local-test-202/sandbox/home/.agents/skills/release-signing/SKILL.md) :: Use when signing a release or rotating its signing key.",
      "- same-name (~/.no-mistakes/worktrees/a6e58b984086/01M5RNQDTQZC11BZW90BHXXKGG/.local-test-202/sandbox/home/.agents/skills/same-name/SKILL.md) :: Use when checking a release.",
      "- same-name (~/.no-mistakes/worktrees/a6e58b984086/01M5RNQDTQZC11BZW90BHXXKGG/.local-test-202/sandbox/home/.claude/skills/same-name/SKILL.md) :: Use when checking a release."
    ]
  },
  "billing": {
    "emptyTokens": 16,
    "oneCopyTokens": 30,
    "threeCopyTokens": 58,
    "oneCopyDescriptionCharge": 14,
    "descriptionEditSingleCopyDelta": 27,
    "descriptionEditThreeCopyDelta": 81
  }
}
Evidence: Shared skill listed once
<!-- backpass:self-session -->
You are auditing one past agent session against the repository's agent memory file.

Your job is NOT to review the code. It is to measure how well the memory file's
instructions actually steered this session, and to spot mistakes an instruction could
have prevented. This is the loss signal for a backward pass over the memory file.

## The memory file under audit: .agents/user-memory.md

Each instruction has a stable id in [brackets]. Refer to instructions ONLY by these ids.

[AG-001] (9 tok, L3) <Disposable user memory>
- Review changes before publishing.

## Project skills (load-on-trigger)

These skills exist in the repo. Each one's body is loaded only when its trigger fires,
so it is NOT shown here - only the trigger description is. If a mistake you found is
covered by one of these skills' content, it is a failed trigger: still report the gap,
and name that skill in `coveredBySkill`. Open the skill's file (path in parentheses)
only when you need its body to confirm the coverage.

- release-signing (~/.no-mistakes/worktrees/a6e58b984086/01M5RNQDTQZC11BZW90BHXXKGG/.local-test-202/sandbox/home/.agents/skills/release-signing/SKILL.md) :: Use when signing a release or rotating its signing key.

## Gaps already on the books

Earlier sessions reported these gaps; each has a stable id. If a gap you found is the
same underlying gap as one below - one instruction would prevent both - cite that id in
`matchesGap` and still describe what you saw. A gap that matches nothing here is new:
omit `matchesGap`.

(none yet)

## The distilled session trace

Tool calls are one-line summaries and tool output is truncated. The raw transcript path
is at the end of the trace: open it ONLY if a specific claim you want to make cannot be
verified from the distilled trace. Reading it is allowed but costs time, so do not do it
by default. Set `usedRawTranscript` accordingly.

# session pi-skill-index-live-check
harness: pi
date: 2026-10-25T04:41:42.564Z
cwd: ~/.no-mistakes/worktrees/a6e58b984086/01M5RNQDTQZC11BZW90BHXXKGG/.local-test-202/sandbox/working-directory
association: tier 1 (git)

\### turn 1 · user
Please prepare the local release.

\### turn 2 · assistant
I reviewed the changes before publishing.

\### turn 3 · user
Now check the release signing instructions too.

\### turn 4 · assistant
The signing checklist is available in the skill library.

---
raw transcript: ~/.no-mistakes/worktrees/a6e58b984086/01M5RNQDTQZC11BZW90BHXXKGG/.local-test-202/sandbox/home/.pi/agent/sessions/disposable/session.jsonl
Tool calls above are one-line summaries and tool output is truncated. Open the raw
transcript only if a specific claim needs the full text.


## What to report

Return ONE JSON object and nothing else. No prose before or after, no markdown fence.

`` `
{
  "positive":  [{"instruction": "AG-042", "moment": "turn 12", "effect": "what following it achieved", "quote": "verbatim text from the trace"}],
  "negative":  [{"instruction": "AG-017", "moment": "turn 3",  "effect": "what happened and what it cost", "class": "harm|non-compliance|irrelevant", "quote": "verbatim text from the trace"}],
  "gaps":      [{"mistake": "what went wrong", "proposedInstruction": "one sentence that would have prevented it", "recurrenceRisk": "high|medium|low", "domain": "project|orchestration", "matchesGap": "<id from the list above, omit when new>", "coveredBySkill": "<skill name from the skills list, omit when none covers it>", "quote": "verbatim text from the trace"}],
  "usedRawTranscript": false
}
`` `

Rules, in order of importance:

1. **Every item needs a verbatim `quote` copied exactly from the trace.** Items without
   a real quote are discarded downstream, so an unquotable claim is wasted work.
2. **Negative evidence is the most valuable.** A visible violation, misreading, or
   ignored instruction outranks a dozen "it went fine" observations.
3. **`class` states what a negative means, and the difference decides the instruction's
   fate.** `harm`: the agent FOLLOWED the instruction and following it caused damage or
   cost - evidence against the instruction itself. `non-compliance`: the agent ignored
   or violated the instruction - evidence the instruction failed to steer, which argues
   for reinforcing it, never for deleting it. `irrelevant`: on inspection the moment
   does not actually bear on this instruction. Never report a skipped rule as `harm`.
4. **`domain` states what caused a gap.** A gap is `orchestration` when the mistake was
   not caused by this repository, but by an external agent harness or tooling that
   orchestrated the task (a task brief, a supervisor's process, the harness itself - by
   way of illustration only, not a list to match against); every other gap is `project`.
   Ask the causal question, not which category the wording resembles. If this
   repository IS the orchestrating tool, mistakes in how it orchestrated are `project`.
   Orchestration gaps are counted but never proposed into this repository's memory file.
5. **Do not confabulate influence.** Only call something positive when the trace shows
   the agent doing the specific thing the instruction asks for. An outcome that would
   have happened anyway is not evidence.
6. `gaps` are mistakes NOT covered by any current instruction. If an instruction exists
   and was ignored, that is `negative` with `class: "non-compliance"`, not a gap. A
   mistake covered only by a SKILL's content is still a gap - skills have no
   instruction ids - but cite the skill in `coveredBySkill`: that is a failed trigger,
   and the fix is that skill's description, not new memory-file text.
7. `proposedInstruction` must be one imperative sentence, specific enough to act on and
   general enough to apply beyond this one session.
8. An empty array is a valid and useful answer. Report nothing rather than something weak.
Evidence: Distinct same-name files retained
<!-- backpass:self-session -->
You are auditing one past agent session against the repository's agent memory file.

Your job is NOT to review the code. It is to measure how well the memory file's
instructions actually steered this session, and to spot mistakes an instruction could
have prevented. This is the loss signal for a backward pass over the memory file.

## The memory file under audit: .agents/user-memory.md

Each instruction has a stable id in [brackets]. Refer to instructions ONLY by these ids.

[AG-001] (9 tok, L3) <Disposable user memory>
- Review changes before publishing.

## Project skills (load-on-trigger)

These skills exist in the repo. Each one's body is loaded only when its trigger fires,
so it is NOT shown here - only the trigger description is. If a mistake you found is
covered by one of these skills' content, it is a failed trigger: still report the gap,
and name that skill in `coveredBySkill`. Open the skill's file (path in parentheses)
only when you need its body to confirm the coverage.

- release-signing (~/.no-mistakes/worktrees/a6e58b984086/01M5RNQDTQZC11BZW90BHXXKGG/.local-test-202/sandbox/home/.agents/skills/release-signing/SKILL.md) :: Use when signing a release or rotating its signing key.
- same-name (~/.no-mistakes/worktrees/a6e58b984086/01M5RNQDTQZC11BZW90BHXXKGG/.local-test-202/sandbox/home/.agents/skills/same-name/SKILL.md) :: Use when checking a release.
- same-name (~/.no-mistakes/worktrees/a6e58b984086/01M5RNQDTQZC11BZW90BHXXKGG/.local-test-202/sandbox/home/.claude/skills/same-name/SKILL.md) :: Use when checking a release.

## Gaps already on the books

Earlier sessions reported these gaps; each has a stable id. If a gap you found is the
same underlying gap as one below - one instruction would prevent both - cite that id in
`matchesGap` and still describe what you saw. A gap that matches nothing here is new:
omit `matchesGap`.

(none yet)

## The distilled session trace

Tool calls are one-line summaries and tool output is truncated. The raw transcript path
is at the end of the trace: open it ONLY if a specific claim you want to make cannot be
verified from the distilled trace. Reading it is allowed but costs time, so do not do it
by default. Set `usedRawTranscript` accordingly.

# session pi-skill-index-live-check
harness: pi
date: 2026-10-25T04:41:42.564Z
cwd: ~/.no-mistakes/worktrees/a6e58b984086/01M5RNQDTQZC11BZW90BHXXKGG/.local-test-202/sandbox/working-directory
association: tier 1 (git)

\### turn 1 · user
Please prepare the local release.

\### turn 2 · assistant
I reviewed the changes before publishing.

\### turn 3 · user
Now check the release signing instructions too.

\### turn 4 · assistant
The signing checklist is available in the skill library.

---
raw transcript: ~/.no-mistakes/worktrees/a6e58b984086/01M5RNQDTQZC11BZW90BHXXKGG/.local-test-202/sandbox/home/.pi/agent/sessions/disposable/session.jsonl
Tool calls above are one-line summaries and tool output is truncated. Open the raw
transcript only if a specific claim needs the full text.


## What to report

Return ONE JSON object and nothing else. No prose before or after, no markdown fence.

`` `
{
  "positive":  [{"instruction": "AG-042", "moment": "turn 12", "effect": "what following it achieved", "quote": "verbatim text from the trace"}],
  "negative":  [{"instruction": "AG-017", "moment": "turn 3",  "effect": "what happened and what it cost", "class": "harm|non-compliance|irrelevant", "quote": "verbatim text from the trace"}],
  "gaps":      [{"mistake": "what went wrong", "proposedInstruction": "one sentence that would have prevented it", "recurrenceRisk": "high|medium|low", "domain": "project|orchestration", "matchesGap": "<id from the list above, omit when new>", "coveredBySkill": "<skill name from the skills list, omit when none covers it>", "quote": "verbatim text from the trace"}],
  "usedRawTranscript": false
}
`` `

Rules, in order of importance:

1. **Every item needs a verbatim `quote` copied exactly from the trace.** Items without
   a real quote are discarded downstream, so an unquotable claim is wasted work.
2. **Negative evidence is the most valuable.** A visible violation, misreading, or
   ignored instruction outranks a dozen "it went fine" observations.
3. **`class` states what a negative means, and the difference decides the instruction's
   fate.** `harm`: the agent FOLLOWED the instruction and following it caused damage or
   cost - evidence against the instruction itself. `non-compliance`: the agent ignored
   or violated the instruction - evidence the instruction failed to steer, which argues
   for reinforcing it, never for deleting it. `irrelevant`: on inspection the moment
   does not actually bear on this instruction. Never report a skipped rule as `harm`.
4. **`domain` states what caused a gap.** A gap is `orchestration` when the mistake was
   not caused by this repository, but by an external agent harness or tooling that
   orchestrated the task (a task brief, a supervisor's process, the harness itself - by
   way of illustration only, not a list to match against); every other gap is `project`.
   Ask the causal question, not which category the wording resembles. If this
   repository IS the orchestrating tool, mistakes in how it orchestrated are `project`.
   Orchestration gaps are counted but never proposed into this repository's memory file.
5. **Do not confabulate influence.** Only call something positive when the trace shows
   the agent doing the specific thing the instruction asks for. An outcome that would
   have happened anyway is not evidence.
6. `gaps` are mistakes NOT covered by any current instruction. If an instruction exists
   and was ignored, that is `negative` with `class: "non-compliance"`, not a gap. A
   mistake covered only by a SKILL's content is still a gap - skills have no
   instruction ids - but cite the skill in `coveredBySkill`: that is a failed trigger,
   and the fix is that skill's description, not new memory-file text.
7. `proposedInstruction` must be one imperative sentence, specific enough to act on and
   general enough to apply beyond this one session.
8. An empty array is a valid and useful answer. Report nothing rather than something weak.
  • Evidence: Empty-library generated prompt (local file: ~/.no-mistakes/evidence/01M5RNQDTQZC11BZW90BHXXKGG/empty-prompt.md)
  • Evidence: Pre-fix CLI prompt reproducing duplication (local file: ~/.no-mistakes/evidence/01M5RNQDTQZC11BZW90BHXXKGG/baseline-cli-prompt.md)
Evidence: Targeted regression results
✔ analysis lists a shared user skill once while billing every harness copy (27.157375ms)
✔ analysis retains distinct files with identical names and descriptions (2.244ms)
✔ analysis preserves unresolved skill paths and the empty-index message (0.183334ms)
ℹ tests 3
ℹ suites 0
ℹ pass 3
ℹ fail 0
ℹ cancelled 0
ℹ skipped 0
ℹ todo 0
ℹ duration_ms 116.571041
Evidence: Expected pre-fix regression failure
✖ analysis lists a shared user skill once while billing every harness copy (12.154791ms)
✔ analysis retains distinct files with identical names and descriptions (2.677ms)
✔ analysis preserves unresolved skill paths and the empty-index message (0.083ms)
ℹ tests 3
ℹ suites 0
ℹ pass 2
ℹ fail 1
ℹ cancelled 0
ℹ skipped 0
ℹ todo 0
ℹ duration_ms 83.625167

✖ failing tests:

test at .local-test-202/baseline/test/skills.test.js:227:1
✖ analysis lists a shared user skill once while billing every harness copy (12.154791ms)
  AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
  + actual - expected
  
  + '- release-signing (.agents/skills/release-signing/SKILL.md) :: Use when signing a release or rotating the signing key.\n' +
  +   '- release-signing (.claude/skills/release-signing/SKILL.md) :: Use when signing a release or rotating the signing key.\n' +
  +   '- release-signing (.codex/skills/release-signing/SKILL.md) :: Use when signing a release or rotating the signing key.'
  - '- release-signing (.agents/skills/release-signing/SKILL.md) :: Use when signing a release or rotating the signing key.'
  
      at TestContext.<anonymous> (file://~/.no-mistakes/worktrees/a6e58b984086/01M5RNQDTQZC11BZW90BHXXKGG/.local-test-202/baseline/test/skills.test.js:245:10)
      at Test.runInAsyncScope (node:async_hooks:227:14)
      at Test.run (node:internal/test_runner/test:1306:25)
      at Test.start (node:internal/test_runner/test:1177:17)
      at startSubtestAfterBootstrap (node:internal/test_runner/harness:385:17) {
    generatedMessage: true,
    code: 'ERR_ASSERTION',
    actual: '- release-signing (.agents/skills/release-signing/SKILL.md) :: Use when signing a release or rotating the signing key.\n- release-signing (.claude/skills/release-signing/SKILL.md) :: Use when signing a release or rotating the signing key.\n- release-signing (.codex/skills/release-signing/SKILL.md) :: Use when signing a release or rotating the signing key.',
    expected: '- release-signing (.agents/skills/release-signing/SKILL.md) :: Use when signing a release or rotating the signing key.',
    operator: 'strictEqual',
    diff: 'simple'
  }

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

✅ **Review** - passed

✅ No issues found.

✅ **Test** - passed

✅ No issues found.

  • Live validation: ✅ go - 4 of 4 scenarios driven live against the product
Scenario Result Live Evidence
Analyze a shared skill linked across three user harness roots; emit one index entry ✅ pass live shared-prompt.md; baseline-cli-prompt.md; live-results.json
Analyze distinct files with identical names, descriptions, and contents; retain both paths ✅ pass live mixed-prompt.md; live-results.json
Inspect and change a shared description; budget every loaded copy ✅ pass live cli-transcripts.json; live-results.json
Analyze with no skills; preserve the empty-library index ✅ pass live empty-prompt.md; cli-transcripts.json
  • TMPDIR="$PWD/.local-test-202/tmp" env -u PI_CODING_AGENT_DIR -u PI_CODING_AGENT_SESSION_DIR node --import ./test/helpers/hermetic-config.js --test --test-name-pattern='analysis (lists|retains|preserves)' test/skills.test.js
  • node .local-test-202/drive.mjs: isolated real-CLI analysis-prompt generation and user-scope budget checks.
  • Repeated the selected regression tests against disposable source restored from base commit; reproduced the duplicate-entry failure.
  • Ran the disposable baseline CLI against the same symlink fixture; captured three duplicate entries.
  • Removed disposable fixtures and baseline source; confirmed no worktree changes remained.
✅ **Document** - passed

✅ No issues found.

⏭️ **Lint** - skipped
  • ⚠️ package.json - Lint, format, and typecheck checks are blocked: node_modules/.bin is absent, and pnpm, eslint, prettier, and tsc are not on PATH. Provision the development tools and rerun these checks. git diff --check passed.
✅ **Push** - passed

✅ No issues found.

List each shared skill file once in analysis prompts while preserving every loaded entry for per-copy budget accounting. Keep distinct same-name skills visible.

Closes kunchenguid#202
@greptile-apps

greptile-apps Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] The PR appears safe to merge.

Reviews (1) · Last reviewed commit: "no-mistakes(document): Document realpath..." · Reviewed by Greptile

@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate.

Reviewed on latest main 031523d (backpass 0.1.39). Diff-reviewed and approved fork CI; all checks are green (build-and-test on ubuntu and macOS, generated-files guard, no-mistakes), and the branch is CLEAN. The change does what #202 asked: renderSkillIndexForAnalysis dedupes by the skill file's realpath, keeps the first loaded path, leaves the accounting input untouched so loadedCopies and skillDescriptionTokens still bill every copy, keeps distinct same-name files, and keeps unresolved paths separate. The new symlink regression fails against the pre-fix source, and the live CLI prompt and status evidence covers the changed surface.

Contract-class: restore. The analysis prompt already promises an index of the skills that exist; listing one file once per symlink was a defect on that default path. No new surface, write, or default.

VISION per-rule:

  • Evidence is the only currency: aligns (no quote or corroboration change; coveredBySkill still sees every distinct skill).
  • The human owns the weights: aligns (read-only prompt rendering; no write or review path touched).
  • Nothing the model says is taken on faith: aligns (mechanical realpath dedupe; budget still measured from every loaded copy).
  • The budget is the constraint: aligns (always-loaded billing stays per copy; only duplicated analysis input goes away).
  • It reads what you already have and owns nothing: aligns (local files only, no key or server).
  • Failure is loud and named: aligns (fixed at the root of the index, verified against the real library-plus-symlinks layout; the test fails when the behavior is removed).
  • Scope: aligns (no widening of scope, the two-session bar, or per-edit review).

Merging.

@kunchenguid
kunchenguid merged commit 9ded619 into kunchenguid:main Oct 25, 2026
5 checks passed
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: this is merged. Thank you @FocalFactotum — really appreciate you taking the time on this.

MrGTV-love added a commit to MrGTV-love/backpass that referenced this pull request Oct 26, 2026
* fix(acpx): treat a model the adapter turns down as model-unavailable (kunchenguid#219)

When the Claude ACP adapter rejects the requested model after session/new,
acpx prints `Failed session/set_config_option for model "<id>": Invalid value
for config option model` and exits 1. classifyAcpxFailure did not recognize
that line, so openSession reported "has no session support" and an analysis
pass with an effort stopped with "its acpx adapter does not support sessions -
upgrade acpx or omit the effort override", although sessions worked and acpx
was current. Seen with acpx 0.19.6, claude-agent-acp 0.81.2 and a Claude Code
build whose advertised model list predates the pinned model.

The classifier now reads that line as model-unavailable, the verdict kunchenguid#185
gave "does not support this model": a pinned pass names the model, and an
auto-picked one falls through to the next candidate.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

* chore(main): release backpass 0.1.37 (kunchenguid#222)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* fix(workspace): keep VCS internals and binary files out of the staging copy (kunchenguid#220)

* fix(workspace): keep VCS internals and binary files out of the staging copy

prepareWorkspace walked every skill directory whole, so a skill checked out
with its own .git, or one that ships compiled tools, was copied into
.backpass/synthesis/ and read into `originals` as utf-8 text. On a 1.7 GB
user skills directory (one skill carried a 173 MB object store and six
~82 MB executables) synthesis exhausted Node's 4 GB heap while building the
staging copy, before the edit turn opened, and the process died with exit
134.

The walk now prunes `.git`, `.hg` and `.svn` without descending into them,
and a file whose first 8,000 bytes hold a NUL (git's own binary test) is not
staged. Both are named in `unstageable` with their reason, so nothing is
dropped silently. A binary read as utf-8 was never a faithful original, and
no text edit applies to it. Supporting text files such as notes.txt are
still copied whole.

Fixes kunchenguid#75.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* no-mistakes(ci): Fixed ci-1 in src/workspace.js. The invariant is that nothing synthesis writes is silently dropped. measureWorkspace now passes a collector to its walkFiles call, so VCS entries (.git, .hg, .svn, directories or a .git file) that the walk prunes are reported in `stray`. The reason is a new named constant, STRAY_VCS: "synthesis wrote version-control internals, which are never carried or applied". Staging never copies a VCS entry, so any one found at measure time was written during synthesis. Pruning in walkFiles is unchanged: those entries are still never descended into or copied. Paths are named the way other stray notes are, mapped back to the logical repo path. To do that I pulled the existing mapping lookup and logical-path code into two small local helpers, `mappingFor` and `logicalFor`, which the normal stray loop now uses too. Binary files, confinement reasons and the other stray rules are untouched, and I added no tests. Checks: eslint and tsc are clean and prettier --write was applied. I ran test/workspace.test.js, test/synthesize.test.js and test/synthesis-cli.test.js: the same 46 tests fail before and after the change (compared by name). The ones I looked at fail with EPERM on fs.symlink, the Windows host limit noted in the intent. A one-off script confirmed the behaviour: prepareWorkspace still reports `.agents/skills/foo/.git` as unstageable, measureWorkspace shows no stray before a write, and after writing `.agents/skills/foo/.git/config` and a root `.git` file it reports both in `stray` with STRAY_VCS and zero changes

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

* chore(main): release backpass 0.1.38 (kunchenguid#223)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* fix: run first Claude analysis call alone before fan-out (kunchenguid#226)

* fix(analyze): run the first Claude analysis call alone before the fan-out

At --jobs above 1 the first wave of analysis calls each starts with its own
short-lived 'sessions new' helper. When Claude's OAuth token is due, one helper
takes .oauth_refresh.lock and exits before the refresh ends, so every parallel
session then fails with 'another Claude Code process is refreshing it' and the
run dies before analysing anything.

With the claude agent, run transcripts one at a time until one has made a model
call (a skipped trivial session made none), so a due refresh finishes inside a
single long-lived process, then fan out. Other agents keep the full fan-out.
This is not a retry: nothing is re-run.

Closes kunchenguid#203

Signed-off-by: Gaurav Jadhav <gaurav.vjadhav01@gmail.com>

* no-mistakes(review): Fix warm-up to detect model-call attempts, not failure vs skip

* no-mistakes(document): Fix no-useless-assignment lint error in analyze.js warm-up loop

* no-mistakes(review): Fix outcome overwrite when writeEvidence throws after model call succeeds

* no-mistakes(document): Format new warmup test file; no stale docs found

* no-mistakes(ci): Addressed the Greptile finding (ci-1) in test/analyze-claude-warmup.test.js: the existing warm-up tests never exercised a failed first model call, so `err.modelCallAttempted` had no coverage. Added a new test case plus a corresponding branch in the fake acpx fixture: a session id starting with "fail" now returns unparseable text after the fake prompt call (a genuine model-call attempt that fails analysis afterward, not a blank/empty-output case, since a pinned agent turns empty-output into a fatal UserError that would abort the whole run). The new test asserts the failing first call still runs alone (new/prompt/failed, nothing else starts), counts as attempted/failed, and the remaining calls then run together (overlapping prompts) and succeed. Ran `pnpm run check` (lint, format:check, typecheck, full test suite — 956 tests) with zero failures

---------

Signed-off-by: Gaurav Jadhav <gaurav.vjadhav01@gmail.com>

* chore(main): release backpass 0.1.39 (kunchenguid#228)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* fix: deduplicate symlinked skills in the analysis index (kunchenguid#231)

* fix(skills): dedupe the analysis index by realpath

List each shared skill file once in analysis prompts while preserving every loaded entry for per-copy budget accounting. Keep distinct same-name skills visible.

Closes kunchenguid#202

* no-mistakes(document): Document realpath-deduplicated skill analysis indexing

* chore(main): release backpass 0.1.40 (kunchenguid#232)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* fix(synthesize): report a mid-run change to a watched repo file as observed (kunchenguid#224)

* fix(synthesize): report a mid-run change to a watched repo file as observed

assertRepoUntouched blamed the synthesis harness for any change to a
fingerprinted in-repo file, so a concurrent editor in a shared workspace
aborted the run with the wrong cause. Name the observation instead, list
concurrent writers as a possible cause, and keep the harness attribution
only when the repo file now equals the staging copy.

Closes kunchenguid#199

Signed-off-by: Gaurav Jadhav <gaurav.vjadhav01@gmail.com>

* fix(synthesize): keep the fingerprint in step with the rebuilt staging copy

A skill another process edits after the fingerprint but before the
workspace is rebuilt was copied into staging, so the later equality check
named the harness for a change it did not make. Point each staged skill's
fingerprint at the text its staging copy was built from.

An absolute in-repo memory path was read as repo.root joined with the
absolute path, so a real write-through got the softer wording. Resolve
fingerprint keys the same way repoFingerprint does.

Closes kunchenguid#199

Signed-off-by: Gaurav Jadhav <gaurav.vjadhav01@gmail.com>

* fix(synthesize): report a write by an earlier candidate before rebuilding

The fingerprint is re-pointed at the rebuilt staging copy so a concurrent
edit made before the first harness runs is not blamed on it. A candidate
after the first runs behind a harness that may have written to the
repository, and rebuilding over that write would hide it. Check the
repository first on every attempt after the first.

Closes kunchenguid#199

Signed-off-by: Gaurav Jadhav <gaurav.vjadhav01@gmail.com>

* no-mistakes(document): fix: rewrap jsdoc comment, clean lint/format/typecheck

---------

Signed-off-by: Gaurav Jadhav <gaurav.vjadhav01@gmail.com>

---------

Signed-off-by: Gaurav Jadhav <gaurav.vjadhav01@gmail.com>
Co-authored-by: Daniel Martinez Morales <4965968+dmmdea@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Gaurav Vijay Jadhav <gaurav.vjadhav01@gmail.com>
Co-authored-by: FocalFactotum <305704917+FocalFactotum@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Analysis prompt lists a symlinked skill once per harness root (user scope)

2 participants