pi-harness
AGENTS.md9 starsChanged 3 months agoMITView on GitHub
1. grep -r "@earendil" core/ MUST return empty — core has no pi dependency. 2. Total constant token injection (meta-principles + doctrine + tool descriptions) MUST stay < 1000 tokens. Current full-corpus proxy: 369 words / 2633 UTF-8 bytes, conservative estimate ≤878 tokens. 3. Context is never silently truncated. Full knowledge indexes and participating Board notes are injected; same-project open topics are discovered at each user-turn boundary and feed state is isolated by session. At an estimated 20% of the…
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 repository29 other files it gives its agents.
- analyze-failuresSkill
- anti-debugging-techniquesSkill
- anti-drift-disciplineSkill
- binary-protection-bypassSkill
- code-obfuscation-deobfuscationSkill
- distillSkill
- dwarf-expertSkill
- emulation-reSkill
- find-skillsSkill
- ida-mcpSkill
- code-reviewSkill
- diagnosing-bugsSkill
- domain-modelingSkill
- implementSkill
- prototypeSkill
- researchSkill
- resolving-merge-conflictsSkill
- tddSkill
- to-specSkill
- writing-great-skillsSkill
- mobile-dynamic-reSkill
- native-static-reSkill
- physarumSkill
- re-escalationSkill
- re-routerSkill
- stormSkill
- symbolic-execution-toolsSkill
- vm-and-bytecode-reverseSkill
- web-reverse-engineeringSkill
The file
We split this AGENTS.md into the rules it gives an agent
5 rules. About 0 are common, 2 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 29
All architectural decisions documented in docs/decisions/ (10-line ADR format).
- Very specific: line 58
Import @earendil-works/* in core/ (runtime-agnostic boundary)
- Distinctive: line 59
Create knowledge/handoff stores outside ADR-0014's selected fixed roots
- Distinctive: line 62
Add embeddings, vector DB, or auto-memory systems (ADR-0002)
- Very specific: line 68
File-first: All state is cat-inspectable files, no black boxes
≈ “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.
Files
PI-Harness — Agent Instructions
Architecture
core/— Pure Node.js library, runtime-agnostic. ZERO imports from@earendil-works/*or any pi package.extensions/— Thin adapter layer. ONLY place that touches pi Extension API (pi.on(),pi.registerTool()).skills/— Markdown workflow guides (SKILL.md with YAML frontmatter). Loaded by pi on demand.prompts/— Constant prompt templates injected into systemPrompt viaextensions/doctrine.ts.knowledge/— Long-term memory in three fixed tiers (ADR-0014): current subproject at<project-root>/knowledge/(default), shared repo at<workspace-root>/knowledge/, cross-workspace at~/.pi-harness/knowledge/. Auto-created on write only.handoff/— Session handoffs live at<project-root>/handoff/only.agents/— Role cards (JSON) for spawn subagents.
Core Invariants
grep -r "@earendil" core/MUST return empty — core has no pi dependency.- Total constant token injection (meta-principles + doctrine + tool descriptions) MUST stay < 1000 tokens. Current full-corpus proxy: 369 words / 2633 UTF-8 bytes, conservative estimate ≤878 tokens.
- Context is never silently truncated. Full knowledge indexes and participating Board notes are injected;
same-project open topics are discovered at each user-turn boundary and feed state is isolated by session.
At an estimated 20% of the active model window, runtime emits one warning and preserves all content (ADR-0012).
Passive references freeze per user turn and exact bytes persist in
.pi-board/context-snapshots/; CRITICAL notes become visible, provenance-bearing messages instead of hidden references (ADR-0013). Completed raw thinking is the sole exception: it stays intact in session JSONL for audit but is removed from later provider epochs and summarizer inputs; all durable evidence remains complete (ADR-0021). - Board storage:
.pi-board/(project-local, append-only JSONL + markdown snapshots). - Fixed placement (ADR-0014): project knowledge ONLY at the pi session root, workspace knowledge ONLY at the
nearest Git root, global knowledge ONLY under
~/.pi-harness/; context deduplicates identical roots and never scans sibling subprojects. Handoffs stay at the session project root. Paths may not escape or traverse symlinks. - All architectural decisions documented in
docs/decisions/(10-line ADR format). - Anti-drift discipline is enforced by
extensions/anti-drift.tsat runtime. The hook ONLY warns on tool calls identical to the immediately previous one (operator-visible via stderr + events.jsonl). It does NOT inject into model context, count steps/tokens, or auto-escalate to any strict mode. The 4-rule prompt is always-on judgment guidance; the full reference skill loads only on description match. - Reasoning epochs are proactive capacity boundaries, not drift detectors: default 32K reasoning tokens, one protocol-valid bridge for the just-finished tool call, then no completed scratchpad/signature replay (ADR-0021).
Development Commands
npm test # Run tests (node:test)
node --experimental-strip-types --check <file>.ts # Syntax check single file
grep -r "@earendil" core/ # Verify core isolation (must be empty)
pi install ./ -l --approve # Install locally for testing
pi -p --approve "<prompt>" # Non-interactive test runWhen Adding Features
- New hook → Write ADR in
docs/decisions/first (background, decision, rationale, ≤10 lines) - New tool → Single tool with action parameter preferred (HANDOFF §2.6: "最少工具")
- New skill →
skills/<name>/SKILL.mdwith YAML frontmatterdescriptionfield - New knowledge entry → MUST include
来源: <source-link>(traceability enforced by code); scope=project writes current subproject, scope=workspace writes the shared Git root, scope=global writes home
Do NOT
- Modify
HANDOFF.md(read-only design authority) - Import
@earendil-works/*incore/(runtime-agnostic boundary) - Create knowledge/handoff stores outside ADR-0014's selected fixed roots
- Silently truncate knowledge, Board notes, archived summaries, subagent output, or diagnostic evidence (ADR-0012)
- Push constant token injection above 1000 tokens total
- Add embeddings, vector DB, or auto-memory systems (ADR-0002)
- Bundle third-party pi packages (ADR-0000)
- Force push or commit secrets/tokens
Key Design Principles
- File-first: All state is
cat-inspectable files, no black boxes - Judgment for LLM, constraints for code: Hooks enforce hard invariants; prompts guide judgment calls
- Thin extensions: Logic lives in
core/, extensions only do registration + wiring
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
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.

