Rulebook mined from history

The idea

Commits, PRs, reviews, tickets, tests, CI and code are mined into rule candidates with evidence and scope. Accepted rules become checks, tested first against past changes. A rule that catches nothing in 90 days goes to its author to retire or keep.

The problem
Each agent starts without the team's conventions, and rules pile up.
Why it matters
The worker follows how the team works now, and the rulebook stays small.
Where it stands
In production as of

A step-by-step replay of this idea is not published yet. The library adds one when a recorded run shows it.

  • Rules as checks

    A team rule that can be checked gets a checker for a pattern, a name, a structure, a command or a benchmark. The checker runs on the change before a pull request, on each push, before the worker finishes the task, and during verification.

  • Tier 0 index with details on demand

    The cached prefix holds an index of about 500 tokens: rules, memory notes and the profile, one line each, pinned at the first turn. Guidance files are quoted rules first within a budget, and whole items load only on demand.

  • Team pipeline profile and layered preferences

    Onboarding proposes how the team works (design first, test first, trunk, approvals, strict paths, stage shares), with a backtest over 30 merged PRs. Accepted settings resolve in layers, with the person's own layer on top.

  • State in the repository (.agents/)

    A repository's .agents/ folder holds rules, memory notes, task checks and summaries. It is shared through git and read back in.

  • Gate ledger

    A registry names each gate and the failure it prevents. From records, it counts how often the gate caught that failure and how often a person overruled it.

  • Code knowledge indexes for agents

    A code index at the level of signatures finds code in milliseconds. An Atlas profile, computed by code with no model, gives each repository's stack, commands, rules and module map.

  • Context contract per role

    Each model call carries only its role's layers, in a fixed order. People's messages enter as task state with their ids. Budgets are kept by folding and ranking, never by cutting the prefix.

Turn the numbers into shipped work.

Crewshal runs these choices for you: a persistent AI worker with memory and rules, on your Claude and Codex subscriptions.