# grepathy - Doramagic AI Context Pack

> Positioning: a pre-install experience and judgment asset. It helps the host AI get off to a good start, but it does not mean the project has already been installed, run, or validated.

## Sufficiency Principle

- **Sufficiency over compression**: The AI Context Pack should be sufficient for the host AI to understand the project's value, capability boundaries, entrypoints, risks, and evidence sources before starting work; it may be layered, but it does not aim for the shortest possible summary.
- **Compression policy**: Compress only noise and duplication, never context that affects judgment or the quality of the work.

## How the Host AI Should Use This

You are reading the AI Context Pack that Doramagic compiled for grepathy. Treat it as pre-work context: help the user understand who it fits, what it can do, how to start, what must be verified after install, and where the risks are. Do not claim that you have already installed, run, or executed the target project.

## Claim Consumption Rules

- **Fact source**: Repo Evidence + Claim/Evidence Graph; the Human Wiki only supplies salience, terminology, and narrative structure.
- **Minimum status for a fact**: `supported`
- `supported`: May be used as a project fact, but the answer must cite the claim_id and evidence path.
- `weak`: Usable only as a low-confidence lead; the user must be asked to keep verifying.
- `inferred`: Usable only for risk notes or open questions; must not be packaged as a project fact.
- `unverified`: Must not be used as fact; state clearly that evidence is insufficient.
- `contradicted`: Must show the conflicting sources and must not force a single version on the user's behalf.

## Who It Fits Best

- **Developers already using host AIs such as Claude/Codex/Cursor/Gemini**: The README or plugin config mentions multiple host AIs. Evidence: `README.md` Claim: `clm_0002` supported 0.86

## What It Can Do

- **Command-Line Startup or Install Flow** (Verify after install): The project documentation contains runnable commands; real use requires running them in a local or host environment. Evidence: `README.md` Claim: `clm_0001` supported 0.86

## How to Start

- `npx grepathy init` Evidence: `README.md` Claim: `clm_0003` supported 0.86

## Continue-or-Stop Decision Card

- **Current recommendation**: Sandbox-trial permissions first
- **Why**: The project has signals of install commands, host configuration, or local writes; do not go straight into your primary environment—trial it in isolation first.

### 30-Second Read

- **What to do now**: Sandbox-trial permissions first
- **Minimum safe next step**: Run Prompt Preview first; if you still want to install, trial only in an isolated environment
- **Do not trust yet**: Tool permission boundaries cannot be trusted before install.
- **Continuing will touch**: Command execution, Host AI configuration, Local environment or project files

### What You Can Trust Now

- **Target-audience signal: Developers already using host AIs such as Claude/Codex/Cursor/Gemini** (supported): Backed by a supported claim or project evidence, but that still is not the same as real install results. Evidence: `README.md` Claim: `clm_0002` supported 0.86
- **Capability exists: Command-Line Startup or Install Flow** (supported): You can trust that the project contains signals of this capability; whether it fits your specific task still needs trial or after-install verification. Evidence: `README.md` Claim: `clm_0001` supported 0.86
- **There are Quick Start / install-command signals** (supported): You can trust that the docs mention a startup or install entrypoint; do not run it directly in your primary environment because of that. Evidence: `README.md` Claim: `clm_0003` supported 0.86

### What You Cannot Trust Yet

- **Tool permission boundaries cannot be trusted before install.** (unverified): MCP/tool projects usually touch files, the network, the browser, or external APIs, so permissions and logs must be checked for real.
- **Real output quality cannot be trusted before install.** (unverified): Prompt Preview can only show how it guides you; it cannot prove result quality in the real project.
- **Host AI version compatibility cannot be trusted before install.** (unverified): Host loading rules and version differences across Claude, Cursor, Codex, Gemini, and others must be verified in a real environment.
- **That it will not pollute your existing host AI's behavior cannot be trusted directly.** (inferred): Skill, plugin, and AGENTS/CLAUDE/GEMINI instructions may change the host AI's default behavior. Evidence: `CLAUDE.md`
- **Safe rollback cannot be assumed by default.** (unverified): Unless the project clearly provides uninstall and recovery instructions, verify in an isolated environment first.
- **After a real install, is it compatible with the user's current host AI version?** (unverified): Compatibility can only be verified in the actual host environment.
- **Does the project's output quality meet the user's specific task?** (unverified): The pre-install preview can only show flow and boundaries; it cannot replace real evaluation.
- **Do the install commands require network access, permissions, or global writes?** (unverified): This affects install risk in both enterprise and personal environments. Evidence: `README.md`

### What Continuing Will Touch

