agentleFS
lucapohl-angellucapohl-angel/ATLAS_OS/AGENTS.md

ATLAS_OS

AGENTS.md68 starsChanged 7 months agoMITView on GitHub

Guidance for AI agents (Codex CLI, Claude Code, Atlas itself, anything else) working on this repository. The reader of this file is assumed to know nothing about the project. Atlas·OS is a multi-agent, hook-driven, model-agnostic engineering CLI for the terminal. A "crew" of specialist agents (Greek gods — Athena, Prometheus, Hercules, Nemesis, Iris, etc.) handle different phases of the software lifecycle: planning, architecture, story splitting, implementation, QA, and release. - Multi-agent: exactly one agent is active at a time; the…

  • Reads credentials
  • Deletes or force-pushes
  • Commits and pushes
  • Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.

    Of the AGENTS.md files we read, the 11,773 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 repositoryOne other file it gives its agents.

The file

Show its rules and text

We split this AGENTS.md into the rules it gives an agent

27 rules. About 0 are common, 10 are distinctive, and 17 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈10

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 17

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    If you only have time for two files, read 1 and 5.

    line 47
  2. Very specific:

    No any: Use unknown and narrow with Zod or typeof/in guards.

    line 206
  3. Very specific:

    Import specifiers use the .js suffix even when the source is .ts: import { foo } from './bar.js'.

    line 223
  4. Very specific:

    Test files sit beside source: foo.ts → foo.test.ts.

    line 231
  5. Very specific:

    Check signal.aborted at the top of long loops and after every awaited boundary.

    line 243
  6. Very specific:

    Use atlasError(code, message, { cause, context }).

    line 247
  7. Very specific:

    Every tool exports a Tool<Input> with: name, description, approval mode, Zod schema, whenToUse, outputContract, blockedOps, examples, and …

    line 256
  8. Very specific:

    Use mkdtemp + tmpdir for FS tests.

    line 289
  9. Very specific:

    Test the failure paths. Every Result-returning function should have at least one expect(r.ok).toBe(false) test.

    line 290
  10. Very specific:

    Approval gating: all mutating tools require explicit user approval (ask) unless the user has overridden the mode.

    line 309
  11. Very specific:

    No any: All boundaries narrow to typed values via Zod or explicit unknown + guards.

    line 338
  12. Very specific:

    Cancellation everywhere: Every async path that can take more than ~100 ms accepts and propagates an AbortSignal.

    line 340
  13. Very specific:

    Read context/project-overview.md, ARCHITECTURE.md, context/code-standards.md, context/ai-workflow-rules.md, and context/progress-tracker.md …

    line 367
  14. Very specific:

    If the task touches a file in packages/, read the closest *.test.ts next to it before changing the source.

    line 369
  15. Distinctive:

    Do not combine unrelated concerns in a single commit.

    line 377
  16. Distinctive:

    Do not refactor adjacent code "while you're there".

    line 379
  17. Distinctive:

    Do not add helpers, abstractions, or "improvements" beyond what the task requires.

    line 380
  18. Distinctive:

    Do not add docstrings, comments, or type annotations to code you did not change.

    line 381
  19. Distinctive:

    No invariant was violated.

    line 396
  20. Distinctive:

    Commit message describes the *what* and *why*, not the *how*.

    line 398
  21. Very specific:

    No new any, no thrown control-flow exceptions, no async path without an AbortSignal parameter.

    line 399
  22. Distinctive:

    If the change completes a phase, flip its row in the README phase table and append a CHANGELOG entry.

    line 406
  23. Very specific:

    If the change introduces a new invariant or convention, also update ARCHITECTURE.md or code-standards.md in the same commit.

    line 408
  24. Distinctive:

    Do not modify the following without an explicit user request:

    line 413
  25. Very specific:

    Never bypass safety checks.

    line 430
  26. Very specific:

    No shell-level backgrounding (&, nohup, disown) inside scripts the agent spawns.

    line 432
  27. Distinctive:

    Update the relevant context file in the same commit as the change:

    line 439

≈ “Common” is an estimate: at least 1 in 5 of the 16,595 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

AGENTS.md

Guidance for AI agents (Codex CLI, Claude Code, Atlas itself, anything else) working on this repository. The reader of this file is assumed to know nothing about the project.

What this project is

