# willow-mcp - 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 willow-mcp. 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_0003` supported 0.86

## What It Can Do

- **Multi-Host Install and Distribution** (Verify after install): The project contains plugin or marketplace configuration, indicating it targets install and distribution across one or more AI hosts. Evidence: `.claude-plugin/plugin.json` Claim: `clm_0001` supported 0.86
- **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_0002` supported 0.86

## How to Start

- `pip install willow-mcp` Evidence: `README.md` Claim: `clm_0004` 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_0003` supported 0.86
- **Capability exists: Multi-Host Install and Distribution** (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: `.claude-plugin/plugin.json` Claim: `clm_0001` 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_0002` 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_0004` 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-plugin/plugin.json`
- **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. Evidence: `.claude-plugin/plugin.json`
- **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-plugin/plugin.json`
- **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: `.claude-plugin/plugin.json`, `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_0005` inferred 0.45
- **Host AI plugin or Skill rule conflicts**: New rules may change how the user's existing host AI behaves. Mitigation: Inspect the plugin manifest and Skill files before installing, and test in isolation if needed. Evidence: `.claude-plugin/plugin.json` Claim: `clm_0006` supported 0.86
- **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_0007` 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

- **Multi-Host Install and Distribution**: 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: `.claude-plugin/plugin.json` Claim: `clm_0001` supported 0.86
- **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_0002` supported 0.86

### Context Scale

- Total files: 33
- Important-file coverage: 33/33
- Evidence index entries: 32
- Role / Skill entries: 11

### 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 willow-mcp, 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 willow-mcp 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 willow-mcp, 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 11 role / Skill / project-doc entries.

- **willow-mcp** (project_doc): ! PyPI https://img.shields.io/pypi/v/willow-mcp https://pypi.org/project/willow-mcp/ ! License: MIT https://img.shields.io/badge/License-MIT-yellow.svg LICENSE ! MCP https://img.shields.io/badge/MCP-1.0-blue https://modelcontextprotocol.io Activation hint: Reference this when the user needs to understand the project's structure, install path, or boundaries. Evidence: `README.md`
- **Design: Schema Adaptation for External Data — Databases and Identity Claims** (project_doc): Design: Schema Adaptation for External Data — Databases and Identity Claims Activation hint: Reference this when the user needs to understand the project's structure, install path, or boundaries. Evidence: `docs/design/schema-adaptation.md`
- **Contributing** (project_doc): Thanks for your interest in willow-mcp. This is a small, focused MCP server; contributions that keep it agent-neutral and fail-closed are welcome. Activation hint: Reference this when the user needs to understand the project's structure, install path, or boundaries. Evidence: `CONTRIBUTING.md`
- **willow-mcp — Bug Log** (project_doc): A single running log of bugs found in willow-mcp, across all sessions. One row per bug. This is the durable record; FRANK ledger entries, GitHub issues, and SECURITY AUDIT.md are the source material it's backfilled from and links to. Activation hint: Reference this when the user needs to understand the project's structure, install path, or boundaries. Evidence: `docs/BUGS.md`
- **schema-confirm** (project_doc): Guided review and confirmation of a willow-mcp table's schema mapping before unlocking write tools for it Activation hint: Reference this when the user needs to understand the project's structure, install path, or boundaries. Evidence: `skills/schema-confirm.md`
- **Design: Hooks and Skills Ship Alongside Tools, Not After** (project_doc): Design: Hooks and Skills Ship Alongside Tools, Not After Activation hint: Reference this when the user needs to understand the project's structure, install path, or boundaries. Evidence: `docs/design/hooks-and-skills.md`
- **Design: Productionize Kart into willow-mcp** (project_doc): Design: Productionize Kart into willow-mcp Activation hint: Reference this when the user needs to understand the project's structure, install path, or boundaries. Evidence: `docs/design/kart-productionization.md`
- **Changelog** (project_doc): All notable changes to this project are documented here. The format is based on Keep a Changelog https://keepachangelog.com/en/1.1.0/ , and this project adheres to Semantic Versioning https://semver.org/spec/v2.0.0.html . Activation hint: Reference this when the user needs to understand the project's structure, install path, or boundaries. Evidence: `CHANGELOG.md`
- **Security Audit — willow-mcp** (project_doc): Part of Level 2 full-fleet security audit. willow-mcp — MCP server providing Store SQLite , Knowledge Postgres , and Tasks Kart integration to fleet agents via stdio transport. Activation hint: Reference this when the user needs to understand the project's structure, install path, or boundaries. Evidence: `SECURITY_AUDIT.md`
- **kart-tasks** (project_doc): Guided use of willow-mcp's Kart task queue — submit/poll, the task net + allow net network model and its footguns, and the worker-liveness caveat Activation hint: Reference this when the user needs to understand the project's structure, install path, or boundaries. Evidence: `skills/kart-tasks.md`
- **willow-serve** (project_doc): Turn willow-mcp OAuth HTTP serve mode on or off on request, toggling both the systemd --user service and the .mcp.json client entry Activation hint: Reference this when the user needs to understand the project's structure, install path, or boundaries. Evidence: `skills/willow-serve.md`

## Evidence Index

- Indexed 32 evidence entries.

- **willow-mcp** (documentation): ! PyPI https://img.shields.io/pypi/v/willow-mcp https://pypi.org/project/willow-mcp/ ! License: MIT https://img.shields.io/badge/License-MIT-yellow.svg LICENSE ! MCP https://img.shields.io/badge/MCP-1.0-blue https://modelcontextprotocol.io Evidence: `README.md`
- **Design: Schema Adaptation for External Data — Databases and Identity Claims** (documentation): Design: Schema Adaptation for External Data — Databases and Identity Claims Evidence: `docs/design/schema-adaptation.md`
- **Contributing** (documentation): Thanks for your interest in willow-mcp. This is a small, focused MCP server; contributions that keep it agent-neutral and fail-closed are welcome. Evidence: `CONTRIBUTING.md`
- **Plugin** (structured_config): { "name": "willow-mcp", "description": "Willow sovereign agent platform — SQLite store, Postgres knowledge base, Kart task queue, plus the hooks and skills that keep them used correctly.", "version": "2.0.0", "hooks": { "PreToolUse": { "matcher": "Bash", "hooks": { "type": "command", "command": "python3 ${CLAUDE PLUGIN ROOT}/hooks/pre tool use.py" } }, { "matcher": "task submit", "hooks": { "type": "command", "command": "python3 ${CLAUDE PLUGIN ROOT}/hooks/pre tool use.py" } } }, "skills": "skills/schema-confirm.md", "skills/willow-serve.md", "skills/kart-tasks.md" } Evidence: `.claude-plugin/plugin.json`
- **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`
- **willow-mcp — Bug Log** (documentation): A single running log of bugs found in willow-mcp, across all sessions. One row per bug. This is the durable record; FRANK ledger entries, GitHub issues, and SECURITY AUDIT.md are the source material it's backfilled from and links to. Evidence: `docs/BUGS.md`
- **/schema-confirm** (documentation): Walks through reviewing a willow-mcp table's schema mapping and confirming it schema confirm mapping — the write-path gate described in docs/design/schema-adaptation.md §3.4. Use this instead of calling schema confirm mapping directly with hand-written overrides. Evidence: `skills/schema-confirm.md`
- **Design: Hooks and Skills Ship Alongside Tools, Not After** (documentation): Design: Hooks and Skills Ship Alongside Tools, Not After Evidence: `docs/design/hooks-and-skills.md`
- **Design: Productionize Kart into willow-mcp** (documentation): Design: Productionize Kart into willow-mcp Evidence: `docs/design/kart-productionization.md`
- **systemd --user unit template for willow-mcp OAuth HTTP serve mode.** (source_file): systemd --user unit template for willow-mcp OAuth HTTP serve mode. Not used directly — scripts/willow-serve install fills in the @PLACEHOLDERS@ and writes the resolved unit to ~/.config/systemd/user/willow-mcp-serve.service. Unit Description=willow-mcp OAuth HTTP serve mode After=network-online.target Wants=network-online.target Evidence: `deploy/willow-mcp-serve.service.template`
- **Kart network directives the willow-2.0 worker honors — matched exactly as the** (source_file): CLIENT RE = re.compile r"\b psql psycopg2 sqlite3 \b" OWNED MARKER RE = re.compile ⋮---- TOOL REDIRECTS = { ⋮---- def check bash command: str - Optional str ⋮---- client = CLIENT RE.search command .group 1 ⋮---- Kart network directives the willow-2.0 worker honors — matched exactly as the worker does core/kart sandbox.py: line.strip == . task submit strips any caller-supplied occurrence unconditionally B-21 , so embedding one is a no-op; this guard tells the caller that before the call is made. ⋮---- Matches the bare tool name and the MCP-qualified form e.g. mcp willow-mcp task submit / mcp willow-mcp-serve task submit . Evidence: `hooks/pre_tool_use.py`
- **Pyproject** (source_file): build-system requires = "hatchling" build-backend = "hatchling.build" Evidence: `pyproject.toml`
- **Mcp Entry Toggle** (source_file): def toggle path: str, name: str, url: str, action: str - None ⋮---- cfg = json.load f servers = cfg.setdefault "mcpServers", {} ⋮---- def main argv - int Evidence: `scripts/mcp_entry_toggle.py`
- **!/usr/bin/env bash** (source_file): !/usr/bin/env bash willow-serve — turn willow-mcp OAuth serve mode on/off at will. Manages a systemd --user unit for the --serve HTTP process AND toggles the matching http entry in this repo's .mcp.json, so the client connects only when serve is on. No hand-editing of config, no code change per toggle. willow-serve install one-time: write + load the systemd user unit willow-serve on start serve + add the .mcp.json entry then /mcp willow-serve off stop serve + remove the .mcp.json entry then /mcp willow-serve status unit state + whether the entry is present willow-serve logs follow the serve process logs journalctl Port/host come from WILLOW MCP PORT / WILLOW MCP HOST defaults 8766 / 127.0.0… Evidence: `scripts/willow-serve`
- **Init** (source_file): version = "2.0.0" Evidence: `src/willow_mcp/__init__.py`
- **Db** (source_file): pg conn = None pg lock = threading.Lock ⋮---- COLLECTION RE = re.compile r"^ A-Za-z0-9 \- {1,128}$" ⋮---- def validate collection collection: str - str ⋮---- def get pg - Optional psycopg2.extensions.connection ⋮---- """Return a Postgres connection via Unix socket, or None.""" ⋮---- pg conn = psycopg2.connect ⋮---- SCHEMA = """ ⋮---- def action for deviation: float - str ⋮---- class Store ⋮---- def init self, store root: Optional str = None ⋮---- def conn self, collection: str - sqlite3.Connection ⋮---- db path = self.root / collection / "store.db" ⋮---- conn = sqlite3.connect str db path , check same thread=False ⋮---- rid = record id or str uuid.uuid4 :8 .lower action = action for deviati… Evidence: `src/willow_mcp/db.py`
- **Permission groups — named bundles that expand to sets of tool names.** (source_file): logger = logging.getLogger name ⋮---- APP ID RE = re.compile r"^ a-zA-Z0-9 \- {1,64}$" ⋮---- def apps root - Path ⋮---- home = Path os.environ.get "WILLOW HOME", Path.home / ".willow" ⋮---- def validate app id app id: str - str ⋮---- Permission groups — named bundles that expand to sets of tool names. An app manifest lists group names and/or literal tool names in "permissions". PERMISSION GROUPS: dict str, frozenset = { ⋮---- NET PERMISSION = "task net" ⋮---- def load manifest app id: str - Optional dict ⋮---- root = apps root manifest path = root / app id / "manifest.json" ⋮---- def authorized app id: str - bool ⋮---- app id = validate app id app id ⋮---- def permitted app id: str, tool na… Evidence: `src/willow_mcp/gate.py`
- **Subject/issuer values come from a verified IdP Google tokeninfo / Apple JWT ,** (source_file): def write json atomic path: Path, record: dict - None ⋮---- tmp = path.with suffix path.suffix + f".tmp-{os.getpid }" ⋮---- Subject/issuer values come from a verified IdP Google tokeninfo / Apple JWT , not raw user input, but they still become filesystem path components here — refuse anything that isn't a plain token before touching the filesystem. TOKEN RE = re.compile r"^ A-Za-z0-9 .\-: {1,256}$" ⋮---- def bindings root - Path ⋮---- home = Path os.environ.get "WILLOW HOME", Path.home / ".willow" root = Path os.environ.get "WILLOW MCP APPS ROOT", home / "mcp apps" / " identity bindings" ⋮---- def safe token value: str, label: str - str ⋮---- def binding path issuer: str, subject id: str -… Evidence: `src/willow_mcp/identity_binding.py`
- **── Apple ───────────────────────────────────────────────────────────** (source_file): ACCESS TTL = 30 86400 CODE TTL = 300 REFRESH TTL = 30 86400 ⋮---- def tok - str ⋮---- class GroveOAuthProvider ⋮---- def init self, token path: Path, base url: str - None ⋮---- def load state self - dict ⋮---- def save state self - None ⋮---- tmp = self. token path.with suffix self. token path.suffix + f".tmp-{os.getpid }" ⋮---- def prune expired self - None ⋮---- """Drop expired codes/tokens so a long-running serve-mode process doesn't accumulate dead entries forever — previously these were only ever removed lazily, if that exact code/token happened to be looked up again after expiring.""" now = time.time ⋮---- exp = data.get "expires at" ⋮---- def pop pending self, key: str ⋮---- code str… Evidence: `src/willow_mcp/oauth.py`
- **Receipts** (source_file): SCHEMA = """ ⋮---- class ReceiptLog ⋮---- def init self, db path: Optional str = None ⋮---- def record self, app id: str, tool: str, outcome: str, detail: Optional str = None - None ⋮---- ts = datetime.now timezone.utc .isoformat ⋮---- def tail self, app id: str, limit: int = 20 - list dict ⋮---- limit = max 1, min int limit , 200 ⋮---- rows = self. conn.execute Evidence: `src/willow_mcp/receipts.py`
- **Safe Integration** (source_file): def tools registered - int ⋮---- def status - dict ⋮---- pg = get pg Evidence: `src/willow_mcp/safe_integration.py`
- **Schema Profile** (source_file): SCHEMA VERSION = 1 ⋮---- CANONICAL ALIASES: dict str, tuple str, ... = { ⋮---- TEXT CAST TYPES = frozenset {"jsonb", "json"} ⋮---- COLLECTION SAFE RE = re.compile r"^ A-Za-z0-9 \- {1,128}$" ⋮---- @dataclass frozen=True class ColumnInfo ⋮---- name: str data type: str ⋮---- def introspect conn, table: str - list ColumnInfo ⋮---- """Query information schema for a table's real columns. Empty list means the table doesn't exist or is empty of columns, which is equivalent for our purposes — callers must treat that as table not found, not as "every field unmapped.".""" cur = conn.cursor ⋮---- rows = cur.fetchall ⋮---- def propose mapping columns: list ColumnInfo , canonical fields: list str - dict… Evidence: `src/willow_mcp/schema_profile.py`
- **── Schema-adapted knowledge reads docs/design/schema-adaptation.md §9 step 2 ─** (source_file): store = Store receipt log = ReceiptLog ⋮---- def argv opt flag: str - Optional str ⋮---- PORT = int argv opt "--port" or os.getenv "WILLOW MCP PORT", "8765" HOST = argv opt "--host" or os.getenv "WILLOW MCP HOST", "127.0.0.1" DEFAULT APP ID = os.environ.get "WILLOW APP ID", "" ⋮---- SERVE MODE = "--serve" in sys.argv ⋮---- BASE URL ENV = os.getenv "WILLOW MCP URL" or "" .strip .rstrip "/" BASE URL = BASE URL ENV if BASE URL ENV else f"http://{ HOST}:{ PORT}" ⋮---- common kwargs: dict str, Any = dict ⋮---- vault = default vault willow home = pathlib.Path os.environ.get "WILLOW HOME", pathlib.Path.home / ".willow" auth provider = WillowOAuthProvider mcp = FastMCP ⋮---- mcp = FastMCP "willow-m… Evidence: `src/willow_mcp/server.py`
- **Vault** (source_file): def willow home - Path ⋮---- class Vault ⋮---- home = willow home ⋮---- def init self - None ⋮---- fd = os.open str self. key path , os.O WRONLY os.O CREAT os.O TRUNC, 0o600 ⋮---- conn = sqlite3.connect str self. vault ⋮---- def get fernet self - Fernet ⋮---- def write self, name: str, value: str - None ⋮---- encrypted = self. get fernet .encrypt value.encode ⋮---- def read self, name: str - str None ⋮---- row = conn.execute ⋮---- def has self, name: str - bool ⋮---- def list keys self - list str ⋮---- rows = conn.execute "SELECT name FROM secrets ORDER BY name" .fetchall ⋮---- def default vault - "Vault" ⋮---- v = Vault ⋮---- db exists = home / "vault.db" .exists key exists = home / "vault… Evidence: `src/willow_mcp/vault.py`
- **Changelog** (documentation): All notable changes to this project are documented here. The format is based on Keep a Changelog https://keepachangelog.com/en/1.1.0/ , and this project adheres to Semantic Versioning https://semver.org/spec/v2.0.0.html . Evidence: `CHANGELOG.md`
- **Security Audit — willow-mcp** (documentation): Part of Level 2 full-fleet security audit. willow-mcp — MCP server providing Store SQLite , Knowledge Postgres , and Tasks Kart integration to fleet agents via stdio transport. Evidence: `SECURITY_AUDIT.md`
- **/kart-tasks** (documentation): Walks through using willow-mcp's sandboxed task queue task submit , task status , task list , fleet health correctly — including the two things that most easily go wrong: assuming a submitted task will run , and mishandling the network permission . Evidence: `skills/kart-tasks.md`
- **/willow-serve** (documentation): Turns willow-mcp's OAuth serve mode on or off without hand-editing config. Wraps scripts/willow-serve , which manages a systemd --user service for the --serve process and adds/removes the matching http entry in .mcp.json so the MCP client connects only while serve is on. Evidence: `skills/willow-serve.md`
- **Mcp** (structured_config): { "mcpServers": { "willow-mcp": { "type": "stdio", "command": ".venv/bin/python3", "args": "-m", "willow mcp" }, "codebase-memory-mcp": { "type": "stdio", "command": "codebase-memory-mcp", "args": } } } Evidence: `.cursor/mcp.json`
- **.Mcp** (structured_config): { "mcpServers": { "willow-mcp": { "type": "stdio", "command": ".venv/bin/python3", "args": "-m", "willow mcp" }, "codebase-memory-mcp": { "type": "stdio", "command": "codebase-memory-mcp", "args": } } } Evidence: `.mcp.json`
- **.gitignore** (source_file): pycache / .py cod .egg-info/ dist/ build/ logs/ .log .env .venv/ Evidence: `.gitignore`
- **Install build deps for psycopg2-binary** (source_file): Install build deps for psycopg2-binary RUN apt-get update && apt-get install -y --no-install-recommends \ gcc libpq-dev && \ rm -rf /var/lib/apt/lists/ Evidence: `Dockerfile`

## 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: `README.md`, `docs/design/schema-adaptation.md`, `CONTRIBUTING.md`
- **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: `README.md`, `docs/design/schema-adaptation.md`, `CONTRIBUTING.md`

## 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**: importance `high`
  - source_paths: README.md, src/willow_mcp/__init__.py, src/willow_mcp/__main__.py, pyproject.toml
- **System Architecture and Storage Backends**: importance `high`
  - source_paths: src/willow_mcp/server.py, src/willow_mcp/db.py, src/willow_mcp/schema_profile.py, src/willow_mcp/vault.py, src/willow_mcp/receipts.py
- **Authorization, Schema Adaptation, and Identity Binding**: importance `high`
  - source_paths: src/willow_mcp/gate.py, src/willow_mcp/schema_profile.py, src/willow_mcp/oauth.py, src/willow_mcp/identity_binding.py, src/willow_mcp/vault.py
- **Deployment, Operations, and Extensibility**: importance `high`
  - source_paths: README.md, scripts/willow-serve, scripts/mcp_entry_toggle.py, deploy/willow-mcp-serve.service.template, hooks/pre_tool_use.py

## Repo Inspection Evidence

- repo_clone_verified: true
- repo_inspection_verified: true
- repo_commit: `22560fedffb5ab6f565c40f3a80e67dffd622aea`
- inspected_files: `Dockerfile`, `README.md`, `pyproject.toml`, `docs/AGENTS.md`, `docs/BUGS.md`, `docs/ROLES.md`, `docs/SESSION_FLOW.md`, `docs/design/agent-seed-template.json`, `docs/design/agent-seed.md`, `docs/design/complete-system-packet-2026-07-08.md`, `docs/design/gap-backlog.md`, `docs/design/hooks-and-skills.md`, `docs/design/human-orchestrator.md`, `docs/design/integrations.md`, `docs/design/kart-lift-spec.md`, `docs/design/kart-productionization.md`, `docs/design/mcp-review-2026-07-08.md`, `docs/design/packet-boot-design-2026-07-09.md`, `docs/design/permissions-matrix.md`, `docs/design/pgp-and-persona.md`

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://github.com/rudi193-cmd/willow-mcp
- 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://github.com/rudi193-cmd/willow-mcp
- 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://github.com/rudi193-cmd/willow-mcp
- 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://github.com/rudi193-cmd/willow-mcp
- 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://github.com/rudi193-cmd/willow-mcp
- Hard boundary: Do not present this pitfall as solved, verified, or ignorable unless later evidence explicitly closes it.