- **Command execution**: Package managers, network downloads, the local plugin directory, project config, or the user's home directory. Why: Running the very first command can already change your environment; decide whether it is worth running first. Evidence: `README.md`
- **Host AI configuration**: The plugin, Skill, or rule-loading config of hosts like Claude/Codex/Cursor/Gemini/OpenCode. Why: Host configuration changes how the AI works afterward and may conflict with the user's existing rules. Evidence: `CLAUDE.md`
- **Local environment or project files**: Install results, plugin caches, project config, or local dependency directories. Why: The write scope and rollback path cannot be proven before install and need isolated verification. Evidence: `README.md`
- **Host AI context**: The AI Context Pack, Prompt Preview, Skill routing, risk rules, and project facts. Why: Importing context affects the host AI's later judgment, so avoid packaging unverified items as facts.

### Minimum Safe Next Steps

- **Run Prompt Preview first**: Use a pre-install interactive trial to judge whether the way of working fits; it needs no authorization or environment change. (applies when: Applies to any project, especially when output quality is unknown.)
- **Trial-install only in an isolated directory or a test account**: Avoid letting install commands pollute your primary host AI, real projects, or home directory. (applies when: When there are signals of command execution, plugin config, or local writes.)
- **Back up your host AI configuration first**: Skill, plugin, and rule files may change the default behavior of Claude/Cursor/Codex. (applies when: When there is a plugin manifest, a Skill, or a host rule entrypoint.)
- **After install, verify just one minimal task**: Verify loading, compatibility, output quality, and rollback first, then decide whether to use it deeply. (applies when: When moving from a trial into a real workflow.)

### Exit Plan

- **Preserve the pre-install state**: Record the original host config and project state so you can later judge whether it is recoverable.
- **Be ready to remove the host plugin / Skill / rule entrypoint**: If behavior is off after the trial install, you can restore the host AI to its pre-trial state.
- **Record the install commands and written paths**: Without clear uninstall instructions, you at least need to know which directories or configs to clean up manually.
- **If there is no rollback path, do not enter your primary environment**: No rollback is a blocker before continuing; do not proceed on trust or luck.

## What Can Only Be Previewed

- Explain who the project fits and what it can do
- Demonstrate a typical conversation flow based on project docs
- Help the user decide whether it is worth installing or researching further

## What Must Be Verified After Install

- Actually installing the Skill, plugin, or CLI
- Running scripts, modifying local files, or accessing external services
- Verifying real output quality, performance, and compatibility

## Boundary & Risk Decision Card

- **Mistaking the pre-install preview for a real run**: The user may overestimate how much configuration, permission, and compatibility verification the project has already done. Mitigation: Clearly separate prompt_preview_can_do from runtime_required. Claim: `clm_0004` inferred 0.45
- **Command execution will modify the local environment**: Install commands may write to the user's home directory, the host plugin directory, or project configuration. Mitigation: Run in an isolated environment or a test account first. Evidence: `README.md` Claim: `clm_0005` supported 0.86
- **To confirm**: After a real install, is it compatible with the user's current host AI version?. Why: Compatibility can only be verified in the actual host environment.
- **To confirm**: Does the project's output quality meet the user's specific task?. Why: The pre-install preview can only show flow and boundaries; it cannot replace real evaluation.
- **To confirm**: Do the install commands require network access, permissions, or global writes?. Why: This affects install risk in both enterprise and personal environments.

## Pre-Work Working Context

### Loading Order

- First read how_to_use.host_ai_instruction to establish the boundaries of this pre-install judgment asset.
- Read claim_graph_summary to confirm facts come from the Claim/Evidence Graph, not the Human Wiki narrative.
- Then read intended_users, capabilities, and quick_start_candidates to judge whether the user is a match.
- When you need to carry out a concrete task, check role_skill_index first, then evidence_index.
- For real install, file modification, network access, performance, or compatibility questions, turn to risk_card and boundaries.runtime_required.

### Task Routes

- **Command-Line Startup or Install Flow**: State that this is an after-install capability first, then give a pre-install checklist. Boundary: Must be verified after a real install or run. Evidence: `README.md` Claim: `clm_0001` supported 0.86

### Context Scale

- Total files: 67
- Important-file coverage: 40/67
- Evidence index entries: 40
- Role / Skill entries: 10

### Handling Insufficient Evidence

- **missing_evidence**: State that evidence is insufficient and ask the user for the target file, a README section, or after-install verification records; do not fill in facts.
- **out_of_scope_request**: State that the task is beyond the current AI Context Pack's evidence scope and suggest the user check the Human Manual or verify after a real install.
- **runtime_request**: Provide a pre-install checklist and command sources, but do not run commands for the user or claim they have been run.
- **source_conflict**: Show the conflicting sources side by side, mark them as unverified, and do not force a single version.

## Prompt Recipes

### Fit assessment

- Goal: Judge whether this project fits the user's current task.
- Expected output: A fit conclusion, key reasons, evidence citations, what can be previewed before install, what must be verified after install, and a next-step recommendation.

```text
Based on the AI Context Pack for grepathy, ask me 3 necessary questions first, then judge whether it fits my task. The answer must cover: who it fits, what it can do, what it cannot do, whether it is worth installing, and where the evidence comes from. Every project fact must cite evidence_refs, source_paths, or a claim_id.
```