Atlas·OS is a multi-agent, hook-driven, model-agnostic engineering CLI for the terminal. A "crew" of specialist agents (Greek gods — Athena, Prometheus, Hercules, Nemesis, Iris, etc.) handle different phases of the software lifecycle: planning, architecture, story splitting, implementation, QA, and release.

  • Multi-agent: exactly one agent is active at a time; the Orchestrator picks based on detected project state.
  • Hook-driven: typed lifecycle events (beforeTool, afterTool, etc.) with real blocking semantics so guardrails are enforced, not suggested.
  • Model-agnostic: OpenRouter is the default. Anthropic, OpenAI, OpenCode Zen/Go, and local models (Ollama, LM Studio, vLLM, llama.cpp) are also supported.
  • Skill-extensible: on-demand skills loaded by the active agent when triggered by context.
  • Spec-driven delivery (SDD): built-in templates, checklists, workflows, and stories that drive a repeatable planning-to-ship pipeline.

The project is an MIT-licensed npm package (atlas-os) with an optional native binary per platform, plus a VS Code extension (atlas-os-vscode).


Read these first (in order)

  1. context/project-overview.md — what Atlas is, the user flow, in/out of scope, success criteria.
  2. ARCHITECTURE.md — engine layout, SDD pipeline, core concepts (agents, skills, hooks, tools, providers, orchestrator, sessions, context window manager), and the Invariants section (rules the codebase must always satisfy).
  3. context/code-standards.md — strict TS, ESM, Result, Zod, tool contract, testing conventions.
  4. context/ai-workflow-rules.md — scoping, splitting, protected files, verification gates, doc-update rules.
  5. context/progress-tracker.md — current phase, in-progress work, open questions, recent decisions.
  6. README.md — quickstart and phase tables.

If you only have time for two files, read 1 and 5.


Technology stack

LayerChoice
RuntimeNode.js 20+ (ESM)
LanguageTypeScript 5.8+ in strict mode
Package managerpnpm 10.33.2 (monorepo workspace)
Module systemESM only ("type": "module")
UI frameworkReact 19 + OpenTUI (@opentui/core / @opentui/react)
CLI frameworkCommander.js
ValidationZod (every I/O boundary)
TestingVitest
LoggingPino (stderr)
Bundlingesbuild (CLI + VS Code extension), Vite (VS Code webview)
Native binariesBun build --compile (cross-compiled from Linux)
Config formatYAML (~/.atlas/config.yaml)

Project structure

