Skip to main content
Glama

BowThruster

BowThruster keeps two small guarantees in an AI coding loop:

  1. Human session memory survives compaction. A single session.md file holds the active goal, working ideas, problems, agreed decisions, ruled-out decisions, and open questions. Runtime hooks re-inject that context and block subagent tasks that revive a ruled-out decision.

  2. Test impact gets surfaced and verified. A tree-sitter index finds the tests that import a production file you are about to edit, and a SHA-256 ledger blocks an agent from stopping before those tests have run against the current file contents.

BowThruster needs Python 3.11+ and installs tree-sitter-language-pack. The core CLI makes no model calls and needs no API keys.

Install

pip install -e .
bowthruster init

Run bowthruster init from the repository root. It creates session.md and .mental_cache/, updates .gitignore, and installs the Claude Code and Git hooks.

Related MCP server: Hokmah MCP Server

CLI

All commands accept --project-root PATH and --json either before or after the subcommand.

bowthruster init [--agy] [--lead-id ID ...] [--no-hooks] [--json]
bowthruster status [--json]                 # alias: session
bowthruster impact <files...> [--limit N] [--max-hops H] [--json]   # alias: tests
bowthruster plan-tests [files...] [--max-tests N] [--max-hops H] [--rank-jev] [--json]
bowthruster check [files...] [--json]
bowthruster hook <action> [--file F] [--session-id S] [--transcript T] [--agy] [--lead-id ID ...] [--json]
  • init creates session.md and .mental_cache/, then installs hooks unless --no-hooks is set. Use --agy to also install Antigravity hooks and --lead-id to mark Lead conversation IDs.

  • status reports session state, parsed bullets, syntax errors, and unverified test-impact changes.

  • impact resolves each file and lists importing tests across multi-hop reverse imports (--max-hops, default 6).

  • plan-tests computes a fail-closed test plan (widen_full_suite, tests, reasons, frontend_changed) from git dirty/deleted files or explicit file arguments, .bowthruster_fixtures.json glob rules, and optional --rank-jev fail-fast ordering.

  • check runs the syntax + Python LLM AST check and the unverified test-impact check; it exits 1 when syntax or AST gate errors exist.

  • hook runs one runtime action: install, pre-prompt, pre-tool, post-tool, post-read, stop, distill-session, pre-commit, or post-commit.

Optional Credentials

The core CLI and SHA-256 test-impact gate run offline with zero API keys. Optional model features read environment variables (or .env):

  • TYPESAFE_API_KEY — queries https://api.typesafe.ai/v1/systemone (jev-latest) for ruled-out dispatch checks, session.md curation, and plan-tests --rank-jev fail-fast ordering.

  • DEEPSEEK_API_KEY or GEMINI_API_KEY — distills completed Lead turns into session.md (deepseek-v4-pro or gemini-2.5-flash with full model output ceilings).

Feature 1: session.md memory and the ruled-out guard

session.md is a plain Markdown file the agent and the human can both read and edit:

# Active Session

## Goal
- (exploring)

## Working Ideas & Current Focus
- (none yet)

## Problems & Findings
- (none yet)

## Agreed Decisions
- (none yet)

## Ruled Out (and Why)
- Do not parse raw token claims in the gateway; route every check through auth.

## Open Questions
- (none yet)
  • UserPromptSubmit re-injects the active Goal and settled sections across long sessions.

  • On an idle Lead stop, distill-session updates session.md from the latest transcript.

  • PreToolUse checks subagent dispatch prompts against ## Ruled Out (and Why). When Jev credentials are configured, it blocks a task that would revive a ruled-out decision.

  • Emptying session.md resets it to the Brainstorming template.

Feature 2: test-impact surfacing and the SHA-256 gate

For a production file, BowThruster parses repository imports with tree-sitter, finds test files that import it, and deduplicates the result per session:

bowthruster impact src/auth/token.py
{
  "files": ["src/auth/token.py"],
  "importing_tests": ["tests/test_gateway.py"]
}

Runtime hooks inject the same list on edit (pre-tool) and read (post-read) so the agent sees which tests to run before it stops.

