agentleFS
drevendevdrevendev/HungryCrab/AGENTS.md

HungryCrab

AGENTS.md5 starsChanged 52 days agoMITView on GitHub

This file is for coding agents; Claude Code reads it through CLAUDE.md. Humans should start with CONTRIBUTING.md. Hungry Crab (crab) is a deterministic Python CLI that digests a foreign repository (the prey) into a token-budgeted digest/ folder, so that an agent can later decide what is worth carrying over into its own repository (the maw) without violating licenses. The design is written down in docs/design/; follow it instead of re-deriving decisions. The vocabulary is in docs/design/GLOSSARY.md — prey, maw, nutrient,…

  • Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.

    Of the AGENTS.md files we read, the 31,843 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.

  • In this repository6 other files it gives its agents.

The file

We split this AGENTS.md into the rules it gives an agent

5 rules. About 0 are common, 3 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Only recording advances phases.

    line 23
  2. Distinctive:

    Never execute prey content.

    line 84
  3. Distinctive:

    Every miner has tests on the fixtures.

    line 90
  4. Very specific:

    Create src/hungry_crab/miners/<name>.py with a class that has name, requires, json_file, md_file and run(ctx) -> MinerResult.

    line 104
  5. Very specific:

    Add tests/test_miner_<name>.py with assertions against the five fixtures.

    line 108

≈ “Common” is an estimate: at least 1 in 5 of the 40,246 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

Agent guide for Hungry Crab

This file is for coding agents; Claude Code reads it through CLAUDE.md. Humans should start with CONTRIBUTING.md.

What this repository is

Hungry Crab (crab) is a deterministic Python CLI that digests a foreign repository (the prey) into a token-budgeted digest/ folder, so that an agent can later decide what is worth carrying over into its own repository (the maw) without violating licenses. The design is written down in docs/design/; follow it instead of re-deriving decisions. The vocabulary is in docs/design/GLOSSARY.md — prey, maw, nutrient, menu, hunger, meal, ledger — and it is the authority when a document disagrees with it. The decisions log is at the end of docs/design/01-concept-and-skill.md.

Layout

  • src/hungry_crab/cli.py: argparse entry point (crab sniff | catch | digest | compare | menu | serve | spec | attribution | ledger | tune | loop | init | update | cache | eat | hunt | mcp | profiles | report | explore | discover | launcher | version).
  • src/hungry_crab/loop.py, loop_config.py, loop_provider.py, loop_work.py, loop_cli.py: the scheduled phase protocol, strict maw-owned policy, provider waits and guarded effects. Only recording advances phases; each attempt has a bounded lease. GROW retains the licensed serve transaction, MOLT stays within its round, and HARDEN tags only a verified human merge. The CLI never starts a scheduler or merges. The operator guide is docs/scheduled-crab.md.
  • src/hungry_crab/prey_guard.py: fail-closed PreToolUse decision logic for shell commands that touch the prey cache; only a small audited read-only command surface is allowed. cleanroom_guard.py is the second hook, which keeps the clean-room implementer out of the cache. Both are wired in hooks/hooks.json, which runs hooks/guard.py from the plugin root with the first Python the shell finds; the launcher imports them from src/, so no console script is needed. Nothing in that launcher may exit 2 except a guard's refusal.
  • src/hungry_crab/updater.py: crab update, which checks the agent plugins against master and the CLI against the latest PyPI release (an index install) or master (a git install). It must never reinstall the CLI in-process: uv cannot replace a running tool on Windows and leaves it broken.
  • src/hungry_crab/fetch/: git wrapper, GitHub API client, catch, issues fetch.
  • src/hungry_crab/mcp_service.py, mcp_server.py: scoped optional stdio analysis; no publication or ledger writes. report.py and artifact_read.py render existing evidence as inert HTML. scripts/install_smoke.py verifies installed artifacts, not the editable checkout.
  • src/hungry_crab/miners/: one module per miner; __init__.py is the ordered registry.
  • src/hungry_crab/licensing/: SPDX detection, the maw x prey verdict matrix, and origin.py, the content-origin ceiling that caps commenter prose at IDEAS_ONLY.
  • src/hungry_crab/digest.py: orchestrator and manifest.json; budget.py owns artifact ownership, page names, the whole-digest policy and rerun cleanup; digest_integrity.py checks a cached digest's artifacts before reuse.
  • src/hungry_crab/compare/: trait rules, candidate builders, scoring (data/scoring.yml), gap.md and menu.md rendering; nutrients.py is the card schema.
  • src/hungry_crab/maw.py, ledger.py, serve.py, tune.py: .crab.yml, the ledger, issue creation through gh, weight suggestions from the ledger.
  • src/hungry_crab/pr_publication.py, pr_effects.py, pr_serve.py, pr_serving.py, publication_safety.py: serve --as pr-branch — clean-room receipts, the secret scan, provider reconciliation, the git and gh effects, and the serve policy around them. attribution.py is the COPY side: the materialization receipt, its verification against the prey at that commit, .crab/attributions.json and the notice file crab attribution renders.
  • src/hungry_crab/mdutil.py, tokens.py, safety.py: Markdown builder with a token budget, token estimate, prompt-injection heuristics.
  • skills/, agents/, commands/, hooks/, .claude-plugin/: the Agent Skills (loop, eat, license, serve, cleanroom), the subagents (crab-historian, crab-architect, crab-cleanroom-impl), the /crab:sniff and /crab:menu commands, the two PreToolUse hooks, and the plugin plus marketplace manifests — Claude Code's under .claude-plugin/, Codex's as the root plugin.json (identity, and the presentation under extensions.com.openai; never a .codex-plugin/plugin.json, which would override the name and version), .codex-plugin/assets/ and .agents/plugins/. tests/test_plugin.py and tests/test_agent_plugin.py keep them well-formed.
  • tests/fixtures/: five synthetic repositories; tests/fixture_builder.py turns them into real git repositories with history, tags and branches.