### Pre-install experience

- Goal: Let the user feel the core workflow before installing, while avoiding packaging the preview as real capability or a marketing promise.
- Expected output: An experience script with boundary labels, an after-install verification checklist, and a cautious recommendation; with no real-run promises or strong marketing language.

```text
Treat grepathy as a pre-install experience asset, not an already-installed tool or a real runtime environment.

Output exactly four parts:
1. Ask me 3 necessary questions first.
2. Give an "experience script": use the three labels [Previewable before install], [Must verify after install], and [Insufficient evidence] to show how it might guide the workflow.
3. Give an after-install verification checklist: list which capabilities can only be confirmed after a real install, real host loading, and a real project run.
4. Give a cautious recommendation: only "worth researching/trialing further", "add information before deciding", or "not recommended to continue"; do not endorse the project.

Hard boundaries:
- Do not claim you have installed, run, executed tests, modified files, or produced real results.
- Do not write promise-like phrasing such as "auto-adapts", "guarantees passing", "perfect fit", or "strongly recommend installing".
- If you describe how it works after install, you must use a conditional such as "if installed successfully and the host loads the Skill correctly, it might...".
- The experience script may only be written as "example lines / hypothetical flow": use "might ask / might suggest / might show", not "has written, has generated, has passed, is running, is generating".
- Prompt Preview does not hand out install commands; if the user is ready to trial, only prompt them to read Quick Start and the Risk Card first and to verify in an isolated environment.
- Every project fact must come from a supported claim, evidence_refs, or source_paths; inferred/unverified items can only be risks or open questions.

```

### Role / Skill selection

- Goal: Pick the best-matching asset from the project's roles or Skills.
- Expected output: A list of candidate roles or Skills, each with an applicable scenario, evidence paths, risk boundary, and whether after-install verification is needed.

```text
Read role_skill_index and recommend 3-5 of the most relevant roles or Skills for my target task. For each recommendation, state the applicable scenario, likely output, risk boundary, and evidence_refs.
```

### Risk pre-check

- Goal: Identify environment, permission, rule-conflict, and quality risks before installing or adopting.
- Expected output: A checklist of environment, permission, dependency, license, host-conflict, quality risk, and unknown items.

```text
Based on risk_card, boundaries, and quick_start_candidates, give me a pre-install risk pre-check list. Do not run commands for me; only explain what I should check, why, and what impact a failure would have.
```

### Host AI kickoff instruction

- Goal: Turn the project context into a host AI instruction for the start of a conversation.
- Expected output: A pre-work instruction with clear boundaries and clear evidence citations, suitable to copy to a host AI.

```text
Based on the AI Context Pack for grepathy, generate a pre-work instruction I can paste to my host AI. This instruction must obey not_runtime=true and must not claim the project has been installed, run, or produced real results.
```

## Role / Skill Index

- Indexed 10 role / Skill / project-doc entries.