atlas-cli/
├── packages/
│   ├── core/        @atlas/core — engine (providers, tools, hooks, skills,
│   │                agents, orchestrator, session, context, MCP, templates,
│   │                checklists, workflows, stories, builtins, protocol, loop)
│   ├── cli/         atlas-os — bin entry, REPL, command parsing, TUI,
│   │                slash commands, transcript, update notice, launcher
│   ├── vscode/      atlas-os-vscode — VS Code extension host, side-bar webview,
│   │                bridge, session host, VS Code-native tool adapters
│   └── binaries/    per-platform npm packages that ship a Bun-compiled
│                    `atlas` executable. Built by scripts/build-binaries.mjs.
│                    Published as optionalDependencies of atlas-os.
├── scripts/
│   ├── build-binaries.mjs   bun build --compile per target (linux-x64,
│   │                        linux-arm64, darwin-x64, darwin-arm64, win32-x64)
│   ├── lint.mjs             repo text hygiene (trailing whitespace, merge
│   │                        conflict markers) + per-package tsc --noEmit
│   └── require-pnpm.mjs     preinstall guard enforcing pnpm
├── .github/workflows/
│   ├── ci.yml               push/PR gate: build, typecheck, test:run, lint
│   ├── release.yml          tag-triggered cross-compile + opt-in npm publish
│   └── vscode-extension.yml tag-triggered VSIX build + opt-in Marketplace publish
├── context/                 project-level context docs (this is dogfooding)
├── tsconfig.base.json       shared strict TS config (incl. noUncheckedIndexedAccess,
│                            verbatimModuleSyntax)
└── pnpm-workspace.yaml      packages/* + packages/binaries/*

Package split rationale

@atlas/core is the headless engine. It can be embedded in non-CLI hosts (web UIs, VS Code extensions, MCP servers) without dragging in TUI dependencies. atlas-os is the terminal-facing CLI. atlas-os-vscode is the VS Code extension host.

Source file layout (key modules)

packages/core/src/
├── index.ts          public barrel (stable API surface)
├── result.ts         Result<T, E> — explicit success/failure
├── errors.ts         AtlasError + stable error codes
├── logger.ts         Pino logger
├── version.ts        read from package.json (injected at bundle time)
├── config/           ~/.atlas/config.yaml load/save
├── providers/        OpenRouter / Anthropic / OpenAI / Codex / local / OpenCode
├── tools/            read_file, write_file, edit_file, terminal, search, …
├── hooks/            registry, runner, types, built-in guardrails
├── skills/           loader, parser, resolver
├── agents/           loader, parser, persona injection
├── orchestrator/     project state detector, transition decisions
├── session/          manager, audit log, resume
├── context/          token counting, compaction
├── mcp/              MCP client (stdio + HTTP)
├── templates/        Handlebars-over-YAML document generator
├── checklists/       gate review engine
├── workflows/        declarative routing table (chains.yaml)
├── stories/          mixed-mode authorization for story files
├── workflow/         executor, router, phase prompts, signals, waves
├── builtins/         built-in agents, templates, checklists, workflows
├── protocol/         interaction format
└── security/         URL safety

packages/cli/src/
├── index.ts          barrel for embedding hosts
├── app.ts            Commander program
├── bin/atlas.ts      bin entry, top-level error boundary
├── repl/             REPL logic
├── commands/         slash commands and subcommands (ask, init, status, vscode-setup, …)
└── tui/              OpenTUI components, transcript, update notice, learn, exit splash

packages/vscode/src/
├── extension.ts      activation entry
├── bridge.ts         webview <-> extension host message bridge
├── session-host.ts   local Atlas core turn runner
├── config-store.ts   VS Code settings + SecretStorage adapter
├── model-catalog.ts  model picker data
├── approval-broker.ts modal approval UI
├── tools/            VS Code-native tool adapters (fs, edit, terminal, approval)
└── ui/               webview React app (built by Vite)

Build and test commands

Full quality gate (run this before declaring any task done)

pnpm --filter @atlas/core build
pnpm --filter @atlas/core test:run
pnpm --filter atlas-os typecheck
pnpm --filter atlas-os test:run
pnpm --filter atlas-os build
pnpm --filter atlas-os-vscode typecheck
pnpm --filter atlas-os-vscode test:run
pnpm --filter atlas-os-vscode build
pnpm lint

Per-package commands

PackageBuildTest (watch)Test (CI)TypecheckLint
@atlas/corepnpm --filter @atlas/core buildpnpm --filter @atlas/core testpnpm --filter @atlas/core test:runpnpm --filter @atlas/core typecheckpnpm --filter @atlas/core lint
atlas-ospnpm --filter atlas-os buildpnpm --filter atlas-os testpnpm --filter atlas-os test:runpnpm --filter atlas-os typecheckpnpm --filter atlas-os lint
atlas-os-vscodepnpm --filter atlas-os-vscode buildpnpm --filter atlas-os-vscode testpnpm --filter atlas-os-vscode test:runpnpm --filter atlas-os-vscode typecheckpnpm --filter atlas-os-vscode lint
Workspace rootpnpm build—pnpm test:runpnpm typecheckpnpm lint

What the commands do

  • build (@atlas/core): tsc -p tsconfig.build.json — declaration emit + JS.
  • build (atlas-os): builds @atlas/core first, then tsc --noEmit + esbuild bundle (scripts/bundle.mjs) producing dist/launcher.mjs, dist/bin/atlas.js, and dist/index.js.
  • build (atlas-os-vscode): builds @atlas/core first, then esbuild for the extension host + Vite for the webview.
  • test / test:run: Vitest. Tests must run without network access.
  • typecheck / lint: tsc --noEmit.
  • pnpm lint (root): runs scripts/lint.mjs which checks all tracked text files for trailing whitespace and unresolved merge-conflict markers, then runs each package's lint script.

Code style guidelines

These are enforced, not aspirational.

TypeScript

  • Strict mode is mandatory. strict, noUncheckedIndexedAccess, verbatimModuleSyntax, exactOptionalPropertyTypes are non-negotiable.
  • No any. Use unknown and narrow with Zod or typeof/in guards. If you genuinely need any, leave a one-line comment naming the bug-or-third-party reason.
  • No exceptions for control flow. Return Result<T, AtlasError> from @atlas/core/result. Throw only for programmer errors (impossible-state assertions). External calls that throw are caught and converted at the boundary.
  • Validate at I/O boundaries. Provider responses, tool inputs, config files, MCP messages — every byte that crosses a process boundary goes through Zod before business code touches it.
  • readonly and immutable updates by default. Mutate only inside the function that owns the value.
  • as const for literal types and discriminated unions. Prefer discriminated unions over enums.

ESM

  • "type": "module" everywhere.
  • Import specifiers use the .js suffix even when the source is .ts: import { foo } from './bar.js'. verbatimModuleSyntax will not rewrite them.
  • import type { … } for type-only imports.
  • Named exports only. No default exports.

File layout + naming

  • File names: kebab-case.ts.
  • Test files sit beside source: foo.ts → foo.test.ts. No __tests__/ folders.
  • Type names: PascalCase.
  • Functions / variables / constants: camelCase.
  • Module-level constants that are genuinely constant: SCREAMING_SNAKE (rare).
  • One public concept per file. Helpers with no callers outside the module stay un-exported.

Async + cancellation

  • Every async path that can take more than ~100 ms accepts an AbortSignal and propagates it down. Provider streams, tool execute, hooks, MCP calls, terminal child processes — all share one AbortController per turn.
  • Check signal.aborted at the top of long loops and after every awaited boundary.

Errors + logging

  • Use atlasError(code, message, { cause, context }). New codes go in packages/core/src/errors.ts with a doc comment.
  • Result.err(atlasError(...)) over throwing. Callers pattern-match.
  • Pino via @atlas/core/logger and childLogger({ component: 'foo' }). Logs go to stderr so streaming output stays clean. Default level is info; debug is opt-in via ATLAS_LOG=debug.

Tools (built-ins)

Every tool exports a Tool<Input> with: name, description, approval mode, Zod schema, whenToUse, outputContract, blockedOps, examples, and execute. All seven metadata fields are required.

  • The summary field is the only thing that reaches the model. Bulk content (file text, HTTP body, stdout/stderr) goes in data.*. Summaries are head+tail truncated via truncate.ts; the agent loop enforces a 32 KB hard backstop.
  • Auto-approval is the default for read-only tools. Anything that mutates the workspace is approval: 'ask'. Network egress is approval: 'auto' only for SSRF-guarded paths.
  • Path safety: relative paths resolve against ctx.cwd. Reject any resolved path whose relative(cwd, abs) starts with ...

Providers

  • Implement the Provider interface from providers/types.ts.
  • Stream events are typed (delta / tool_call* / thinking / done / error); never invent event shapes.
  • Token usage merges via mergeUsage, never spread-overwrite. Partial usage payloads carry only the fields they update.
  • Prompt-cache markers go on stable, large content (system prompt, last static tool spec) — never on dynamic per-turn content.

Testing instructions

  • Framework: Vitest.
  • One test file per source file: foo.ts → foo.test.ts.
  • No network in tests. Mock providers explicitly with the patterns in providers/openrouter.test.ts.
  • Behavior, not implementation. Assert on observable output, not internal state. No snapshot tests of randomly-ordered structures.
  • Use mkdtemp + tmpdir for FS tests; clean up via afterEach.
  • Test the failure paths. Every Result-returning function should have at least one expect(r.ok).toBe(false) test.

Security considerations

  • No secrets in code. API keys come from ~/.atlas/config.yaml or environment variables. Never commit a key, never echo a key to a log line.
  • Path safety is enforced by the path-safety hook and by individual tools: reject paths outside ctx.cwd, .git, .env, ~/.ssh, and similar.
  • Secret redaction is a built-in hook that scrubs API keys, tokens, and private keys from tool output before it reaches the model.
  • Dangerous command blocking is a built-in hook that blocks obviously destructive shell and git commands.
  • Prompt injection detection flags prompt-injection markers found in tool output.
  • URL safety (security/url-safety.ts) blocks SSRF and unsafe outbound requests.
  • Approval gating: all mutating tools require explicit user approval (ask) unless the user has overridden the mode.

Distribution model

atlas-os ships a tiny launcher (packages/cli/src/launcher.mjs) as its npm bin. At runtime the launcher tries the matching atlas-os-<platform>-<arch> optional-dep package and execs the embedded bin/atlas binary. If that package isn't installed (unsupported platform, partial publish, or --ignore-optional), it falls back to running the bundled JS at dist/bin/atlas.js under Node.

Releases are cut by pushing a vX.Y.Z tag. .github/workflows/release.yml cross-compiles all 5 binaries from a single Linux runner with Bun, then uploads artifacts. Publishing to npm is opt-in only (manual workflow dispatch with publish=true). Platform packages are published first so the dispatcher's optional-dep version is already resolvable when it goes live.

The VS Code extension is built and published via .github/workflows/vscode-extension.yml (also opt-in).


Hard rules (invariants)

These are the rules the codebase must always satisfy. If you find code that breaks one of these, the code is wrong — not the rule.

  1. No any. All boundaries narrow to typed values via Zod or explicit unknown + guards. Strict TypeScript settings are non-negotiable.
  2. Cancellation everywhere. Every async path that can take more than ~100 ms accepts and propagates an AbortSignal.
  3. Tool summary is the only field that reaches the model. Bulk content goes in data.*. Summaries are head+tail truncated; the agent loop enforces a 32 KB hard backstop.
  4. Prompt-cache markers go on the last static block. Anthropic cache_control is set on the system prompt and on the last static tool spec — never on per-turn dynamic content.
  5. Token usage merges via mergeUsage, never spread-overwrite. Partial usage payloads carry only the fields they update.
  6. ESM only. "type": "module" everywhere. Import specifiers use the .js suffix even when the source is .ts.
  7. Skill files start with YAML frontmatter. Any agent or tool that mutates a SKILL.md must preserve frontmatter order and the trailing blank line.
  8. Result over throw for control flow. Result<T, AtlasError> from @atlas/core is the only acceptable error channel for recoverable failures. Throwing is reserved for programmer errors.
  9. Customization is layered, never replaced. Built-in → ~/.atlas/ (user) → <cwd>/.atlas/ (project) deep-merge. Loaders must apply all three layers; never short-circuit because user or project is empty.

Workflow for agents

Before implementing

  1. Read context/project-overview.md, ARCHITECTURE.md, context/code-standards.md, context/ai-workflow-rules.md, and context/progress-tracker.md (in that order).
  2. If the task touches a file in packages/, read the closest *.test.ts next to it before changing the source.
  3. Pick the smallest change that advances the current phase. Atlas is built in 12-phase vertical slices. Do not ship work that belongs to a later phase.

Scoping

  • Work on one feature unit at a time.
  • Do not combine unrelated concerns in a single commit. UI changes, provider changes, and tool changes are separate commits.
  • Do not refactor adjacent code "while you're there".
  • Do not add helpers, abstractions, or "improvements" beyond what the task requires.
  • Do not add docstrings, comments, or type annotations to code you did not change.

Split work if it combines

  • A provider change and a tool change.
  • A core change and a TUI change (cross-package).
  • A change to >5 files and a behavior change.
  • A schema change and a feature using the new schema.

Verification before "done"

A task is not done until:

  1. The full quality gate passes (see Build and test commands).
  2. The change works end to end within its scope.
  3. No invariant was violated.
  4. context/progress-tracker.md reflects what changed.
  5. Commit message describes the what and why, not the how.
  6. No new any, no thrown control-flow exceptions, no async path without an AbortSignal parameter.

After commit

  • Append a one-line entry under Recent Decisions in context/progress-tracker.md with the commit short SHA + a 5–12 word summary.
  • If the change completes a phase, flip its row in the README phase table and append a CHANGELOG entry.
  • If the change introduces a new invariant or convention, also update ARCHITECTURE.md or code-standards.md in the same commit.

Protected files

Do not modify the following without an explicit user request:

  • LICENSE
  • pnpm-lock.yaml (generated — only pnpm install should touch it)
  • packages/*/dist/** (build output)
  • ~/.atlas/ user state outside the project tree
  • The Greek-pantheon agent files in packages/core/src/builtins/agents/ unless the task specifically targets them
  • The DESIGN.md byte-spec adopted from @google/design.md — version bumps require explicit review

Operational safety

  • Take local, reversible actions freely (edit files, run tests, build).
  • For hard-to-reverse actions, ask first: deleting files/branches, rm -rf, git push --force, git reset --hard, amending pushed commits, force-pushing, sending messages, modifying shared infra.
  • Never bypass safety checks. No --no-verify, no skipped tests, no commenting out failing assertions.
  • No shell-level backgrounding (&, nohup, disown) inside scripts the agent spawns. Use proper child-process management.

Keeping docs in sync

Update the relevant context file in the same commit as the change:

ChangeUpdate
New invariant the codebase must holdARCHITECTURE.md § Invariants
New convention you started enforcingcontext/code-standards.md
New phase shipped or marked in progressREADME.md phase table + tracker
New product feature in/out of scopecontext/project-overview.md
Architectural decision (provider, layout, …)context/progress-tracker.md § Recent Decisions + ADR if material
Anything that lands on maincontext/progress-tracker.md short note

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.