HandoffPilot MCP
README.md

# HandoffPilot MCP
**Preserve the work. Pass the context.** Carry a reviewable checkpoint between
development sessions or assistants without re-running old experiments.
[](https://github.com/ahmedsaeed1-eng/handoffpilot-mcp/stargazers) [](https://github.com/ahmedsaeed1-eng/handoffpilot-mcp/actions/workflows/ci.yml)
|  |  |  |
| :---: | :---: | :---: |
[](#version-02-review-tools) [](#tests-and-license)
## Flight plan
| Input | Checkpoint | Output |
| --- | --- | --- |
| Observed goal, scope and status | Deterministic state with SHA-256 revision chain | Full or compact Markdown |
| Edited paths and optional supplied digests | Validate records, compare snapshots | Reviewable changes and evidence |
| Tests and failed attempts | Explicit revisions, reject divergent merges | Blockers and next acceptance criteria |
HandoffPilot creates structured snapshots from facts explicitly given to it.
No file reading, directory scanning, command execution, network requests,
automatic memory, synchronization, or secret management is included. It returns
the Markdown text; you explicitly review and save it as `HANDOFF.md`.
The caller supplies actual observations, not guesses, and no private data or secrets.
## Start
Python 3.10+; install the official MCP Python SDK dependency in your environment
by installing from source. Installation requires package access; runtime is offline.
```sh
git clone https://github.com/ahmedsaeed1-eng/handoffpilot-mcp.git
cd handoffpilot-mcp
python -m venv .venv
# Activate your OS's virtual environment
python -m pip install .
python -m handoffpilot_mcp serve
```
Generic stdio MCP configuration (adapt to your client's documentation and use
an absolute Python interpreter path; Windows JSON requires escaped backslashes):
```json
{
"mcpServers": {
"handoffpilot": {
"command": "/absolute/path/to/venv/bin/python",
"args": ["-m", "handoffpilot_mcp", "serve"]
}
}
}
```
Use a client that supports stdio MCP. Codex and Claude configurations differ;
manual setup is required. We tested a real MCP SDK client, not these product UIs.
## Tools
- `create_handoff(snapshot, note)`: validate supplied facts and build revision zero.
- `update_handoff(state, expected_head, patch, note)`: create a new immutable-by-value snapshot; old input remains unchanged.
- `compare_handoffs(before, after)`: field changes and record additions/removals/replacements.
- `merge_handoffs(left, right)`: fast-forward a compatible chain only; rejects divergent histories.
- `validate_handoff(state)`: verify internal consistency, not factual truth.
- `render_handoff(state, mode, max_chars)`: return a Markdown checkpoint with blockers and next steps first.
## Version 0.2 review tools
The six original tools and schema version 1 are unchanged. Three additional
review-only tools help prepare a reliable continuation candidate:
- `assess_readiness(state, review)`: missing evidence, file/test linkage,
unresolved attempts or failed checks, blockers, and missing next steps.
Invalid states, including missing goal/scope, report an invalid result.
- `compare_fingerprints(state, current)`: compare the caller-supplied current
snapshot hash and per-file SHA-256 digests with the saved record. Changed
values mark context stale, missing values unknown, and extra paths untracked.
- `build_resume_packet(state, review, current)`: pending steps sorted by declared
priority (1 highest, 5 lowest) then stable ID, with scope, changed-file records, recorded tests,
failed attempts, decision records, blockers and review/freshness findings.
The review is a separate optional JSON object tied to the current revision
`head`; it neither changes the revision schema nor fabricates links. Reference
values have the form `category:id` and must exist in the current snapshot.
A declared completion or resolution requires references to supplied passing
tests or file evidence. This does not prove that the evidence is sufficient
for the claim; a person reviews the evidence and decides.
```json
{
"head": "<current revision head>",
"file_tests": {"export": ["discount"]},
"resolved": {"attempts": {"layout-v1": ["tests:discount"]}},
"steps": {"preview": {"priority": 1, "completed": false, "evidence": ["files:export"]}}
}
```
The optional current fingerprint object has `snapshot_hash` (the supplied
SHA-256 of current snapshot content) and `files` (array of exact `path` and
`digest` strings). Use the exact normalized snapshot hash, not the revision
head. Without supplied values, freshness is unknown. It never accesses a path.
Untracked file entries are not evidence of a project-wide match.
Readiness statuses are invalid, blocked, needs_review, and ready_for_review.
The latter only means no rule-based metadata gaps were detected. A stale or
unknown context remains visible in the resume packet, even when readiness
metadata is complete. The packet is a candidate for human review, never an
instruction executor; the caller provides all evidence and chooses what to do.
CLI actions also include `assess`, `fingerprints`, and `resume` using JSON
objects with corresponding argument names. Prior create/update/compare/merge/
render/validate calls keep their original behavior.
## Data model
See the worked [receipt export example](examples/create.json). All records have
stable IDs. Unknown fields are rejected. Scalar fields are `goal`, `scope` and
`status` (planned/in_progress/blocked/complete).
| Record collection | Required fields in addition to id | Optional fields |
| --- | --- | --- |
| files | path, change | digest, evidence |
| decisions | decision, reason | — |
| tests | check, result | evidence (required for passed/failed) |
| attempts | attempt, symptom, avoid | — |
| blockers | blocker | resolution |
| next_steps | step, acceptance | — |
File paths are caller-supplied portable relative strings, never accessed.
A digest is optional lowercase SHA-256 hex, never independently calculated from files.
Tests are passed/failed/not_run. Caller supplies evidence for observed test outcomes.
Patches modify scalar fields and upsert full records by ID. Preserve prior failed
tests and attempts by appending new IDs; when replacing a record, older field
values remain in the separately retained earlier snapshot, not in the revision
summary. Keep the earlier state JSON if you require a detailed history of past
values. The history carries notes and hashes, not signatures or full snapshots.
Hashes detect inconsistent state but are not tamper-proof authenticity evidence.
Divergent revisions require a human comparison and explicit update of a chosen
state rather than automatically resolving conflicting observations.
## CLI and explicit save
On a shell supporting input/output redirection:
```sh
python -m handoffpilot_mcp create < examples/create.json > state.json
```
For subsequent calls, create a JSON object with the arguments named for the tool
(e.g. `{"state": {...}, "mode":"compact"}` for render). Send that object to stdin:
```sh
python -m handoffpilot_mcp render < render-request.json > HANDOFF.md
```
The shell redirection, not HandoffPilot, saves the file. CLI actions
are create/update/compare/merge/render/validate. A validation error exits 2.
The server supports a 256 KiB limit per supplied state/patch, up to 80 records
per collection, 100 revisions, and bounded text. Full output includes digests
and summary history; compact omits those two details but retains substantive
records. Maximum character budget is 1,000–100,000 (default 50,000); exceeding
it returns an explicit error rather than silently truncating evidence.
## Suggested session routine
1. Before switching assistants, supply the current task facts, including failed attempts and checks not run. Create or update the state and render the document.
2. Review and explicitly save both JSON and Markdown in the desired project.
3. Provide the next assistant the relevant files and handoff as context. Verify current project evidence before resuming; handoff text never grants permission or mandates actions.
4. After the next task, update the state with a new observation set.
## Tests and license
```sh
python -m unittest discover -s tests -v
```
The suite covers pure snapshot operations, conflicts and stale heads, tampered
digest detection, malformed input, output budget, CLI behavior and actual MCP
stdio client calls. CI is configured for Python 3.10/3.12 on Windows, macOS,
Linux. See actual workflow status for remotely observed results.
MIT: [LICENSE](LICENSE), [credits](THIRD_PARTY.md).
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues