agentleFS
syv-aisyv-ai/rulecast/AGENTS.md

rulecast

AGENTS.md2 starsChanged 32 days agoMITView on GitHub

rulecast delivers a project's conventions to coding agents while they work. It runs as agent hooks: when an edit breaks a rule, the agent gets the finding and the doc section the rule cites in the same turn. Runs from CLI for git hooks and CI too. To run CLI from source: packages/rulecast/node_modules/.bin/tsx packages/rulecast/src/cli.ts <command>. Docs site (packages/site, Astro Starlight, private): CI checks each of these with --check: Every hook invocation is a fresh process, with no daemon. Each event…

  • 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,774 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 repository2 other files it gives its agents.

The file

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

1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Every hook invocation is a fresh process, with no daemon.

    line 44

≈ “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

AGENTS.md

rulecast delivers a project's conventions to coding agents while they work. It runs as agent hooks: when an edit breaks a rule, the agent gets the finding and the doc section the rule cites in the same turn. Runs from CLI for git hooks and CI too.

Commands

All standard pnpm commands, like install, build etc.
pnpm perf               # edit-hook latency budget (p95 < 500 ms)
pnpm binary             # standalone binary with bun

To run CLI from source: packages/rulecast/node_modules/.bin/tsx packages/rulecast/src/cli.ts <command>.

Docs site (packages/site, Astro Starlight, private):

pnpm --filter @syv-ai/rulecast-site dev     # or build / preview / test / typecheck

Generated files: regenerate, never hand-edit

CI checks each of these with --check:

  • pnpm manifest → .rulecast-rules.yaml, the catalog manifest built from packages/rules-*/rules.yaml.
  • pnpm lenses → agents/lenses/, the pages agents read from the lens catalog in packages/lenses/ (it validates the catalog first).
  • pnpm readme → packages/rulecast/README.md and LICENSE, mirrored from the root ones. Edit the root README.md, then run this.
  • pnpm sync-version → packages/rulecast/src/core/version.ts from package.json.

Git hooks

  • pre-commit (lefthook) runs biome with --write on staged files, then rulecast on its own staged files, then typecheck. The repository's own rules are in .rulecast-config.yaml.
  • pre-push runs pnpm test.

Releases

  • Releases go through changesets: pnpm changeset, then pick @syv-ai/rulecast. On main, release.yml opens the version PR. When that is merged it publishes to npm, tags vX.Y.Z, cuts the GitHub Release, and then calls binaries.yml and pages.yml.
  • Tags must be bare vX.Y.Z. The repository is also a rule repo, resolved by tag.

Architecture

CLI package (packages/rulecast/src)

Every hook invocation is a fresh process, with no daemon. Each event flows through core/pipeline.ts. See CLI --help for overview.

Where things live:

  • adapters/ knows about one agent each (claude-code, cli). The core is agent-neutral: shell and session-start events are mapped by the adapter, but the working-tree comparison and the sweep live in core/session/tree.ts.
  • detectors/ holds regex, path, ast-grep, command, hook (pre-commit and lefthook hooks), linter (ruff, oxlint, eslint, gitleaks) and llm. Tool output is read in one place, core/detection/outputs/.
  • testing/ holds the exported detector and adapter contract suites.
  • commands/ has one file per CLI command. init/ is the interactive setup.
  • Catalog rules live in packages/rules-general, rules-loop-safety and rules-python, each with rules.yaml and the docs its rules cite.
  • agents/ holds docs written for coding agents (SETUP.md, DRAFT-RULES.md, reference/). URLs to them are pinned to a tag, never to main; a test enforces this.

Tests sit under packages/rulecast/test/ and mirror src/. Renderer and baseline behaviour is pinned by golden corpora in test/goldens/; recorded agent payloads are in test/payloads/.

Docs site (packages/site)

Pages are generated at build time from README.md and agents/ (scripts/sources.ts maps README sections)

Conventions

None are written down yet. They are being settled with the developer through agents/CONVENTIONS.md (plan 14); until then .rulecast-config.yaml has no rules.

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.