Skip to content

feat: .agents/rules/ universal rules directory - #19

Merged
dean-harel merged 5 commits into
mainfrom
feat/agents-rules
May 2, 2026
Merged

feat: .agents/rules/ universal rules directory#19
dean-harel merged 5 commits into
mainfrom
feat/agents-rules

Conversation

@dean-harel

Copy link
Copy Markdown
Owner

Summary

Establishes .agents/rules/ as a universal rules directory consumed by both Claude Code and Pi, eliminating content duplication.

  • Moves voice.md from .claude/rules/ to .agents/rules/
  • Replaces .claude/rules/ with a symlink to .agents/rules/ so Claude Code discovers rules natively
  • Adds rules-loader Pi extension (~/.pi/agent/extensions/rules-loader/) that:
    • Discovers .agents/rules/ walking up from cwd (with ~/.agents/rules/ fallback)
    • Parses frontmatter for path-scoped rules
    • Records read/edit/write paths per turn
    • Injects a rule catalog + matching full-rule content into the system prompt on before_agent_start
    • One-shot injection: records clear on turn_end
  • Adds project-local copy of the extension at .pi/extensions/rules-loader/

Test Plan

  • Claude Code: open project, read file matching voice.md paths — rule auto-loads via symlink
  • Pi: start session in project, verify Loaded rules: voice.md (...) notification
  • Pi: read entries/drafts/*.md, verify rule content injected next turn
  • Pi: next turn without file access — only catalog present (one-shot verified)

dean-harel added 4 commits May 2, 2026 13:52
- Move voice.md from .claude/rules/ to .agents/rules/
- Replace .claude/rules/ with symlink to ../.agents/rules/
- Enables Claude Code native discovery + prepares for Pi extension
- Discovers .agents/rules/ walking up from cwd
- Parses frontmatter for path-scoped rules
- Records read/edit/write paths per turn
- Injects catalog + matching rule content into system prompt
- One-shot injection (turn_end clears recorded paths)
Array items under paths: (e.g. '- entries/drafts/**') have no colon,
so the old parser skipped them entirely. Now array items are detected
via trimmed.startsWith('- ') before the colon check, so multi-line
YAML arrays parse correctly.
@github-actions

github-actions Bot commented May 2, 2026

Copy link
Copy Markdown
Contributor

✅ All review checks passed. When you're ready, apply the ready label to publish.

A simple rule that triggers on README.md access and produces an
unambiguous output marker, making it easy to confirm injection
works in both Pi and Claude Code.
@github-actions

github-actions Bot commented May 2, 2026

Copy link
Copy Markdown
Contributor

✅ All review checks passed. When you're ready, apply the ready label to publish.

@dean-harel
dean-harel merged commit 5185a5e into main May 2, 2026
4 checks passed
@dean-harel
dean-harel deleted the feat/agents-rules branch May 2, 2026 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant