OwnPilot
AGENTS.md426 starsChanged 3 months agoMITView on GitHub
Privacy-first personal AI assistant platform. TypeScript monorepo with Turborepo. PostgreSQL via pg adapter. Repositories in packages/gateway/src/db/repositories/. Adapter abstraction in packages/gateway/src/db/adapters/. This project uses DFMT to keep large tool outputs from exhausting the context window. Read this section at the start of every conversation in this project. Always use DFMT's MCP tools when an output might exceed 2 KB: Include an intent argument on every call, describing what you need from the output. The intent lets DFMT return the relevant portion…
- Installs packages
We split this AGENTS.md into the rules it gives an agent
3 rules. About 0 are common, 1 is distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 59
All API responses use apiResponse/apiError helpers (standardized)
- Distinctive: line 73
Always use DFMT's MCP tools when an output might exceed 2 KB:
- Very specific: line 102
When the user states a preference or correction ("use X instead of Y", "do not modify Z"), call dfmt_remember with a decision tag so the …
≈ “Common” is an estimate: at least 1 in 5 of the 36,368 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
OwnPilot
Privacy-first personal AI assistant platform. TypeScript monorepo with Turborepo.
Architecture
packages/
core/ - Agent engine, tools, plugins, events, sandbox, privacy
gateway/ - Hono HTTP API server, routes, services, DB, channels, triggers, WebSocket
ui/ - React 19 + Vite + Tailwind frontend (55+ pages, code-split)
cli/ - Commander.js CLI (bot, config, start, workspace commands)Key Patterns
- Response helpers:
apiResponse(c, data, status?)andapiError(c, message, code, status)inpackages/gateway/src/routes/helpers.ts - Error codes:
ERROR_CODESconstants inpackages/gateway/src/routes/helpers.ts - Pagination:
parsePagination(c)andpaginatedResponse(c, items, total, page, limit)helpers - Event system: EventBus, HookBus, ScopedBus in
packages/core/src/events/ - Plugin system: PluginRegistry with isolation, marketplace, runtime in
packages/core/src/plugins/ - User Extensions: Native tool bundles (JS code, triggers, services) in
packages/gateway/src/services/extension/service.ts. DB table:user_extensions. API:/extensions - Skills (AgentSkills.io): Open standard SKILL.md format for agent instructions. Parser:
packages/gateway/src/services/skill/agentskills-parser.ts. Format field:'ownpilot' | 'agentskills' - Edge/IoT: MQTT broker (Mosquitto) integration for edge device management. Types:
packages/core/src/edge/. Service:packages/gateway/src/services/edge/service.ts. Routes:/api/v1/edge - Channels: Channel manager and Telegram/WhatsApp/Slack/Discord/Matrix plugins live under
packages/gateway/src/channels/ - Test framework: Vitest across all packages. The suite is large and changes frequently; use
node scripts/report-code-health.mjsfor current test-file counts andpnpm run testfor authoritative pass counts.
Commands
pnpm install # Install dependencies
pnpm run test # Run all tests (turbo)
pnpm run build # Build all packages
pnpm run dev # Dev mode with hot reload
pnpm run lint # ESLint check
pnpm run lint:fix # ESLint auto-fix
pnpm run format # Prettier format
pnpm run typecheck # TypeScript type checkingTech Stack
- Runtime: Node.js 22+, pnpm 10+
- Language: TypeScript 5.9
- Server: Hono 4.x
- Frontend: React 19, Vite 7, Tailwind CSS 4
- Testing: Vitest 4.x
- Build: Turborepo 2.x
- Linting: ESLint 10 (flat config), Prettier
Database
PostgreSQL via pg adapter. Repositories in packages/gateway/src/db/repositories/. Adapter abstraction in packages/gateway/src/db/adapters/.
Conventions
- Barrel exports via
index.tsin each module - Route files return Hono app instances
- All API responses use
apiResponse/apiErrorhelpers (standardized) - Tests colocated with source (
*.test.ts) - Unused variables prefixed with
_(ESLint convention)
<!-- dfmt:v1 begin -->Context Discipline — REQUIRED
This project uses DFMT to keep large tool outputs from exhausting the context window. Read this section at the start of every conversation in this project.
Rule 1 — Prefer DFMT tools over native tools
Always use DFMT's MCP tools when an output might exceed 2 KB:
| Native | DFMT replacement |
Bash | dfmt_exec |
Read | dfmt_read |
WebFetch | dfmt_fetch |
Glob | dfmt_glob |
Grep | dfmt_grep |
Edit | dfmt_edit |
Write | dfmt_write |
Include an intent argument on every call, describing what you need
from the output. The intent lets DFMT return the relevant portion of
a large output without flooding the context.
Rule 2 — On DFMT failure, report and fall back
DFMT is a strong preference, not a hard dependency. If a dfmt_* tool
errors, times out, or is unavailable, report the failure to the user
(one short line — which call, what error) and continue with the native
equivalent so the session is not blocked. The ban is on silent
fallback — every switch must be announced. After a fallback, drop a
brief dfmt_remember note tagged gap when practical. If the native
tool is also denied (permission rule, sandbox refusal), stop and ask
the user; do not retry blindly.
Rule 3 — Record user decisions
When the user states a preference or correction ("use X instead of Y",
"do not modify Z"), call dfmt_remember with a decision tag so the
choice survives context compaction.
Why these rules matter
Some agents do not provide hooks to enforce these rules automatically. Compliance is your responsibility as the agent. A single raw shell output above 8 KB can push earlier context out of the window, erasing the conversation's history. Following the rules above preserves it.
<!-- dfmt:v1 end -->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 28,693 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 repository3 other files it gives its agents.
- docs/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
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
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.

