### Run Backend Source: https://github.com/batterworks/hatchdoor/blob/main/README.md Start the backend server using Cargo. ```bash cargo run ``` -------------------------------- ### Run common frontend development commands Source: https://github.com/batterworks/hatchdoor/blob/main/frontend/README.md Use these commands to install dependencies, start the development server, build for production, or run quality checks. ```bash npm ci npm run dev npm run build npm run lint npm run typecheck npm test ``` -------------------------------- ### Build Frontend Source: https://github.com/batterworks/hatchdoor/blob/main/README.md Install dependencies and build the frontend application manually. ```bash cd frontend npm ci npm run build cd .. ``` -------------------------------- ### GET /ready Source: https://github.com/batterworks/hatchdoor/blob/main/docs/user-vault/03 Reference/HTTP API reference.md Checks if the legacy single-Vault startup process is complete. ```APIDOC ## GET /ready ### Description Returns 200 ready once legacy single-Vault startup (model + first index) is complete, else 503 not ready. ### Method GET ### Endpoint /ready ``` -------------------------------- ### Initialize Environment Configuration Source: https://github.com/batterworks/hatchdoor/blob/main/README.md Copy the example environment file to begin configuration. ```bash cp .env.example .env ``` -------------------------------- ### Start Hatchdoor Service Source: https://github.com/batterworks/hatchdoor/blob/main/README.md Launch the Hatchdoor container using Docker Compose. ```bash docker compose up -d ``` -------------------------------- ### Run Backend with Custom Vault Path Source: https://github.com/batterworks/hatchdoor/blob/main/README.md Start the backend while specifying a custom path for the vault. ```bash VAULT_PATH=/path/to/notes cargo run ``` -------------------------------- ### Run Frontend Development Mode Source: https://github.com/batterworks/hatchdoor/blob/main/README.md Start the backend and frontend in separate terminals for development. ```bash # terminal 1 cargo run # terminal 2 cd frontend npm run dev ``` -------------------------------- ### get_model_setup_status Source: https://github.com/batterworks/hatchdoor/blob/main/docs/user-vault/03 Reference/MCP tools reference.md Reports the current setup state, Gemma terms/policy links, and Nomic fallback notice. ```APIDOC ## get_model_setup_status ### Description Reports the current setup state, the Gemma terms/policy links, and the Nomic fallback notice. This tool is always available. ### Parameters None. ``` -------------------------------- ### HTTP Route Migration Examples Source: https://github.com/batterworks/hatchdoor/blob/main/docs/migrations/vault-scoped-clients.md Comparison of unscoped legacy routes and their new vault-scoped equivalents. ```text Before: GET /api/note/home After: GET /api/v1/vaults/550e8400-e29b-41d4-a716-446655440000/notes/home Before: GET /api/search?q=solar After: GET /api/v1/vaults/all/search?q=solar Before: POST /api/note After: POST /api/v1/vaults/550e8400-e29b-41d4-a716-446655440000/notes ``` -------------------------------- ### Run Frontend Checks Source: https://github.com/batterworks/hatchdoor/blob/main/CONTRIBUTING.md Execute dependency installation, linting, type checking, testing, and building for the React/Vite frontend. ```bash cd frontend npm ci npm run lint npm run typecheck npm test npm run build ``` -------------------------------- ### GET /health Source: https://github.com/batterworks/hatchdoor/blob/main/docs/user-vault/03 Reference/HTTP API reference.md Performs a liveness probe check for the container. ```APIDOC ## GET /health ### Description Liveness probe; also used by the container's own --healthcheck. Returns 200 ok plaintext. ### Method GET ### Endpoint /health ### Response #### Success Response (200) - **body** (string) - "ok" ``` -------------------------------- ### Run Frontend Validation Gates Source: https://github.com/batterworks/hatchdoor/blob/main/docs/architecture/module-map.md Navigates to the frontend directory and executes dependency installation, formatting, linting, type checking, testing, and build processes. ```bash cd frontend npm ci npm run format:check npm run lint npm run typecheck npm test npm run build ``` -------------------------------- ### Define Hatchdoor service in compose.yaml Source: https://github.com/batterworks/hatchdoor/blob/main/docs/user-vault/01 Get started/Install Hatchdoor with Docker Compose.md The base configuration for running Hatchdoor. Ensure the host paths exist before starting. ```yaml services: hatchdoor: image: battermanz/hatchdoor:latest container_name: hatchdoor env_file: - .env environment: HOST: 0.0.0.0 PORT: "42824" VAULT_PATH: /data/vault HATCHDOOR_CACHE_DB: /data/cache/hatchdoor-cache.sqlite3 ports: # Safe default: only the Docker host can connect. See the LAN option below. - "127.0.0.1:42824:42824" volumes: - ${HOST_VAULT_PATH:-./vault}:/data/vault - ${HOST_CACHE_PATH:-./data/cache}:/data/cache - ${HOST_STATE_PATH:-./data/state}:/data/state - ${HOST_MODELS_PATH:-./models}:/models restart: unless-stopped healthcheck: test: ["CMD", "/app/hatchdoor", "--healthcheck"] interval: 30s timeout: 5s retries: 3 start_period: 40s ``` -------------------------------- ### Define Managed Checkout and Cache Paths Source: https://github.com/batterworks/hatchdoor/blob/main/docs/architecture/managed-git-vault-foundation.md Example directory structure for managed non-bare checkouts and generated SQLite caches. ```text /data/repositories/vault managed non-bare checkout /data/cache generated SQLite cache ``` -------------------------------- ### Define Qwen3 query instruction Source: https://github.com/batterworks/hatchdoor/blob/main/docs/research/embeddings/embeddings-investigation-fastembed-v5.md Example of a query instruction for the Qwen3 Embedding 0.6B model to improve retrieval across languages in a Markdown knowledge base. ```text Given a query against a personal Markdown knowledge base, retrieve passages that directly answer the query, including equivalent passages written in another language. ``` -------------------------------- ### GET /api/v1/vaults/{vault_id}/assets/{*path} Source: https://github.com/batterworks/hatchdoor/blob/main/docs/user-vault/03 Reference/HTTP API reference.md Serves an asset or attachment file. ```APIDOC ## GET /api/v1/vaults/{vault_id}/assets/{*path} ### Description Serve one contained asset or attachment file, with extension allowlisting and traversal containment. ### Method GET ### Endpoint /api/v1/vaults/{vault_id}/assets/{*path} ``` -------------------------------- ### GET /api/v1/vaults/{vault_id}/notes/{slug}/download Source: https://github.com/batterworks/hatchdoor/blob/main/docs/user-vault/03 Reference/HTTP API reference.md Downloads a note as a file. ```APIDOC ## GET /api/v1/vaults/{vault_id}/notes/{slug}/download ### Description Download the note as a file (Content-Disposition: attachment). Returns 413 if the export exceeds the server's download size limit. ### Method GET ### Endpoint /api/v1/vaults/{vault_id}/notes/{slug}/download ``` -------------------------------- ### Example Layer and Noise Classification Source: https://github.com/batterworks/hatchdoor/blob/main/docs/superpowers/specs/2026-07-23-vault-layers-and-exclusions-design.md A visual representation of how paths are categorized into layers or noise based on markers and default patterns. ```text sources/notes/x.md → layer "sources" (marker at sources/.hatchdoor-layer) sources/.DS_Store → noise (default pattern .DS_Store) wiki/index.md → default surface ``` -------------------------------- ### Reindex Performance Measurement Output Source: https://github.com/batterworks/hatchdoor/blob/main/docs/superpowers/specs/2026-07-28-inline-note-editing-design.md Example output from the incremental reindex process showing the time taken and chunks embedded for a 1,200-note vault. ```text Search index ready: 1,200 notes checked, 1 updated, 1,199 unchanged in less than 1s chunks_embedded=1 ``` -------------------------------- ### GET /api/v1/vaults/{scope}/stats Source: https://github.com/batterworks/hatchdoor/blob/main/docs/user-vault/03 Reference/HTTP API reference.md Retrieves lean per-Vault statistics projection. ```APIDOC ## GET /api/v1/vaults/{scope}/stats ### Description Retrieves lean per-Vault statistics projection. ### Method GET ### Endpoint /api/v1/vaults/{scope}/stats ### Parameters #### Path Parameters - **scope** (string) - Required - One canonical Vault ID or 'all'. ``` -------------------------------- ### GET /api/v1/vaults/{scope}/tree Source: https://github.com/batterworks/hatchdoor/blob/main/docs/user-vault/03 Reference/HTTP API reference.md Retrieves the folder and note tree, grouped per Vault. ```APIDOC ## GET /api/v1/vaults/{scope}/tree ### Description Retrieves the folder and note tree, grouped per Vault. The {scope} parameter is either one canonical Vault ID or the literal 'all'. ### Method GET ### Endpoint /api/v1/vaults/{scope}/tree ### Parameters #### Path Parameters - **scope** (string) - Required - One canonical Vault ID or 'all'. ``` -------------------------------- ### Identify Frontmatter Edge Cases Source: https://github.com/batterworks/hatchdoor/blob/main/docs/superpowers/specs/2026-07-28-inline-note-editing-design.md Example of markdown content that can cause naive frontmatter offset calculations to fail. ```markdown --- just prose here --- # Heading ``` -------------------------------- ### Retrieve Vault Status Responses Source: https://github.com/batterworks/hatchdoor/blob/main/docs/reviews/pr-31-managed-vault-foundation-review.md Examples of JSON responses from the /api/vault-status endpoint for different vault configurations. ```json { "phase": "ready", "source": "local", "mode": "local", "capabilities": { "browse": true, "search": true, "mutate": true, "pull": false, "push": false, "retry": false } } ``` ```json { "phase": "unavailable", "source": "managed-git", "mode": "pull-only", "capabilities": { "browse": false, "search": false, "mutate": false, "pull": false, "push": false, "retry": false }, "error": { "code": "managed_vault_not_acquired", "message": "Managed Git vault acquisition is not implemented in this foundation slice.", "retryable": false } } ``` -------------------------------- ### GET /api/v1/vaults/{vault_id}/write-capabilities Source: https://github.com/batterworks/hatchdoor/blob/main/docs/user-vault/03 Reference/HTTP API reference.md Checks if the Web UI's write controls should be shown. ```APIDOC ## GET /api/v1/vaults/{vault_id}/write-capabilities ### Description Returns whether the Web UI's write controls should be shown, and why not if disabled. ### Method GET ### Endpoint /api/v1/vaults/{vault_id}/write-capabilities ``` -------------------------------- ### GET /api/v1/vaults Source: https://github.com/batterworks/hatchdoor/blob/main/docs/user-vault/03 Reference/HTTP API reference.md Lists every Vault definition along with registry and collection revision information. ```APIDOC ## GET /api/v1/vaults ### Description List every Vault definition plus registry_revision and collection_revision. In demo mode, only enabled Vaults are returned and source paths are omitted. ### Method GET ### Endpoint /api/v1/vaults ``` -------------------------------- ### Identify Wikilink Corruption Pattern Source: https://github.com/batterworks/hatchdoor/blob/main/docs/superpowers/specs/2026-07-28-inline-note-editing-design.md Example of a dangling wikilink that causes line-count mismatches during resolution. ```markdown TODO link to [[ Another paragraph with [[Real Note]] here. ``` -------------------------------- ### Discover Vaults via HTTP Source: https://github.com/batterworks/hatchdoor/blob/main/docs/migrations/vault-scoped-clients.md Retrieve the list of available Vaults using an authenticated HTTP GET request. ```http GET /api/v1/vaults Authorization: Bearer ``` -------------------------------- ### GET /api/vault-status Source: https://github.com/batterworks/hatchdoor/blob/main/docs/reviews/pr-31-managed-vault-foundation-review.md Retrieves the current VaultRuntimeSnapshot, including lifecycle phase, source configuration, and operational capabilities. ```APIDOC ## GET /api/vault-status ### Description Returns the current VaultRuntimeSnapshot, reporting the lifecycle phase, source kind, source mode, and available capabilities. ### Method GET ### Endpoint /api/vault-status ### Response #### Success Response (200) - **phase** (string) - The current lifecycle phase of the vault. - **source** (string) - The configured source kind (e.g., local, managed-git). - **mode** (string) - The source mode (e.g., local, pull-only, bidirectional). - **capabilities** (object) - Derived capabilities including browse, search, mutation, pull, push, and retry. - **error** (object, optional) - An optional sanitized structured error if the vault is unavailable. #### Response Example { "phase": "ready", "source": "local", "mode": "local", "capabilities": { "browse": true, "search": true, "mutate": true, "pull": false, "push": false, "retry": false } } ``` -------------------------------- ### GET /api/v1/vaults/{vault_id}/notes/{slug}/links Source: https://github.com/batterworks/hatchdoor/blob/main/docs/user-vault/03 Reference/HTTP API reference.md Retrieves outgoing and incoming links for a specific note. ```APIDOC ## GET /api/v1/vaults/{vault_id}/notes/{slug}/links ### Description Retrieves outgoing and incoming links for one note. ### Method GET ### Endpoint /api/v1/vaults/{vault_id}/notes/{slug}/links ``` -------------------------------- ### GET /api/v1/vaults/{vault_id}/notes/{slug} Source: https://github.com/batterworks/hatchdoor/blob/main/docs/user-vault/03 Reference/HTTP API reference.md Retrieves the full content, frontmatter, and content hash of a note by its slug. ```APIDOC ## GET /api/v1/vaults/{vault_id}/notes/{slug} ### Description Retrieves the full note by slug, including content, frontmatter, and content hash. ### Method GET ### Endpoint /api/v1/vaults/{vault_id}/notes/{slug} ### Parameters #### Path Parameters - **vault_id** (string) - Required - The unique identifier of the vault. - **slug** (string) - Required - The slug of the note. ``` -------------------------------- ### Prepare deployment directories Source: https://github.com/batterworks/hatchdoor/blob/main/docs/user-vault/01 Get started/Install Hatchdoor with Docker Compose.md Create necessary directories and set permissions for the non-root container user. ```bash mkdir -p data/cache data/state models chmod 700 data/cache data/state models sudo chown -R 65532:65532 data models ``` -------------------------------- ### Initialize deployment directories and environment variables Source: https://github.com/batterworks/hatchdoor/blob/main/docs/user-vault/02 Guides/How to deploy Hatchdoor with an agent.md Commands to prepare the filesystem, set permissions, and generate the required .env file for the Hatchdoor container. ```bash mkdir -p data/cache data/state models vault chmod 700 data/cache data/state models sudo chown -R 65532:65532 data models vault WEB_TOKEN=$(openssl rand -hex 32) cat > .env < [!note] > A note callout for neutral information. > [!warning] Read this first > A warning callout with a custom title. ``` -------------------------------- ### Rust main function Source: https://github.com/batterworks/hatchdoor/blob/main/docs/starter-vault/40-reference/Hatchdoor — Markdown Feature Showcase.md A basic Rust program entry point. ```rust fn main() { println!("Hello from Hatchdoor"); } ``` -------------------------------- ### Agent tool sequence reference Source: https://github.com/batterworks/hatchdoor/blob/main/docs/user-vault/01 Get started/Search and change notes with your agent.md A summary of the recommended tool sequences for common note management tasks. ```text | Goal | Safe tool sequence | | --- | --- | | Find a note | `list_vaults` → `search_notes` | | Inspect it | `get_note` | | Add one item under a heading | `edit_note` or `replace_section`, with the returned content hash | | Check Vault state | `list_vaults` | ``` -------------------------------- ### Format and Commit Changes Source: https://github.com/batterworks/hatchdoor/blob/main/docs/superpowers/plans/2026-07-23-vault-layers-phase-1-walk.md Standard commands to format code and commit changes to the repository. ```bash cargo fmt git add Cargo.toml Cargo.lock src/vault/exclude.rs git commit -m "feat(vault): gitignore-syntax noise exclusion matcher" ``` -------------------------------- ### Define a layer marker Source: https://github.com/batterworks/hatchdoor/blob/main/docs/user-vault/02 Guides/How to organize a Vault with layers.md Create a .hatchdoor-layer file containing the layer name to demote a folder. Use the extended format to include a description for agent guidance. ```yaml sources ``` ```yaml name: sources description: Raw source material, kept for reference but not for browsing. ``` -------------------------------- ### GET /api/v1/vaults Source: https://github.com/batterworks/hatchdoor/blob/main/docs/migrations/vault-scoped-clients.md Lists enabled vaults. In demo mode, this endpoint returns a restricted projection of vault information. ```APIDOC ## GET /api/v1/vaults ### Description Lists all enabled vaults. On demo instances, sensitive fields are omitted and the response is restricted. ### Method GET ### Endpoint /api/v1/vaults ### Response #### Success Response (200) - **demo_mode** (boolean) - Indicates if the instance is running in demo mode. - **vaults** (array) - List of enabled vaults. Note: In demo mode, fields like `source`, `archive_folder`, and `commit_identity` are omitted. ``` -------------------------------- ### Enable MCP via API Source: https://github.com/batterworks/hatchdoor/blob/main/docs/user-vault/02 Guides/How to deploy Hatchdoor with an agent.md Updates Hatchdoor settings to enable MCP and set the bearer token without restarting the service. ```bash MCP_TOKEN=$(openssl rand -hex 32) curl -sf -X PATCH http://127.0.0.1:42824/api/settings \ -H "Authorization: Bearer ${WEB_TOKEN}" \ -H "Content-Type: application/json" \ -d '{ "updates": { "HATCHDOOR_MCP_ENABLED": "true", "HATCHDOOR_MCP_WRITE_ENABLED": "true", "HATCHDOOR_MCP_BEARER_TOKEN": "'"${MCP_TOKEN}"'" } }' ``` -------------------------------- ### Retrieve Web Token Source: https://github.com/batterworks/hatchdoor/blob/main/README.md Fetch the initial web bearer token from the container logs. ```bash docker compose logs hatchdoor ``` -------------------------------- ### Configure Codex for MCP Source: https://github.com/batterworks/hatchdoor/blob/main/docs/user-vault/01 Get started/Connect your agent.md Add the Hatchdoor server configuration to the Codex TOML configuration file. ```toml [mcp_servers.hatchdoor] url = "http://127.0.0.1:42824/mcp" bearer_token_env_var = "HATCHDOOR_MCP_TOKEN" ``` -------------------------------- ### Create a Local Vault Source: https://github.com/batterworks/hatchdoor/blob/main/docs/user-vault/02 Guides/How to deploy Hatchdoor with an agent.md Configures a vault using Markdown files already mounted into the container. ```json { "name": "create_vault", "arguments": { "expected_registry_revision": 0, "name": "Primary", "source": { "type": "local", "path": "/data/vault" } } } ``` -------------------------------- ### Initialize Hatchdoor Theme Source: https://github.com/batterworks/hatchdoor/blob/main/frontend/index.html This script retrieves the theme preference from localStorage and applies it to the document element. It defaults to 'auto' if no valid theme is found. ```javascript Hatchdoor (function () { var v = localStorage.getItem("hatchdoor.theme"); document.documentElement.dataset.theme = v === "light" || v === "dark" ? v : "auto"; })(); ``` -------------------------------- ### Add token to .env Source: https://github.com/batterworks/hatchdoor/blob/main/docs/user-vault/01 Get started/Install Hatchdoor with Docker Compose.md Update the .env file with the retrieved token. ```env HATCHDOOR_WEB_BEARER_TOKEN=paste-the-printed-token-here ``` -------------------------------- ### Configure Claude Code for MCP Source: https://github.com/batterworks/hatchdoor/blob/main/docs/user-vault/01 Get started/Connect your agent.md Add the Hatchdoor server configuration to the .mcp.json file. ```json { "mcpServers": { "hatchdoor": { "type": "http", "url": "http://127.0.0.1:42824/mcp", "headers": { "Authorization": "Bearer ${HATCHDOOR_MCP_TOKEN}" } } } } ``` -------------------------------- ### Fresh-Chat Prompt for Hatchdoor Foundation Source: https://github.com/batterworks/hatchdoor/blob/main/docs/plans/managed-git-vault-agent-handoff.md Use this prompt to initiate the debrief and implementation process for the managed Git vault foundation. ```text Work on the Hatchdoor managed Git vault foundation. Start by reading: - docs/plans/managed-git-vault-agent-handoff.md - docs/architecture/managed-git-vault-foundation.md - docs/plans/managed-git-vault-foundation.md Then inspect the linked roadmap, ADRs, PR #18, and the current implementation seams named in the handoff. Do not edit code yet. Give me the required concise debrief for the recommended first slice: current behavior, proposed boundary, affected seams, risks, tests, blockers, and deferred work. After we agree on that debrief, implement only the approved slice and verify backward compatibility with local mode. ``` -------------------------------- ### GET /api/v1/vaults/{vault_id}/stats/detail Source: https://github.com/batterworks/hatchdoor/blob/main/docs/migrations/vault-scoped-clients.md Retrieves a detailed statistics report for a specific vault, including word counts, tag counts, and activity metrics. ```APIDOC ## GET /api/v1/vaults/{vault_id}/stats/detail ### Description Returns a rich, exact single-Vault statistics report including word/tag/link counts, top tags, activity by month, and other metadata. This route does not accept 'all' as a vault_id. ### Method GET ### Endpoint /api/v1/vaults/{vault_id}/stats/detail ### Parameters #### Path Parameters - **vault_id** (string) - Required - The unique identifier of the vault. ### Response #### Success Response (200) - **vault_id** (string) - The ID of the requested vault. - **stats** (object) - The detailed statistics object. ``` -------------------------------- ### Run Frontend Validation Suite Source: https://github.com/batterworks/hatchdoor/blob/main/docs/superpowers/specs/2026-07-21-chrome-redesign-design.md Executes the standard frontend validation pipeline including formatting, linting, type checking, testing, and building. ```bash cd frontend && npm run format:check && npm run lint && npm run typecheck && npm test && npm run build ``` -------------------------------- ### Define Mermaid and KaTeX Placeholders Source: https://github.com/batterworks/hatchdoor/blob/main/docs/design/design-system.html Styles for Mermaid diagram containers and KaTeX math block placeholders. ```css /* Mermaid */ .mermaid { border: 1px solid var(--rule); background: var(--paper); padding: 1rem; margin: 1.6rem 0; font-family: var(--font-mono); color: var(--muted); text-align: center; overflow: auto; } .mermaid .placeholder { display: inline-block; border: 1px dashed var(--rule-strong); padding: 0.4rem 0.9rem; font-size: 0.78rem; } /* KaTeX placeholder */ .katex-block { border: 1px solid var(--rule); background: var(--paper); padding: 0.8rem 1rem; margin: 1.6rem 0; ``` -------------------------------- ### Configure OpenClaw for MCP Source: https://github.com/batterworks/hatchdoor/blob/main/docs/user-vault/01 Get started/Connect your agent.md Add the Hatchdoor server configuration to the OpenClaw JSON configuration file. ```json { "mcp": { "servers": { "hatchdoor": { "url": "http://127.0.0.1:42824/mcp", "transport": "streamable-http", "headers": { "Authorization": "Bearer " } } } } } ``` -------------------------------- ### Validate Frontend Build and Tests Source: https://github.com/batterworks/hatchdoor/blob/main/docs/superpowers/specs/2026-07-21-chrome-redesign-design.md Commands to verify the frontend codebase integrity, including formatting, type checking, linting, and unit tests. ```bash npm run format:check # pass npx tsc --noEmit -p tsconfig.app.json # pass npm run lint # pass npm test # pass — 38 files, 186 tests npm run build # pass node scripts/check-module-map.mjs # pass (repo root) — 147 files, one assignment each ``` -------------------------------- ### Format and commit changes Source: https://github.com/batterworks/hatchdoor/blob/main/docs/superpowers/plans/2026-07-23-vault-layers-phase-1-walk.md Formats the codebase and commits the layer normalization implementation. ```bash cargo fmt git add Cargo.toml Cargo.lock src/vault.rs src/vault/layers.rs src/vault/exclude.rs git commit -m "feat(vault): normalize and validate layer names" ``` -------------------------------- ### Container Image Tags Source: https://github.com/batterworks/hatchdoor/blob/main/README.md Available Docker image tags for standard Docker and Podman environments. ```text battermanz/hatchdoor:latest # also version tags, e.g. 2.5.0 battermanz/hatchdoor:podman-latest # for Podman users (podman- too) ``` -------------------------------- ### Sample MCP read-only prompt Source: https://github.com/batterworks/hatchdoor/blob/main/docs/user-vault/01 Get started/Connect your agent.md A test prompt to verify read-only access to the Vault via MCP. ```text Use Hatchdoor MCP in read-only mode. Start with list_vaults. Then search the Vault collection for notes about [a topic I care about], read the best match, and give me a short summary. Do not change any notes. ``` -------------------------------- ### Query the wiki Source: https://github.com/batterworks/hatchdoor/blob/main/docs/user-vault/02 Guides/How to run an LLM wiki in Hatchdoor.md Instruction for an agent to prioritize the wiki as a knowledge source before performing external research. ```text Before answering, search the Hatchdoor wiki for [topic]. Read the most relevant page(s) and any pages they link to. Answer using what the wiki already says; only research further if the wiki doesn't cover it — and if you do, ingest what you learn back into the wiki afterward. ``` -------------------------------- ### Implement Theme Toggle Logic Source: https://github.com/batterworks/hatchdoor/blob/main/docs/design/design-system.html Handles theme switching by updating the data-theme attribute on the document root and toggling active button states. ```javascript // theme toggle const root = document.documentElement; const buttons = document.querySelectorAll('.doc-theme button'); buttons.forEach((b) => { b.addEventListener('click', () => { buttons.forEach((x) => x.classList.remove('on')); b.classList.add('on'); root.setAttribute('data-theme', b.dataset.set); }); }); ``` -------------------------------- ### Explore code with CodeGraph CLI Source: https://github.com/batterworks/hatchdoor/blob/main/AGENTS.md Use this command to search for symbols or ask questions about the codebase when a .codegraph/ directory is present. ```bash codegraph explore "" ``` -------------------------------- ### Build Embedding Caches Source: https://github.com/batterworks/hatchdoor/blob/main/eval/README.md Generate sqlite3 caches for different embedding models. Note that MxbaiEmbedLargeV1 is computationally intensive and may take significant time. ```bash cargo run --release --bin eval -- build --model BGESmallENV15 --cache data/cache/hatchdoor-cache-bge-small.sqlite3 cargo run --release --bin eval -- build --model NomicEmbedTextV15 --cache data/cache/hatchdoor-cache-nomic-v1-5.sqlite3 cargo run --release --bin eval -- build --model MxbaiEmbedLargeV1 --cache data/cache/hatchdoor-cache-mxbai-large.sqlite3 ``` -------------------------------- ### Compare BGE-M3 retrieval architectures Source: https://github.com/batterworks/hatchdoor/blob/main/docs/research/embeddings/embeddings-investigation-fastembed-v5.md Comparison of the current retrieval stack against the proposed BGE-M3 hybrid-retrieval architecture. ```text Current: FTS + dense retrieval + reciprocal-rank fusion Alternative: BGE-M3 dense + learned sparse + optional ColBERT late interaction ``` -------------------------------- ### Define drawer layout classes Source: https://github.com/batterworks/hatchdoor/blob/main/docs/design/design-system.html CSS classes for the mobile drawer backdrop and panel components. ```css .drawer-backdrop.drawer-panel ``` -------------------------------- ### POST /api/model/accept-gemma Source: https://github.com/batterworks/hatchdoor/blob/main/docs/user-vault/03 Reference/HTTP API reference.md Accepts Gemma terms and initiates the download and indexing process. ```APIDOC ## POST /api/model/accept-gemma ### Description Accept Gemma terms and start downloading/indexing with it. ### Method POST ### Endpoint /api/model/accept-gemma ### Response #### Success Response (202) - **status** (integer) - Accepted #### Error Response (409) - **status** (integer) - Conflict if a model is already active. ``` -------------------------------- ### Configure Hermes for MCP Source: https://github.com/batterworks/hatchdoor/blob/main/docs/user-vault/01 Get started/Connect your agent.md Add the Hatchdoor server configuration to the Hermes YAML configuration file. ```yaml mcp_servers: hatchdoor: url: "http://127.0.0.1:42824/mcp" headers: Authorization: "Bearer ${HATCHDOOR_MCP_TOKEN}" ``` -------------------------------- ### Commit changes to repository Source: https://github.com/batterworks/hatchdoor/blob/main/docs/superpowers/plans/2026-07-23-vault-layers-phase-1-walk.md Commands to format code and commit the new marker file parsing implementation. ```bash cargo fmt git add src/vault/layers.rs git commit -m "feat(vault): parse .hatchdoor-layer marker files" ``` -------------------------------- ### Implement VaultIndex build with layer support Source: https://github.com/batterworks/hatchdoor/blob/main/docs/superpowers/plans/2026-07-23-vault-layers-phase-1-walk.md Updates the VaultIndex build process to collect layers and apply exclusion patterns during the directory walk. ```rust impl VaultIndex { /// Scans with default deployment configuration. Retained so existing /// callers and tests are unaffected. pub fn build(root: impl AsRef) -> io::Result { Self::build_with_config(root, &VaultScanConfig::default()) } pub fn build_with_config( root: impl AsRef, config: &VaultScanConfig, ) -> io::Result { let root = root.as_ref().to_path_buf(); let mut by_slug = HashMap::new(); let mut by_title = HashMap::new(); let mut by_path_title = HashMap::new(); let mut ordered_slugs = Vec::new(); let mut markdown_paths = Vec::new(); // Markers are collected before pruning: a marker inside a directory a // noise pattern would prune is still read, so per-deployment noise // cannot silently delete a layer. let layers = LayerMap::collect(&root).map_err(io::Error::other)?; for entry in WalkDir::new(&root) .follow_links(false) .into_iter() .filter_entry(|entry| { entry.depth() == 0 || match entry.path().strip_prefix(&root) { Ok(relative) => !config .exclude .is_excluded(relative, entry.file_type().is_dir()), Err(_) => true, } }) { let entry = entry.map_err(io::Error::other)?; let path = entry.path(); if !entry.file_type().is_file() || path.extension().and_then(|ext| ext.to_str()) != Some("md") { continue; } markdown_paths.push(path.to_path_buf()); } markdown_paths.sort(); // Default-surface notes claim their slugs first, so a compiled page // beats the source it was compiled from on a title collision. markdown_paths.sort_by_key(|path| { relative_note_path_without_ext(&root, path) .map(|relative| layers.layer_for(&relative).is_some()) .unwrap_or(false) }); ``` -------------------------------- ### Check Module Map Coverage Source: https://github.com/batterworks/hatchdoor/blob/main/CONTRIBUTING.md Verify structural coverage of the module map after modifying production source files. ```bash node scripts/check-module-map.mjs ``` -------------------------------- ### Define TOML configuration for orchard tools Source: https://github.com/batterworks/hatchdoor/blob/main/docs/design/design-system.html Use this TOML structure to define tool sharpening schedules and associated notes. ```toml # orchard.toml — sharpening schedule [tools] secateurs = "night before" loppers = "night before" pruning_saw = "once per season" [notes] mood = "calm; not on a Sunday" ``` -------------------------------- ### Calculate Source Mapping Source: https://github.com/batterworks/hatchdoor/blob/main/docs/superpowers/specs/2026-07-28-inline-note-editing-design.md Defines the transformation pipeline and the formula for mapping rendered line numbers back to the original file. ```text file → parseFrontmatter → body → stripBlockIds → resolveWikilinks → rendered markdown ``` ```text fileLine = renderedLine + frontmatterLineOffset(content) ``` -------------------------------- ### Configure Vault Path Source: https://github.com/batterworks/hatchdoor/blob/main/README.md Set the absolute path to your Markdown vault in the .env file. ```env HOST_VAULT_PATH=/absolute/path/to/your/markdown-vault ``` -------------------------------- ### Create a Markdown table Source: https://github.com/batterworks/hatchdoor/blob/main/docs/user-vault/03 Reference/Supported Markdown reference.md Defines a table structure using Markdown syntax. ```markdown | Feature | Markdown trigger | | --- | --- | | Wikilink | `[[Note]]` | | Callout | `> [!note]` | ``` -------------------------------- ### Run vault layer tests Source: https://github.com/batterworks/hatchdoor/blob/main/docs/superpowers/plans/2026-07-23-vault-layers-phase-1-walk.md Executes the specific test suite for vault layers. ```bash cargo test --lib vault::layers ``` -------------------------------- ### Create a Managed Git Vault Source: https://github.com/batterworks/hatchdoor/blob/main/docs/user-vault/02 Guides/How to deploy Hatchdoor with an agent.md Configures a vault that clones and synchronizes with a remote Git repository. ```json { "name": "create_vault", "arguments": { "expected_registry_revision": 0, "name": "Primary", "source": { "type": "managed_git", "repository_url": "https://github.com//.git", "branch": "main", "vault_subdirectory": "notes", "mode": "pull_only", "poll_interval_secs": 900 } } } ``` -------------------------------- ### Apply Global Base Styles Source: https://github.com/batterworks/hatchdoor/blob/main/docs/design/design-system.html Resets and base styles for the document body and elements. ```css * { box-sizing: border-box; } html, body { margin: 0; padding: 0; } body { background: var(--bg); color: var(--ink); font-family: var(--font-sans); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; } ``` -------------------------------- ### Execute Release Merge Commands Source: https://github.com/batterworks/hatchdoor/blob/main/docs/maintenance/release-runbook.md Run these commands from the repository root after a squash merge to realign the development branch with main. Replace with a valid UTC timestamp. ```bash git fetch --prune origin git log -1 --oneline origin/main git status --short git switch development git branch backup/development-before-main- development git remote git push origin backup/development-before-main- git reset --hard origin/main git push --force-with-lease origin development git ls-remote --heads origin main development backup/development-before-main- ``` -------------------------------- ### Define Mobile Layout Components Source: https://github.com/batterworks/hatchdoor/blob/main/docs/design/design-system.html Styles for mobile topbar and path navigation elements. ```css /* Mobile topbar variant */ .mobile-topbar { background: var(--bg); border-bottom: 1px solid var(--rule); padding: 0.6rem 0.75rem; } .mobile-topbar-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 0.6rem; align-items: center; } .mobile-meta { border-top: 1px solid var(--rule); padding: 0.32rem 0.75rem; background: var(--paper); } .mobile-path { background: transparent; border: 0; color: var(--muted); font-family: var(--font-display); font-variation-settings: "wdth" 96, "wght" 400; font-size: 0.82rem; line-height: 1.28; padding: 0.12rem 0.2rem; width: 100%; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; } .mobile-path:hover { background: var(--paper-2); } ``` -------------------------------- ### Verify demotion via search Source: https://github.com/batterworks/hatchdoor/blob/main/docs/user-vault/02 Guides/How to organize a Vault with layers.md Confirm that notes in a demoted folder are hidden from default search queries. ```text search_notes with scope=, query="" ``` -------------------------------- ### Commit changes Source: https://github.com/batterworks/hatchdoor/blob/main/docs/superpowers/plans/2026-07-23-vault-layers-phase-1-walk.md Formats the code and commits the changes to the repository. ```bash cargo fmt git add src/vault/seed.rs src/vault/tests.rs git commit -m "fix(vault): seeder ignores noise when checking for existing notes" ``` -------------------------------- ### Define Lifecycle state machine Source: https://github.com/batterworks/hatchdoor/blob/main/docs/architecture/managed-git-vault-foundation.md Visualizes the transitions between vault states from unconfigured to ready, including error and recovery paths. ```text unconfigured | v validating -> acquiring -> synchronizing -> indexing -> ready | | | | +------------+--------------+-------------+-> unavailable -> retry ready -> syncing -> ready | | | +-> degraded -> retry | +-> conflict -> read-only recovery -> syncing ``` -------------------------------- ### Define VaultRuntimeSnapshot structure Source: https://github.com/batterworks/hatchdoor/blob/main/docs/architecture/managed-git-vault-foundation.md Captures the current state of the vault, including phase, source configuration, and synchronization progress. ```text VaultRuntimeSnapshot phase source and mode repository_root: optional path vault_root: optional validated path capabilities acquisition/index/sync progress sanitized repository status last error and retryability ``` -------------------------------- ### Request a controlled note edit Source: https://github.com/batterworks/hatchdoor/blob/main/docs/user-vault/01 Get started/Search and change notes with your agent.md Use this prompt to perform a specific, verifiable change to a note using the Hatchdoor MCP, ensuring the agent uses the correct content hash. ```text Use Hatchdoor MCP to add one bullet, “Reviewed with Hatchdoor,” under the heading [choose an existing heading] in [choose an existing note]. First list Vaults, search for the note, read it, and use the current content hash for the smallest possible edit. Do not change any other note. Report exactly what you changed. ``` -------------------------------- ### Define Search Dialog Components Source: https://github.com/batterworks/hatchdoor/blob/main/docs/design/design-system.html Layout and styling for the search overlay, panel, input fields, and toggle controls. ```css .search-overlay { background: var(--overlay-bg); padding: 1rem; display: grid; place-items: start center; min-height: 460px; } .search-panel { width: min(46rem, 100%); max-height: 84vh; overflow: auto; border: 1px solid var(--rule-strong); background: var(--bg); box-shadow: var(--shadow-overlay); padding: 1rem; } .search-panel--faceted { width: min(calc(59rem + 0.75rem + 1px), 100%); } .search-panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.7rem; } .search-panel-head h2 { margin: 0; font-family: var(--font-display); font-variation-settings: "wdth" 88, "wght" 700; font-size: 1rem; text-transform: uppercase; letter-spacing: 0.06em; } .search-input { width: 100%; box-sizing: border-box; border: 1px solid var(--rule-strong); background: var(--paper); padding: 0.6rem 0.7rem; font-family: var(--font-sans); font-size: 1rem; color: var(--ink); transition: border-color var(--dur) var(--ease); } .search-input:focus, .search-input.is-focus { outline: none; border-color: var(--hot); } .search-toggle { display: inline-flex; align-items: center; gap: 0.5rem; margin: 0.7rem 0 0.55rem; font-family: var(--font-sans); font-size: 0.82rem; color: var(--muted); } .search-toggle input { accent-color: var(--hot); } ``` -------------------------------- ### Ingest raw material Source: https://github.com/batterworks/hatchdoor/blob/main/docs/user-vault/02 Guides/How to run an LLM wiki in Hatchdoor.md Instructions for an agent to file source material into the raw layer and subsequently integrate it into the curated wiki. ```text Use Hatchdoor MCP. Create a note under the "raw" layer folder containing this material verbatim: [paste source text]. Use a short, dated filename. Do not touch any other note yet. ``` ```text Search the wiki (default surface) for an existing page about [topic]. If one exists, read it and use append_to_note or replace_section to add what's new from [[raw source note]], with a wikilink back to the source. If none exists, create a new wiki page, link it from any obviously related pages you already found, and link it back to the raw source. ``` -------------------------------- ### decline_gemma_terms Source: https://github.com/batterworks/hatchdoor/blob/main/docs/user-vault/03 Reference/MCP tools reference.md Declines Gemma terms and downloads Nomic Embed Text v1.5 instead. ```APIDOC ## decline_gemma_terms ### Description Decline Gemma, remove any partial Gemma download, download Nomic Embed Text v1.5 instead, and begin indexing. This tool is always available. ### Parameters None. ``` -------------------------------- ### Run Evaluation Source: https://github.com/batterworks/hatchdoor/blob/main/eval/README.md Execute the evaluation against a specific model cache and query set. Results are printed to stdout and appended to eval/results.md. ```bash cargo run --release --bin eval -- run \ --model BGESmallENV15 \ --cache data/cache/hatchdoor-cache-bge-small.sqlite3 \ --queries eval/queries.jsonl ``` -------------------------------- ### Drawer Overlay Styles Source: https://github.com/batterworks/hatchdoor/blob/main/docs/design/design-system.html CSS for the mobile sidebar drawer backdrop and panel. ```css /* Drawer (mobile sidebar overlay) */ .drawer-backdrop { background: var(--overlay-bg); height: 200px; display: flex; align-items: flex-start; padding-top: 1rem; } .drawer-panel { background: var(--bg); width: 280px; height: 100%; box-shadow: var(--shadow-float); border-right: 1px solid var(--rule); } ``` -------------------------------- ### Define full validation gates Source: https://github.com/batterworks/hatchdoor/blob/main/docs/architecture/work-packet-template.md Include all necessary gates from CONTRIBUTING.md and module map checks for comprehensive validation. ```bash ``` -------------------------------- ### Expose Hatchdoor to LAN Source: https://github.com/batterworks/hatchdoor/blob/main/docs/user-vault/01 Get started/Install Hatchdoor with Docker Compose.md Replace the ports section in compose.yaml to allow access from other devices on the network. ```yaml ports: - "42824:42824" ``` -------------------------------- ### Unit tests for marker file parsing Source: https://github.com/batterworks/hatchdoor/blob/main/docs/superpowers/plans/2026-07-23-vault-layers-phase-1-walk.md Tests for validating bare scalar forms, mapping forms, default re-inclusion, error handling, and description sanitization. ```rust #[test] fn parse_marker_accepts_bare_scalar_form() { assert_eq!( parse_marker("sources\n").expect("valid"), LayerDecl::Named { name: "sources".to_string(), description: None } ); } #[test] fn parse_marker_accepts_mapping_form_and_ignores_unknown_keys() { let marker = "name: sources\ndescription: Ground truth.\nfuture_key: 1\n"; assert_eq!( parse_marker(marker).expect("valid"), LayerDecl::Named { name: "sources".to_string(), description: Some("Ground truth.".to_string()) } ); } #[test] fn parse_marker_recognises_default_reinclude() { assert_eq!(parse_marker("default").expect("valid"), LayerDecl::Default); assert_eq!( parse_marker("name: default\n").expect("valid"), LayerDecl::Default ); } #[test] fn parse_marker_rejects_malformed_and_reserved() { assert!(parse_marker("").is_err()); assert!(parse_marker("- a\n- b\n").is_err()); assert!(parse_marker("name: all\n").is_err()); } #[test] fn parse_marker_sanitizes_and_caps_description() { // Descriptions are vault-authored text rendered into the MCP tool schema: // control characters and newlines must not corrupt it, and length is capped. let marker = format!( "name: sources\ndescription: \"line one\\nline\\ttwo\\u0007 {}\"\n", "x".repeat(600) ); let LayerDecl::Named { description, .. } = parse_marker(&marker).expect("valid") else { panic!("expected a named layer"); }; let description = description.expect("description present"); assert!(!description.contains('\n')); assert!(!description.contains('\u{0007}')); assert!(description.starts_with("line one line two")); assert_eq!(description.chars().count(), 500); } ``` -------------------------------- ### Define Search Highlight Styles Source: https://github.com/batterworks/hatchdoor/blob/main/docs/design/design-system.html Styles for inline search result highlighting and active state indicators. ```css .search-hit { background: var(--highlight); padding: 0 0.1rem; } .search-hit.active { background: var(--highlight-active); } ``` -------------------------------- ### Re-promote a subfolder Source: https://github.com/batterworks/hatchdoor/blob/main/docs/user-vault/02 Guides/How to organize a Vault with layers.md Use the 'default' marker to override inherited demotion for a nested folder. ```yaml default ``` -------------------------------- ### Define a full-form layer marker Source: https://github.com/batterworks/hatchdoor/blob/main/docs/superpowers/specs/2026-07-23-vault-layers-and-exclusions-design.md Use the full YAML format to specify both a name and a descriptive summary for a vault layer. ```yaml name: sources description: > Immutable clippings, papers and transcripts. Ground truth — the wiki compiles from these. Never edit by hand. Search here to verify a citation, re-extract a detail the wiki didn't capture, or find material not yet written up. ``` -------------------------------- ### Define VaultCapabilities structure Source: https://github.com/batterworks/hatchdoor/blob/main/docs/architecture/managed-git-vault-foundation.md Lists the operational capabilities derived from the current source mode and lifecycle phase. ```text VaultCapabilities browse search mutate pull push retry ``` -------------------------------- ### Markdown Image Syntax Source: https://github.com/batterworks/hatchdoor/blob/main/docs/starter-vault/40-reference/Hatchdoor — Agent Guide.md Standard syntax for embedding images in Markdown notes. ```markdown ![Useful alt text](image-file-name.jpg) ``` -------------------------------- ### Define document input formats Source: https://github.com/batterworks/hatchdoor/blob/main/docs/research/embeddings/embeddings-investigation-fastembed-v5.md Conceptual representations for document inputs, including metadata-enriched structures for general use and model-specific wrappers. ```text search_document: ``` ```text Title: Aliases: Tags: Section: ``` ```text title: | text: Section: ``` -------------------------------- ### Import ExcludeMatcher Source: https://github.com/batterworks/hatchdoor/blob/main/docs/superpowers/plans/2026-07-23-vault-layers-phase-1-walk.md Adds the necessary import for the ExcludeMatcher module in the seed file. ```rust use super::exclude::ExcludeMatcher; ```