The verification gate records SHA-256 hashes of production files when a test command succeeds:

.venv/bin/python -m pytest tests/test_gateway.py

Later, bowthruster check and the stop hook compare each dirty production file's current SHA-256 against the verified ledger. If the file changed after the last successful test run, the agent is blocked from stopping until it runs the importing tests again.

Fail-closed test planning (plan-tests), fixtures, and shadow recall

bowthruster plan-tests builds an inspectable CI/local test plan:

bowthruster plan-tests --rank-jev --json
  • Reason tags: each selected test records "changed-test", "direct-import:<src>", "transitive-caller:<src>", or "declared-fixture:<pattern>".

  • Fail-closed full-suite widen ("tests": ["*"]): widens automatically on deleted/renamed Python modules ("deleted-module:<path>"), unmapped or global Python dependencies such as conftest.py / pyproject.toml ("unmapped-dependency:<path>"), or candidate counts exceeding --max-tests ("fanout-overflow").

  • Non-import fixture rules (.bowthruster_fixtures.json): map repo-relative globs to test files, ["*"], or ["FRONTEND_BUILD"] (which sets "frontend_changed": true without adding a fake pytest target):

{
  "fixtures/**/*.json": ["tests/test_loader.py"],
  "migrations/*.sql": ["*"],
  "web/**": ["FRONTEND_BUILD"]
}
  • Opaque fail-fast Jev ranking (--rank-jev): sends only opaque q_0001..q_NNNN IDs and anonymized coupling counts to https://api.typesafe.ai/v1/systemone (jev-latest). UNKNOWN (None) probabilities run first, followed by descending failure probability; Jev never drops or skips a selected test.

  • Shadow recall telemetry: record_shadow_proposal appends pre-run proposals and actual failures to .mental_cache/shadow_proposals.jsonl, and shadow_recall_summary reports total runs and false-negative misses.

.mental_cache/ layout

.mental_cache/ is git-ignored and lives next to session.md:

.mental_cache/
├── hook_config.json        # Lead conversation IDs and install flags
├── pre_prompt_turns.json   # per-conversation prompt-injection cadence
├── session_state.json      # distillation state
├── session_parked.md       # parked session items
├── test_callers.json       # cached tree-sitter caller index
├── verified_tests.json     # SHA-256 verification ledger and stop-block signatures
├── seen_impact.json        # read/edit impact deduplication
├── shadow_proposals.jsonl  # immutable pre-run shadow selector log
├── distill.log             # detached distillation log
└── .gitignore              # ignores everything in this directory

Walkthrough

# 1. Start a session.
cd your-repo
bowthruster init

# 2. Record a rule in session.md.
#    Edit "## Ruled Out (and Why)" with a bullet such as:
#    - Do not parse raw token claims in the gateway; route every check through auth.

# 3. Before editing a shared module, list the tests that import it.
bowthruster impact src/auth/token.py

# 4. Run those importing tests, then check the gate.
.venv/bin/python -m pytest tests/test_gateway.py
bowthruster check

# 5. Inspect the live session.
bowthruster status

With hooks installed, the ruled-out guard and test-impact prompts run automatically during the agent's normal edit, read, subagent-spawn, and stop events.

License

Functional Source License, Version 1.1, with an Apache 2.0 future licence (FSL-1.1-Apache-2.0). See LICENSE.

Available Tools

8 tools
atlasA

Step 1 (Explore LOD_0 or Living Spec): Render the 1-line-per-component Atlas topology (with Charter, Role, Why/Rationale, verification statuses, > FLOW edges, health metrics, and optional Mermaid graph) or pass spec=true to compile the full human-readable Markdown specification from the live board.

Inputs: spec, board, boards, mermaid, +2 more.

git_syncA

