Skip to content

context-files

Supplements pi’s native context file loading so that both CLAUDE.md and AGENTS.md are loaded when they coexist in the same directory, and context files in subdirectories are picked up too.

It also loads modular rule files from .tallow/rules/, .claude/rules/, and ~/.tallow/rules/.

Pi loads AGENTS.md or CLAUDE.md per directory, preferring AGENTS.md. If both exist, CLAUDE.md is silently ignored. Pi also only walks up from cwd, it never scans subdirectories.

This is a problem when:

  • Your team maintains both files (e.g. AGENTS.md for all agents, CLAUDE.md for Claude-specific guidance)
  • Subdirectories have their own context files (monorepo packages, service directories)
  • You want reusable modular rules in .tallow/rules/ or .claude/rules/
SourcePi loadsExtension adds
~/.tallow/AGENTS.mdCLAUDE.md (if both exist)
Ancestor dirs → cwdOne file per dirThe other file that was skipped
SubdirectoriesNothingBoth CLAUDE.md and AGENTS.md
Rules directoriesNothing.md/.txt rules from ~/.tallow/rules/, .tallow/rules/, .claude/rules/, and nested subdirectory rule dirs

Rule files are portable across both project conventions:

  • .tallow/rules/ (tallow-native)
  • .claude/rules/ (Claude Code compatibility)
  • ~/.tallow/rules/ (user-global defaults)

The same rule file frontmatter works in .tallow/rules/ and .claude/rules/.

Rules support two equivalent frontmatter variants:

  • paths: array of one or more glob patterns
  • path: single-pattern shorthand (Claude-compatible)

Activation semantics:

  • No path/paths frontmatter → rule is unconditional and always injected
  • path or paths frontmatter → rule activates only when the agent reads, edits, or writes at least one matching file path

Example (paths):

---
paths:
- "src/api/**/*.ts"
- "src/middleware/**/*.ts"
---
# API Rules
- Validate input with Zod
- Use standard error envelope

Example (path):

---
path: "apps/web/**/*.tsx"
---
# Frontend Rules
- Keep components server-first

Files are appended to the system prompt from most general to most specific:

  1. Global, ~/.tallow/CLAUDE.md
  2. Ancestors, farthest directory first, walking toward cwd
  3. Current directory, the skipped file in cwd
  4. Subdirectories, sorted by depth, then alphabetically
  5. Rules, from rule directories and nested subdirectory rule dirs

The extension skips common non-source directories when scanning subdirectories:

node_modules, .git, dist, build, .next, __pycache__, .venv, venv, vendor, .tox, .mypy_cache, .pytest_cache, coverage, .turbo, .cache, .output, and all dot-directories.

On load, a notification shows which extra files were found:

context-files: +1 context file: ~/dev/myproject/CLAUDE.md