Make CLAUDE.md a short router, and move each topic's rules to a file under rules/ that loads when a session touches a matching file
This commit is contained in:
@@ -3,14 +3,16 @@ import pathlib
|
||||
from loop_claude.project.text_file import read_utf8
|
||||
from loop_claude.stop import Stop
|
||||
|
||||
# The records: these project files and HUMAN_RULES; the judge reads them beside the README's premises.
|
||||
# The records: these project files and the human's rules; the judge reads them beside the README's premises.
|
||||
RECORD_FILES = ("AGENTS.md", "docs/decisions.md")
|
||||
HUMAN_RULES = "~/.claude/CLAUDE.md"
|
||||
HUMAN_RULES = ("~/.claude/CLAUDE.md", "~/.claude/rules/")
|
||||
|
||||
|
||||
def read_records(root: str, claude_md: pathlib.Path) -> str | Stop:
|
||||
"""The project's record files, then the human's rules for every project, each headed by its name; a file that does not exist is left out."""
|
||||
sources = [(root, name, name) for name in RECORD_FILES] + [(str(claude_md.parent), claude_md.name, HUMAN_RULES)]
|
||||
"""The project's record files, then the human's rules for every project, CLAUDE.md first, each headed by its name; a file that does not exist is left out."""
|
||||
rules = claude_md.parent / "rules"
|
||||
sources = [(root, name, name) for name in RECORD_FILES] + [(str(claude_md.parent), claude_md.name, HUMAN_RULES[0])]
|
||||
sources += [(str(rules), rule.name, HUMAN_RULES[1] + rule.name) for rule in sorted(rules.glob("*.md"))]
|
||||
records = []
|
||||
for folder, name, heading in sources:
|
||||
if not pathlib.Path(folder, name).exists():
|
||||
|
||||
Reference in New Issue
Block a user