Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,7 @@ Architecture rules live in a reviewed `.fixmap/policy.json` file. Every rule has
- Its public API also exposes Explain, Compare, and Verify builders and result types, so another tool can compose the same workflow without shelling out to the CLI.
- `fixmap annotate` writes a versioned `.fixmap/annotations.json` with stable content identities, file/symbol/service/contract scopes, optional owner and expiry, and rename/missing-target checks. Relevant notes retain the store fingerprint in Markdown, JSON, and compact agent reports. See the [candidate annotation guide](docs/annotations.md) for workflows, ownership boundaries, and interrupted-lock recovery.
- The candidate MCP tool `fixmap_annotate` shares that store and its locking/validation. It requires an explicit `action`: `add` accepts `target`/`symbol` or `service`/`contract`, `note`, optional `owner`/`expires`, and local `repo`; `list` accepts `repo` and `format`; `remove` requires the exact annotation `id` and optional `repo`. Only add/remove writes files. The tool advertises mutation/destructive hints; those hints are not authorization, and agents must obtain the user's request before changing notes. Invalid or action-inapplicable fields fail before mutation. This candidate tool is not a claim that the published npm release already supports it.
- Preview: `fixmap outcome record|list|show|remove|calibrate|prune` and `fixmap dossier create|list|show|remove` save predicted-versus-edited outcomes and fingerprinted change dossiers under `.fixmap/outcomes/` and `.fixmap/dossiers/` with atomic writes, link refusal, `--redact` (free text stored as SHA-256), and age-based pruning. Calibration is report-only (`automaticWeightChanges: false`). The read-only MCP tools `fixmap_outcomes` and `fixmap_dossier` list and show them. See [outcomes and change dossiers](docs/outcomes-and-dossiers.md).
- `.fixmap/policy.json` defines bounded, repository-owned dependency boundaries, required test changes, reviewer routing, and breaking-contract rules. Plan and Verify use the same evaluator and retain the exact policy fingerprint; Core can also compare deterministic architecture snapshots for new edges, cyclic components, boundary violations, and coupling growth.
- Historical Core APIs resolve refs to immutable commits and compare exact Git-blob architecture snapshots without checking out a branch, moving `HEAD`, or writing into the worktree.
- The opt-in local sensitive-data evidence provider emits provenance-marked credential/token/PII/payment indicators and structural proximity to logging/network/storage/analytics sinks. It never copies detected values or snippets and explicitly labels every result as low-confidence, incomplete evidence rather than a taint or security proof.
Expand Down
81 changes: 81 additions & 0 deletions docs/outcomes-and-dossiers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# Outcomes and change dossiers (preview)

Preview: these commands may change before v0.10.0.

FixMap can save two kinds of local record after a change is done. Both live inside the
repository, one JSON file per record, and nothing leaves the machine.

| Record | Directory | Command | MCP (read-only) |
| --- | --- | --- | --- |
| Outcome | `.fixmap/outcomes/` | `fixmap outcome record\|list\|show\|remove\|calibrate\|prune` | `fixmap_outcomes` (list, show, calibrate) |
| Change dossier | `.fixmap/dossiers/` | `fixmap dossier create\|list\|show\|remove` | `fixmap_dossier` (list, show) |

## Outcomes

An outcome record keeps what a saved plan predicted (`contextFiles`) next to the paths that were
actually edited, the commands that ran, and who judged the task.

```sh
fixmap plan --issue "Fix login redirect" --format json --output plan.json
# ... make the change ...
fixmap outcome record --report plan.json --working-tree \
--command-result test-result.json --assessment agent --status succeeded
fixmap outcome calibrate
```

- `--diff <spec>` or `--working-tree [--include-untracked]` is required: it is where the edited paths come from.
- `--command-result <file>` (repeatable) takes one object or an array. Each entry is either a
`fixmap sandbox` result or `{ "command", "status", "evidence"?, "relatedPaths"? }` with status
`passed`, `failed`, `timeout`, `crashed`, or `unavailable`.
- `--assessment human|agent|external|unassessed` and `--status succeeded|failed|partial|unknown`
record who judged the task. A passing command is never treated as task success.

`fixmap outcome calibrate` reports precision (predicted paths that were edited), recall (edited
paths that were predicted), misses, false positives, and command and assessment counts across every
stored record. It is a report. Ranking weights never change automatically, and the output always
says `automaticWeightChanges: false`.

## Change dossiers

```sh
fixmap dossier create --report plan.json --task "Fix login redirect" \
--diff main...HEAD --pr https://github.com/owner/repo/pull/12 --commit <sha>
```

A dossier links the request text and its SHA-256, the report and Impact Graph fingerprints, the
report's ADR references, the diff's changed paths, command results, and commit/PR identifiers.
The record carries a content fingerprint; a hand-edited file fails validation and is reported.

## Privacy: `--redact`

`--redact` stores `sha256:<hex>` in place of free text:

- `outcome record`: the assessment reason and each command's evidence.
- `dossier create`: the task text (`request.summary`).

Paths, commands, and fingerprints are kept, since calibration needs them. Outcome records never
store task text; the task id defaults to `plan-<first 16 hex of the report's SHA-256>` unless you
pass `--task-id`.

## Retention: `prune`

```sh
fixmap outcome prune --older-than 90
```