Step 4 (Verify & Sync): Run Git <-> Whiteboard sync: mode='pre' (50ms pre-commit gate checking STALE edit guard, AST signatures, call-graph % LAW reachability, > FLOW schemas, dangling imports, Bend 2 proofs, and unregistered_public_symbols; pass mark_verified=true to auto-transition STALE components to VERIFIED when allowed=true), mode='post' (stamp commit_sha, heal git mv renames, refresh #Lstart-Lend AST anchors, cascade STALE), mode='baseline', or mode='drift'.

Inputs: mode, board, manifest, project_root, +1 more.

logsA

Query the append-only Structured Flight Recorder (.whiteboard/logs/lattice_events.jsonl) to diagnose rejected turns or gate errors.

Inputs: board, limit, status, project_root.

packetsC

Step 3 (Build STALE Packet): Compile self-contained WorkPackets with Bend 2 laws_skeleton, Python AST python_skeleton (with Spec docstrings & # MUST CALL anchors), and baseline_commit_sha.

Inputs: wave, board, force, status, +3 more.

readmeB

Read the BowThruster README, System Architecture Guide, or the unified 'bowthruster' SKILL.md template so you know how to format pipe tables and operate BowThruster.

Inputs: section.

sliceA

Step 1 (Slice + Code in One Shot): Retrieve a <2KB component/symbol slice AND exact #Lstart-Lend source code (set query='<function_or_helper>', include_code=true) BEFORE calling read_file or grep. Pass mark_stale=true when pulling code for an internal fix (no contract change) to mark the matched component STALE in one shot.

Inputs: kind, board, query, stage, +7 more.

statusB

Step 4 (Transition Status): Transition a component's build lifecycle status (e.g. new_status='VERIFIED' after pre-commit gate and delta/seam tests pass).

Inputs: component (required), new_status (required), board, reason, +3 more.

turnB

Step 2 (Mutate Board First -> STALE): Compile Markdown pipe tables into the Whiteboard in <50ms BEFORE editing any VERIFIED file when contracts/architecture change. Canonical table headers: | Charter | Summary | Principles |, | Component | Role | Why | Owner | Stage | Depends_On | Files | (Why column is optional), | Flow | Source | Target | Payload | Condition |, | Interface | Component | Inputs | Outputs | Owner | Stage | File | Spec |, | Law | Component | Owner | Stage | Bend_Dir | Args | LHS | RHS | Spec | (reserve % LAW for multi-variable k>=2 boolean rules using Bool.and/or/not; never invent 1-boolean x==x tautologies), | Schema | Component | Fields | Owner | Stage | File | Spec |, | Rule | Component | Type | Property | Op | Value | Condition |.

Inputs: board (required), message (required), profile, speaker, +2 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.2/5.0

    Scored across 8 tools

    Disambiguation3/5

    The tools map onto a clear staged workflow (atlas/slice=Step 1, turn=Step 2, packets=Step 3, git_sync/status=Step 4) which aids selection, and logs/readme are distinct. However, git_sync is heavily mode-overloaded (pre/post/baseline/drift), atlas supports two output modes, and status overlaps with git_sync's mark_verified STALE->VERIFIED transition, creating real boundary confusion.

    Naming Consistency4/5

    All names are single lowercase words or a single snake_case compound (git_sync), so style is consistent. There is no verb_noun convention, so the name alone doesn't convey the action (e.g. 'turn' and 'packets' are opaque until you read the description), but internal consistency is high.

    Tool Count4/5

    8 tools is well within a healthy range for a spec/workflow lifecycle server, and each participates in the pipeline rather than duplicating. The only concern is functional density (git_sync's four modes, atlas's two modes) rather than raw count.

    Completeness4/5

    The surface covers the core loop: explore (atlas), retrieve code (slice), mutate board (turn), compile packets, verify/sync (git_sync), transition (status), and diagnose failures (logs), plus format guidance (readme). Minor gaps exist: no explicit undo/rollback for a bad turn, and code editing itself is delegated to external read_file/grep and implied editors.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables AI agents to query architecture context, data contracts, and blast radius to prevent cross-repo architectural breakage before merging.
      22
      Apache 2.0
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables agentic coding tools to maintain a living, in-repo model of intent, architecture, and code, with deterministic indexing, bidirectional linking, and continuous drift detection for task-scoped context and reconciliation.
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Provides AI coding agents with an embedded knowledge graph and architecture governance tools, enabling blast radius analysis, compliance checks, and smart context extraction from codebases.
      Apache 2.0