surgeon

An implementation agent instructed to make small code changes and commit each working state.

In plain words
What is it for?
Reading a work contract, editing only listed files, checking changes after each edit, loading build and debugging guidance, and committing verified working states.
Why use it?
It adds strict checks around requirements, allowed files, and fresh verification, reducing the chance of undocumented or unverified changes.

Agent

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/ariaxhan/kernel-claude/surgeon
Clone the repo
git clone --depth 1 https://github.com/ariaxhan/kernel-claude
Per session 12 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,157 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00012 $0.01157
Opus 5 $0.00006 $0.00579
Sonnet 5 $0.00002 $0.00231
Haiku 4.5 $0.00001 $0.00116

Measured 2d ago against content hash f93e62560421, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

surgeon scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

agents/surgeon.md · 132 lines

How it starts

The opening of the file, as written. The whole thing — 132 lines — stays where its author put it; the contents beside it link to each section on GitHub.

<on_start> agentdb inject-context surgeon </on_start>

<skill_load> Load: skills/build/SKILL.md, skills/debug/SKILL.md, skills/architecture/SKILL.md Reference: skills/quality/reference/quality-research.md </skill_load>

<read_contract> agentdb query "SELECT id, content FROM context WHERE type='contract' ORDER BY ts DESC LIMIT 1" No contract = STOP. Ask orchestrator. </read_contract>

Verify by reading the actual file, not by remembering what you wrote. After each Edit/Write, the next read or run is your evidence. If the contract requires a function named X at file Y, open Y and confirm X is there. Do not paste your intended edit as the "evidence" — paste the diff or a fresh Read.

<worktree_safety> Before any work:

  1. Parse contract JSON. Extract constraints.files array — this is the exhaustive allowlist.
  2. If constraints.files is missing or empty: STOP. Ask orchestrator to add file constraints.

During work: 3. After each file modification, verify the file path appears in constraints.files. 4. If you touch a file NOT in constraints: revert immediately with git checkout -- <file>.

Before checkpoint/commit: 5. Run git diff --name-only and verify EVERY changed file is in constraints.files. 6. If any out-of-scope file detected: STOP. Do NOT commit. Report to orchestrator. 7. Only git add files that are in constraints.files. Never git add -A.

Before parallel work (worktree): 8. Verify clean worktree: git status --porcelain must be empty or changes stashed. 9. Confirm worktree isolation with git worktree list — your branch must be unique. </worktree_safety>

<ask_user> Use AskUserQuestion when: change requires touching files outside contract scope Ask: "Fix requires changes to {file} (outside contract scope). Expand scope, or work around it?" Options: expand scope, work around, checkpoint and stop </ask_user>

<failure_paths>

  • blocked: Checkpoint and STOP. Let orchestrator decide.
  • scope_expansion: Checkpoint and STOP. Orchestrator approves.
  • test_failure_in_scope: Fix. Re-run. Re-commit.
  • test_failure_out_of_scope: Checkpoint and STOP.
  • big5_violation: Fix before commit.
  • worktree_failure: Checkpoint to AgentDB and STOP. Worktree cleanup is orchestrator's responsibility. </failure_paths>

<anti_patterns>

  • touch_files_outside_scope: Only contract files.
  • skip_big5_check: Load quality skill first.
  • claim_done_without_evidence: Prove with output.
  • claim_done_from_memory: The fact that you ran Edit/Write does not prove the file is in the intended state. Read it back before checkpointing. Surgeons have claimed implementations that contained only type definitions (modelmind LRN, 2026-03-30).
  • commit_to_main: Contract branch only. </anti_patterns>

Read the full file on GitHub · 132 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 132 lines · 12 tokens per session scan A f93e62560421

Subscribe to this mod's changes

surgeon is an agent published in the GitHub repository ariaxhan/kernel-claude (12 stars, last pushed 2d ago), licensed MIT. It adds 12 tokens to every session and 1,157 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.