agentleFS
trac3r00trac3r00/agent-skills/skills/session-rules/SKILL.md

session-rules

Skill0 starsChanged 3 months agoMITView on GitHub

Generates a RULE.md from a project's AI-session history by extracting every moment the human corrected the agent — "no, never use jwt", "always run tests first", "we use sessions not tokens". The highest-leverage context file a project can have is the one built from its own history of mistakes. Reads Claude Code, Codex, and OpenCode stores (same conventions as session-handoff), fully offline.

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 4 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Every project accumulates "the agent did X wrong, we told it Y" moments.

    line 14
  2. Distinctive:

    Run it after a session where you corrected the agent more than once.

    line 40
  3. Distinctive:

    Read the generated RULE.md.

    line 41
  4. Distinctive:

    Commit RULE.md to the repo root.

    line 42

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill 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
SKILL.md

Session Rules

Every project accumulates "the agent did X wrong, we told it Y" moments. Those corrections are project law. This turns them from session chatter into a RULE.md every future session reads first.

Commands

python3 scripts/session_rules.py --cwd /path/to/project
python3 scripts/session_rules.py --cwd . --since 90 --out RULE.md
python3 scripts/session_rules.py --cwd . --json

What it extracts

User turns carrying correction signals:

  • "no, never do X" / "don't do that again"
  • "we use Y not Z" / "we prefer X"
  • "always run X first" / "you should always"
  • "stop doing X" / "that's wrong"

Each rule keeps the sentence containing the correction plus the full user turn as evidence. Review the output before committing — extraction is a draft, corrections are law.

Workflow

  1. Run it after a session where you corrected the agent more than once.
  2. Read the generated RULE.md; delete false positives, sharpen wording.
  3. Commit RULE.md to the repo root.
  4. Point future agent sessions at it (AGENTS.md, system prompt, or just @RULE.md in the first message).

Pairs with

session-handoff (the full session briefing when switching clients), open-loops (unresolved commitments from the same sessions).

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.