- **Design reasoning lives in .ai/why/** (project_doc): This repo records the why behind its code in .ai/why/ .md "why-packs" , distilled from AI coding sessions. The why-pack is the ground truth for why — prefer it over commit messages, which are lossy and can be out of date. Activation hint: Reference this when the user needs to understand the project's structure, install path, or boundaries. Evidence: `CLAUDE.md`
- **Grepathy** (project_doc): Make agent-written code reviewable. Activation hint: Reference this when the user needs to understand the project's structure, install path, or boundaries. Evidence: `README.md`
- **Contributing** (project_doc): Thanks for helping out. The bar for a change is simple: npm test stays green, and new behavior comes with a test. Activation hint: Reference this when the user needs to understand the project's structure, install path, or boundaries. Evidence: `CONTRIBUTING.md`
- **Does Grepathy actually work?** (project_doc): We ran a blind, pre-registered evaluation of Grepathy against an honest baseline — and published all of it, including the parts where the tool lost. This is that report, consolidated. If a claim here isn't backed by a number, treat it as opinion. Activation hint: Reference this when the user needs to understand the project's structure, install path, or boundaries. Evidence: `docs/REPORT.md`
- **Configuration** (project_doc): .grepathy.json lives at the repo root and is committed team-shared : Activation hint: Reference this when the user needs to understand the project's structure, install path, or boundaries. Evidence: `docs/config.md`
- **The why-pack format** (project_doc): One rolling file per branch: .ai/why/ .md main sessions → .ai/why/main.md . Plain markdown, boring on purpose — optimized for grep and human skimming. Activation hint: Reference this when the user needs to understand the project's structure, install path, or boundaries. Evidence: `docs/format.md`
- **How it works** (project_doc): Grepathy has no server, no bot, and no accounts. It's a CLI, a few hooks, and a markdown convention. Git is the transport. Activation hint: Reference this when the user needs to understand the project's structure, install path, or boundaries. Evidence: `docs/how-it-works.md`
- **Parallel agents** (project_doc): Run one agent or twenty on the same repo. The rule is everyone reads the same memory, everyone writes in their own space — reading a why-pack never collides, only writing does, and writing is isolated by git worktrees one per agent, the harness's job . Grepathy is built to be a good citizen under that: Activation hint: Reference this when the user needs to understand the project's structure, install path, or boundaries. Evidence: `docs/parallel-agents.md`
- **Privacy** (project_doc): Your session transcript never leaves your machine. Transcripts are intimate — dumb questions, false starts, half-formed thinking, pasted context. You will not share them, and you shouldn't have to. So Grepathy doesn't build a chat channel or a Q&A service; there's nothing to share a conversation in . It distills a digest of decisions locally, and that digest — privacy-filtered markdown — is the only thing that gets… Activation hint: Reference this when the user needs to understand the project's structure, install path, or boundaries. Evidence: `docs/privacy.md`
- **Why: main** (project_doc): Intent Implement Grepathy v1: a CLI and git hooks to distill AI agent session transcripts into privacy-safe, committed why-packs so future agents and humans can find reasoning without asking. Activation hint: Reference this when the user needs to understand the project's structure, install path, or boundaries. Evidence: `.ai/why/main.md`

## Evidence Index

- Indexed 40 evidence entries.

- **Design reasoning lives in .ai/why/** (documentation): This repo records the why behind its code in .ai/why/ .md "why-packs" , distilled from AI coding sessions. The why-pack is the ground truth for why — prefer it over commit messages, which are lossy and can be out of date. Evidence: `CLAUDE.md`
- **Grepathy** (documentation): Make agent-written code reviewable. Evidence: `README.md`
- **Package** (package_manifest): { "name": "grepathy", "version": "1.0.0", "description": "Your agent writes down why, in the repo, so everyone else's agents — and everyone else — can find it without asking you.", "type": "module", "author": "John-Paul Evans", "repository": { "type": "git", "url": "git+https://github.com/evansjp/grepathy.git" }, "homepage": "https://github.com/evansjp/grepathy readme", "bugs": { "url": "https://github.com/evansjp/grepathy/issues" }, "bin": { "grepathy": "./dist/cli.js" }, "files": "dist" , "engines": { "node": " =20" }, "scripts": { "build": "tsc", "prepare": "tsc", "pretest": "tsc -p tsconfig.test.json", "test": "node --test dist-test/test/ .test.js" }, "keywords": "ai", "agent", "claude-… Evidence: `package.json`
- **Contributing** (documentation): Thanks for helping out. The bar for a change is simple: npm test stays green, and new behavior comes with a test. Evidence: `CONTRIBUTING.md`
- **License** (source_file): Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files the "Software" , to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: Evidence: `LICENSE`
- **Does Grepathy actually work?** (documentation): We ran a blind, pre-registered evaluation of Grepathy against an honest baseline — and published all of it, including the parts where the tool lost. This is that report, consolidated. If a claim here isn't backed by a number, treat it as opinion. Evidence: `docs/REPORT.md`
- **Configuration** (documentation): .grepathy.json lives at the repo root and is committed team-shared : Evidence: `docs/config.md`
- **The why-pack format** (documentation): One rolling file per branch: .ai/why/ .md main sessions → .ai/why/main.md . Plain markdown, boring on purpose — optimized for grep and human skimming. Evidence: `docs/format.md`
- **How it works** (documentation): Grepathy has no server, no bot, and no accounts. It's a CLI, a few hooks, and a markdown convention. Git is the transport. Evidence: `docs/how-it-works.md`
- **Parallel agents** (documentation): Run one agent or twenty on the same repo. The rule is everyone reads the same memory, everyone writes in their own space — reading a why-pack never collides, only writing does, and writing is isolated by git worktrees one per agent, the harness's job . Grepathy is built to be a good citizen under that: Evidence: `docs/parallel-agents.md`
- **Privacy** (documentation): Your session transcript never leaves your machine. Transcripts are intimate — dumb questions, false starts, half-formed thinking, pasted context. You will not share them, and you shouldn't have to. So Grepathy doesn't build a chat channel or a Q&A service; there's nothing to share a conversation in . It distills a digest of decisions locally, and that digest — privacy-filtered markdown — is the only thing that gets shared. Evidence: `docs/privacy.md`
- **.Grepathy** (structured_config): { "distiller": { "backend": "claude", "model": "haiku" }, "redaction": , "timeBudgetMs": 60000 } Evidence: `.grepathy.json`
- **Grepathy local state also added by grepathy init** (source_file): node modules/ dist/ dist-test/ .tsbuildinfo Evidence: `.gitignore`
- **Cli** (source_file): import { init } from "./commands/init.js"; import { distill } from "./commands/distill.js"; import { status } from "./commands/status.js"; import { doctor } from "./commands/doctor.js"; import { repair } from "./commands/repair.js"; import { context } from "./commands/context.js"; import { sync } from "./commands/sync.js"; import { off, on } from "./commands/toggle.js"; import { uninstall } from "./commands/uninstall.js"; import { hookStop, hookSessionEnd, hookPrePush, hookPreToolUse } from "./commands/hook.js"; ⋮---- function parseFlags args: string : ⋮---- function usage : void ⋮---- async function main : Promise Evidence: `src/cli.ts`
- **Claude Code** (source_file): import { Adapter, DiscoveredSession, NormalizedEvent, ReadResult, TranscriptMeta, } from "./types.js"; import { claudeProjectDirFor, claudeProjectsDir } from "../util/paths.js"; ⋮---- interface RawLine { type?: string; isMeta?: boolean; isSidechain?: boolean; gitBranch?: string; cwd?: string; timestamp?: string; message?: { role?: string; content?: unknown; }; toolUseResult?: any; } ⋮---- function parseLines raw: string : RawLine ⋮---- function firstLine s: string : string ⋮---- function truncate s: string, n: number : string ⋮---- function isCommandScaffolding text: string : boolean ⋮---- function summarizeToolUse name: string, input: any : ⋮---- function summarizeToolResult toolName: stri… Evidence: `src/adapters/claude-code.ts`
- **Codex** (source_file): import { Adapter, DiscoveredSession, NormalizedEvent, ReadResult, TranscriptMeta, } from "./types.js"; ⋮---- export class CodexAdapter implements Adapter ⋮---- discoverSessions repoPath: string : DiscoveredSession ⋮---- readTranscript transcriptPath: string, fromOffset = 0 : ReadResult ⋮---- normalizeEvents raw: string : NormalizedEvent ⋮---- extractMeta raw: string : TranscriptMeta Evidence: `src/adapters/codex.ts`
- **Index** (source_file): import { Adapter } from "./types.js"; import { ClaudeCodeAdapter } from "./claude-code.js"; import { CodexAdapter } from "./codex.js"; ⋮---- export function adapterFor tool: string : Adapter undefined Evidence: `src/adapters/index.ts`
- **Types** (source_file): export type NormalizedEventKind = "user text" "assistant text" "thinking" "tool call summary"; ⋮---- export interface NormalizedEvent { kind: NormalizedEventKind; text: string; tool?: string; timestamp?: string; } ⋮---- export interface DiscoveredSession { sessionId: string; transcriptPath: string; repo?: string; } ⋮---- export interface TranscriptMeta { branches: string ; files: string ; cwd?: string; firstTs?: string; lastTs?: string; } ⋮---- export interface ReadResult { raw: string; newOffset: number; } ⋮---- export interface Adapter { readonly tool: string; discoverSessions repoPath: string : DiscoveredSession ; readTranscript transcriptPath: string, fromOffset?: number : ReadResult; n… Evidence: `src/adapters/types.ts`
- **Hook** (source_file): import { spawn } from "node:child process"; import { repoRootFrom, currentBranch } from "../util/git.js"; import { grepathyPaths } from "../util/paths.js"; import { GrepathyPaths } from "../util/paths.js"; import { isDisabled, loadConfig } from "../util/config.js"; import { isInitialized } from "../util/runtime.js"; import { selfCliPath } from "../util/self.js"; import { isoNow, warn, say, appendLog } from "../util/log.js"; import { readState, upsertSession, writeSession, readSession } from "../state/state.js"; import { collectContext } from "./context.js"; import { fileSize } from "../util/fsx.js"; import { selectBackend } from "../distiller/backends.js"; import { distillSession } from "..… Evidence: `src/commands/hook.ts`
- **Backends** (source_file): import { spawn } from "node:child process"; ⋮---- import { GrepathyConfig } from "../util/config.js"; ⋮---- export interface LLMBackend { readonly name: string; complete system: string, user: string, timeoutMs: number : Promise ; } ⋮---- complete system: string, user: string, timeoutMs: number : Promise ; ⋮---- export class ClaudePBackend implements LLMBackend ⋮---- constructor private model: string ⋮---- complete system: string, user: string, timeoutMs: number : Promise ⋮---- export class AnthropicApiBackend implements LLMBackend ⋮---- constructor model: string, private apiKey: string ⋮---- async complete system: string, user: string, timeoutMs: number : Promise ⋮---- export function selec… Evidence: `src/distiller/backends.ts`
- **Index** (source_file): import { NormalizedEvent } from "../adapters/types.js"; import { GrepathyConfig } from "../util/config.js"; import { prepareChunks } from "./inputPrep.js"; import { DISTILLER SYSTEM, buildUserPrompt, VALIDATOR RETRY NOTE } from "./prompt.js"; import { LLMBackend, extractJson } from "./backends.js"; import { DistilledPack, DecisionEntry, coercePack, emptyPack, isSubstantiveIntent } from "./model.js"; import { validatePack } from "./validator.js"; import { isSameDecision } from "./similarity.js"; ⋮---- export interface DistillOutcome { ok: boolean; pack: DistilledPack; reason?: string; partialFailures?: number; truncated?: boolean; } ⋮---- function callTimeout deadline: number undefined : num… Evidence: `src/distiller/index.ts`
- **Inputprep** (source_file): import { NormalizedEvent } from "../adapters/types.js"; ⋮---- function renderEvent ev: NormalizedEvent : string ⋮---- export function prepareChunks events: NormalizedEvent , chunkChars: number : string ⋮---- const flush = = Evidence: `src/distiller/inputPrep.ts`
- **Model** (source_file): export type EntryStatus = "directed" "discussed" "agent-initiated"; ⋮---- export interface DecisionEntry { title: string; status: EntryStatus; statusNote?: string; touches: string ; body: string; consideredRejected?: string; risk?: string; reviewerAttention?: string; } ⋮---- export interface DistilledPack { intent: string; decisions: DecisionEntry ; } ⋮---- export function emptyPack : DistilledPack ⋮---- / Whether a chunk produced a usable intent. The distiller prompt is instructed to return an empty string when a chunk establishes no clear intent so this is just "non-empty" , plus one general safety net: an intent that opens with a negation "No … / Nothing … / Not …" is a non-answer, not a… Evidence: `src/distiller/model.ts`
- **Prompt** (source_file): export function buildUserPrompt chunkText: string, chunkIndex: number, chunkCount: number, knownTitles: string = , : string ⋮---- // Title-anchoring dedupe at generation, not by heuristic downstream : the // distiller — the one component that can actually judge "same decision?" — is // shown the titles already on this branch's pack and told to REUSE the exact // wording when it re-encounters one. An exact-title match then dedupes // deterministically in mergePack, so a re-distill updates in place instead of // appending a re-worded near-duplicate. No LLM merge pass, no fuzzy matching. Evidence: `src/distiller/prompt.ts`
- **Validator** (source_file): import { DistilledPack, hasFinanceFigure } from "./model.js"; ⋮---- export interface ValidationResult { ok: boolean; violations: string ; } ⋮---- / Validate the distilled pack's text. Runs over all human-readable fields. extraRedaction are user-supplied source regexes from config; any match is a violation they are custom "never leak this" patterns . / export function validatePack pack: DistilledPack, extraRedaction: string = : ValidationResult ⋮---- function packText pack: DistilledPack : string Evidence: `src/distiller/validator.ts`
- **Why: main** (documentation): Intent Implement Grepathy v1: a CLI and git hooks to distill AI agent session transcripts into privacy-safe, committed why-packs so future agents and humans can find reasoning without asking. Evidence: `.ai/why/main.md`
- **Tsconfig** (structured_config): { "compilerOptions": { "target": "ES2022", "module": "Node16", "moduleResolution": "Node16", "outDir": "./dist", "rootDir": "./src", "strict": true, "esModuleInterop": true, "skipLibCheck": true, "declaration": false, "sourceMap": false }, "include": "src/ / " } Evidence: `tsconfig.json`
- **Matching** (source_file): import { SessionRecord } from "./state/state.js"; import { branchDiffFiles } from "./util/git.js"; ⋮---- export interface BranchMatch { branch: string; reason: "branch-recorded" "file-overlap"; score: number; } ⋮---- export function matchSessionToBranches repoRoot: string, session: SessionRecord, candidateBranches: string , : BranchMatch ⋮---- export function resolveBranchForSession repoRoot: string, session: SessionRecord, targetBranch: string, : Evidence: `src/matching.ts`
- **Adapter.Test** (source_file): import { test } from "node:test"; import assert from "node:assert/strict"; import { ClaudeCodeAdapter } from "../src/adapters/claude-code.js"; import { readFixture, FIXTURES } from "./helpers.js"; ⋮---- const byKind = k: string Evidence: `test/adapter.test.ts`
- **Anywhere.Test** (source_file): import { test } from "node:test"; import assert from "node:assert/strict"; ⋮---- import { parsePushedBranches } from "../src/commands/hook.js"; import { acquireLock } from "../src/util/fsx.js"; import { DEFAULT CONFIG } from "../src/util/config.js"; Evidence: `test/anywhere.test.ts`
- **Autocommit.Test** (source_file): import { test } from "node:test"; import assert from "node:assert/strict"; ⋮---- import { spawnSync } from "node:child process"; import { autoCommitWhyPack, whyPackGitStatus } from "../src/core/autocommit.js"; ⋮---- function git cwd: string, args: string : ⋮---- / Fresh repo with an initial commit, a why-pack, and a config email/name. / function tempRepo : string ⋮---- function writeWhy dir: string, body: string : void Evidence: `test/autocommit.test.ts`
- **Budget.Test** (source_file): import { test } from "node:test"; import assert from "node:assert/strict"; import { distillEvents } from "../src/distiller/index.js"; import { DEFAULT CONFIG } from "../src/util/config.js"; import { DelayMock, chunkyEvents } from "./helpers.js"; ⋮---- const cfg = over: Partial = ⋮---- function packFor i: number : string ⋮---- function parseChunkIndex user: string : number Evidence: `test/budget.test.ts`
- **Distillsession.Test** (source_file): import { test } from "node:test"; import assert from "node:assert/strict"; ⋮---- import { spawnSync } from "node:child process"; import { distillSession } from "../src/core/distillSession.js"; import { StateFile } from "../src/state/state.js"; import { DEFAULT CONFIG } from "../src/util/config.js"; import { grepathyPaths } from "../src/util/paths.js"; import { fixedPackBackend, DelayMock, FIXTURES, CLERK PACK } from "./helpers.js"; ⋮---- function tempRepo : string ⋮---- function stateWith repo: string, sessionId: string : StateFile Evidence: `test/distillSession.test.ts`
- **Distiller.Test** (source_file): import { test } from "node:test"; import assert from "node:assert/strict"; import { distillEvents } from "../src/distiller/index.js"; import { coercePack } from "../src/distiller/model.js"; import { DEFAULT CONFIG } from "../src/util/config.js"; import { ClaudeCodeAdapter } from "../src/adapters/claude-code.js"; import { MockBackend, fixedPackBackend, readFixture, CLERK PACK } from "./helpers.js"; Evidence: `test/distiller.test.ts`
- **Helpers** (source_file): import { LLMBackend } from "../src/distiller/backends.js"; import { DistilledPack } from "../src/distiller/model.js"; ⋮---- export function readFixture name: string : string ⋮---- export class MockBackend implements LLMBackend ⋮---- constructor private responder: user: string, call: number = string async complete system: string, user: string : Promise ⋮---- export function fixedPackBackend pack: DistilledPack : MockBackend ⋮---- export class DelayMock implements LLMBackend ⋮---- constructor private responder: user: string, call: number = async complete system: string, user: string, timeoutMs: number : Promise ⋮---- export function chunkyEvents n: number : Evidence: `test/helpers.ts`
- **Readtrigger.Test** (source_file): import { test } from "node:test"; import assert from "node:assert/strict"; ⋮---- import { ensureClaudeMd } from "../src/commands/init.js"; import { collectContext } from "../src/commands/context.js"; import { grepathyPaths } from "../src/util/paths.js"; ⋮---- function tmp : string Evidence: `test/readtrigger.test.ts`
- **Similarity.Test** (source_file): import { test } from "node:test"; import assert from "node:assert/strict"; import { isSameDecision, titleSimilarity } from "../src/distiller/similarity.js"; import { mergePack, parsePack, renderPack } from "../src/distiller/whypack.js"; import { DistilledPack, DecisionEntry } from "../src/distiller/model.js"; Evidence: `test/similarity.test.ts`
- **State.Test** (source_file): import { test } from "node:test"; import assert from "node:assert/strict"; ⋮---- import { grepathyPaths } from "../src/util/paths.js"; import { readState, writeSession, upsertSession, SessionRecord, StateFile } from "../src/state/state.js"; import { writeFileAtomic } from "../src/util/fsx.js"; ⋮---- function tmpRepo : string ⋮---- function rec id: string : SessionRecord Evidence: `test/state.test.ts`
- **Validator.Test** (source_file): import { test } from "node:test"; import assert from "node:assert/strict"; import { validatePack } from "../src/distiller/validator.js"; import { DistilledPack } from "../src/distiller/model.js"; import { CLERK PACK } from "./helpers.js"; ⋮---- function pack body: string : DistilledPack Evidence: `test/validator.test.ts`
- **Whypack.Test** (source_file): import { test } from "node:test"; import assert from "node:assert/strict"; import { renderPack, parsePack, mergePack, decisionToPackEntry, ParsedPack, } from "../src/distiller/whypack.js"; import { DistilledPack } from "../src/distiller/model.js"; import { CLERK PACK } from "./helpers.js"; ⋮---- function firstMerge fresh: DistilledPack Evidence: `test/whypack.test.ts`

## Rules the Host AI Must Follow

- **Treat this asset as pre-work context, not a runtime environment.**: The AI Context Pack contains only an evidence-backed understanding of the project, not the project's executable state. Evidence: `CLAUDE.md`, `README.md`, `package.json`
- **When answering the user, distinguish what can be previewed from what can only be verified after install.**: The consumer value of the pre-install experience comes from reducing bad installs and misjudgments, not from pretending to be a real run. Evidence: `CLAUDE.md`, `README.md`, `package.json`

## Questions the User Should Answer First

- Which host AI or local environment do you plan to use it in?
- Do you just want to experience the workflow first, or are you ready to actually install?
- What matters most to you: install cost, output quality, or conflicts with your existing rules?

## Acceptance Checks

- Every capability claim can be traced back to a file path in evidence_refs.
- AI_CONTEXT_PACK.md does not package previews as a real run.
- The user can understand who it fits, what it can do, how to start, and the risk boundaries within 3 minutes.

---

## Doramagic Context Augmentation

The following sections strengthen the repository context for a host AI. Human Manual data is a reading route, and pitfall notes become operating constraints.

## Human Manual Outline

Usage rule: this is only a reading route and salience signal, not factual authority. Concrete claims must still return to repo evidence or Claim Graph.

Host AI hard rules:
- Do not treat page titles, section order, summaries, or importance values as factual project evidence.
- When explaining the Human Manual outline, state that it is only a reading route or salience signal.
- Capability, installation, compatibility, runtime state, and risk claims must cite repo evidence, source paths, or Claim Graph.

- **Project Overview & Getting Started**: importance `high`
  - source_paths: README.md, package.json, CLAUDE.md, CONTRIBUTING.md, .gitignore
- **System Architecture & Core Components**: importance `high`
  - source_paths: src/cli.ts, src/commands/hook.ts, src/adapters/index.ts, src/adapters/types.ts, src/adapters/claude-code.ts
- **Distillation Pipeline & AI Integration**: importance `high`
  - source_paths: src/distiller/index.ts, src/distiller/backends.ts, src/distiller/prompt.ts, src/distiller/model.ts, src/distiller/validator.ts
- **Data, Operations, & Extensibility**: importance `high`
  - source_paths: src/distiller/whypack.ts, src/state/entries.ts, src/state/state.ts, src/matching.ts, src/core/autocommit.ts

## Repo Inspection Evidence

- repo_clone_verified: true
- repo_inspection_verified: true
- repo_commit: `f3a21d1a06baa64f98f8adbc2f94d46f2e9b9a5c`
- inspected_files: `README.md`, `package.json`, `docs/REPORT.md`, `docs/config.md`, `docs/format.md`, `docs/how-it-works.md`, `docs/parallel-agents.md`, `docs/privacy.md`, `src/adapters/claude-code.ts`, `src/adapters/codex.ts`, `src/adapters/index.ts`, `src/adapters/types.ts`, `src/cli.ts`, `src/commands/context.ts`, `src/commands/distill.ts`, `src/commands/doctor.ts`, `src/commands/hook.ts`, `src/commands/init.ts`, `src/commands/repair.ts`, `src/commands/status.ts`

Host AI hard rules:
- Without repo_clone_verified=true, do not claim that the source code has been read.
- Without repo_inspection_verified=true, do not write README, docs, or package-file conclusions as facts.
- Without quick_start_verified=true, do not claim that the Quick Start path has run successfully.

## Doramagic Pitfall Constraints

These rules come from Doramagic discovery, validation, or compilation findings. The host AI must treat them as operating constraints, not background notes.

### Constraint 1: Capability evidence risk requires verification

- Trigger: README/documentation is current enough for a first validation pass.
- Host AI rule: Reproduce the official install and quickstart path in an isolated environment.
- Why it matters: May increase setup, validation, or first-run risk for the user.
- Evidence: capability.assumptions | https://news.ycombinator.com/item?id=48920537
- Hard boundary: Do not present this pitfall as solved, verified, or ignorable unless later evidence explicitly closes it.

### Constraint 2: Security or permission risk requires verification

- Trigger: no_demo
- Host AI rule: Reproduce the official install and quickstart path in an isolated environment.
- Why it matters: May increase setup, validation, or first-run risk for the user.
- Evidence: downstream_validation.risk_items | https://news.ycombinator.com/item?id=48920537
- Hard boundary: Do not present this pitfall as solved, verified, or ignorable unless later evidence explicitly closes it.

### Constraint 3: Security or permission risk requires verification

- Trigger: no_demo
- Host AI rule: Reproduce the official install and quickstart path in an isolated environment.
- Why it matters: May increase setup, validation, or first-run risk for the user.
- Evidence: risks.scoring_risks | https://news.ycombinator.com/item?id=48920537
- Hard boundary: Do not present this pitfall as solved, verified, or ignorable unless later evidence explicitly closes it.

### Constraint 4: Maintenance risk requires verification

- Trigger: issue_or_pr_quality=unknown。
- Host AI rule: Reproduce the official install and quickstart path in an isolated environment.
- Why it matters: May increase setup, validation, or first-run risk for the user.
- Evidence: evidence.maintainer_signals | https://news.ycombinator.com/item?id=48920537
- Hard boundary: Do not present this pitfall as solved, verified, or ignorable unless later evidence explicitly closes it.

### Constraint 5: Maintenance risk requires verification

- Trigger: release_recency=unknown。
- Host AI rule: Reproduce the official install and quickstart path in an isolated environment.
- Why it matters: May increase setup, validation, or first-run risk for the user.
- Evidence: evidence.maintainer_signals | https://news.ycombinator.com/item?id=48920537
- Hard boundary: Do not present this pitfall as solved, verified, or ignorable unless later evidence explicitly closes it.