deletes outcome records recorded more than 90 days ago. Malformed files are listed, never deleted.
`fixmap outcome remove <id>` and `fixmap dossier remove <id>` delete a single record.

## Safety and recovery

- Writes go to a temp file and are renamed into place, so a reader never sees half a record.
- `.fixmap`, `.fixmap/outcomes`, and `.fixmap/dossiers` must be real directories: links and
junctions are refused. Record files and locks must be regular files with one link.
- Record ids are letters, digits, `.`, `_`, and `-` only, so an id cannot name a path outside the store.
- Writers take `.fixmap/outcomes.lock` or `.fixmap/dossiers.lock`. A second writer waits about a
second, then stops. FixMap never takes over a lock, however old: if a writer was interrupted,
confirm no FixMap process is running, then delete the lock file by hand.
- `list` and `calibrate` report unreadable or invalid files under "Unreadable stored files" (or
`problems` in JSON) and keep going.
- Decide whether to commit these directories. They are plain JSON and reviewable; add them to
`.gitignore` if they should stay on one machine.
9 changes: 9 additions & 0 deletions packages/cli/src/cli-runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ Usage:
fixmap sandbox --request sandbox.json --execute-declared-command
fixmap watch --report plan.json --repo .
fixmap annotate src/auth/token.ts --note "Do not refactor; external contract"
fixmap outcome record --report plan.json --working-tree --assessment agent --status succeeded
fixmap dossier create --report plan.json --task "Fix login" --diff main...HEAD --pr <url>
fixmap features
fixmap setup [--agent claude|cursor|copilot|agents|all] [--repo <path>]
fixmap mcp [--repo <path>]
Expand All @@ -143,6 +145,8 @@ Commands:
runtime Preview: Map redaction-reviewed runtime evidence to exact files
sandbox Preview: Run one explicitly consented command in an isolated container
watch Recheck working-tree drift and impact whenever edits change
outcome Preview: Save predicted-versus-edited outcomes locally and calibrate them
dossier Preview: Save a fingerprinted change dossier for a finished change
annotate Attach reviewable tribal knowledge to files, symbols, services, or contracts
features List every FixMap capability and its command
setup Preview workflows, or explicitly install /fixmap for coding agents
Expand Down Expand Up @@ -238,6 +242,11 @@ export async function runCli(args: string[], dependencies: CliDependencies = {})
return 0;
}

if (args[0] === "outcome" || args[0] === "dossier") {
const module = await import("./outcome-command.js");
return (args[0] === "outcome" ? module.runOutcomeCommand : module.runDossierCommand)(args.slice(1), { stdout, stderr });
}

if (args[0] === "annotate") {
const module = await import("./annotation-command.js");
return module.runAnnotateCommand(args.slice(1), { stdout, stderr });
Expand Down
5 changes: 4 additions & 1 deletion packages/cli/src/mcp.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { readFileSync } from "node:fs";
import { ANNOTATION_TOOL, runAnnotationTool } from "./annotation-tool.js";
import { DOSSIER_TOOL, OUTCOMES_TOOL, runDossierTool, runOutcomesTool } from "./record-tools.js";
import { dirname, join, resolve } from "node:path";
import { fileURLToPath } from "node:url";
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
Expand Down Expand Up @@ -516,11 +517,13 @@ export function createFixMapMcpServer(
const server = new Server({ name: "fixmap", version: readVersion() }, { capabilities: { tools: {} } });

server.setRequestHandler(ListToolsRequestSchema, async () => ({
tools: [PLAN_TOOL, CONTEXT_TOOL, GRAPH_TOOL, CHANGE_SCOPE_TOOL, CAPABILITY_TOOL, WORKSPACE_TOOL, ASK_TOOL, MIGRATION_TOOL, REVERSE_DOCS_TOOL, HISTORY_TOOL, SUPPLY_CHAIN_TOOL, RUNTIME_TOOL, VERIFY_TOOL, EXPLAIN_TOOL, COMPARE_TOOL, DOCTOR_TOOL, ANNOTATION_TOOL]
tools: [PLAN_TOOL, CONTEXT_TOOL, GRAPH_TOOL, CHANGE_SCOPE_TOOL, CAPABILITY_TOOL, WORKSPACE_TOOL, ASK_TOOL, MIGRATION_TOOL, REVERSE_DOCS_TOOL, HISTORY_TOOL, SUPPLY_CHAIN_TOOL, RUNTIME_TOOL, VERIFY_TOOL, EXPLAIN_TOOL, COMPARE_TOOL, DOCTOR_TOOL, ANNOTATION_TOOL, OUTCOMES_TOOL, DOSSIER_TOOL]
}));

server.setRequestHandler(CallToolRequestSchema, async (request) => {
if (request.params.name === ANNOTATION_TOOL.name) return runAnnotationTool(request.params.arguments, defaultRepo);
if (request.params.name === OUTCOMES_TOOL.name) return runOutcomesTool(request.params.arguments, defaultRepo);
if (request.params.name === DOSSIER_TOOL.name) return runDossierTool(request.params.arguments, defaultRepo);
if (request.params.name === CONTEXT_TOOL.name || request.params.name === GRAPH_TOOL.name) {
const kind = request.params.name === CONTEXT_TOOL.name ? "context" : "graph";
const parsed = parseAnalysisToolArguments(request.params.arguments ?? {}, kind);
Expand Down
Loading
Loading