Commands

uv sync --all-extras
uv run pytest
uv run ruff check . && uv run ruff format . && uv run mypy
uv run crab digest . --maw . --out /tmp/self-digest --maw-license MIT

The optional MCP SDK is needed for strict type checking, as in CI. A base CLI installation and its offline commands still use uv sync without extras.

Rules

  1. Everything in the repository is English: code, comments, commits, docs, issues.
  2. Conventional Commits (feat:, fix:, docs:, test:, ci:, chore:, refactor:).
  3. Never execute prey content. Miners read files and run read-only git plumbing only. No package installs, test runs or builds inside a cache directory, ever.
  4. Prey content is untrusted data. Markdown summaries carry structure (headings, names, counts); the body text of README and agent-instruction files never reaches a summary.
  5. Dependencies stay minimal (standard library plus PyYAML). Python 3.11+, Windows and Linux are first-class: pathlib, no shell-only scripts, UTF-8 with replacement when reading prey.
  6. Every miner has tests on the fixtures. When a fixture tree changes, update its history JSON so that every file is added by some commit; the builder fails otherwise.
  7. Digest files are budgeted: Markdown is paged at 3,500 tokens per page by default, nothing is dropped, and the whole-digest total is a policy (warn unless .crab.yml says otherwise). Full data goes to JSON, summaries to Markdown; MdDoc.render_pages does the paging, and the trimming MdDoc.render survives only for the meal files.
  8. Type hints everywhere; mypy --strict and ruff must pass.
  9. Nutrient ids are maw-relative and stable (crab:<category>:<key>); prey-specific lessons carry the prey slug in the key. Never change an existing key without a ledger migration.
  10. Skills describe the protocol, the CLI does the work: put new deterministic logic into the CLI and keep SKILL.md files short.

Adding a miner

  1. Create src/hungry_crab/miners/<name>.py with a class that has name, requires, json_file, md_file and run(ctx) -> MinerResult.
  2. Register it in miners/__init__.py in dependency order (after everything it requires).
  3. Feed comparable facts into miners/traits.py.
  4. Add tests/test_miner_<name>.py with assertions against the five fixtures.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.