Architecture
PAS-Agent is a minimal, local-first tool: one small Rust binary and one JSON file per project. This page explains how the pieces fit together.
How It Works
- One file holds the session.
initcreates.pas-agent/session.jsonat the root of your git repository (it asksgit rev-parse --show-toplevelwhere that is). Every other command walks up from the current directory until it finds that file, so they work from any subfolder. - Commands edit the file.
updateandremoveload the session, change the task state, and save it again. Saving writes a temporary file and renames it over the old one, so a crash or a full disk can't leave a half-written session. - Checkpoints ask git what changed.
checkpointrunsgitfor the branch, the commit, andgit status, then stores that next to a copy of the task state. PAS-Agent's own directory is excluded, so the session never shows up as "changed". - Export renders Markdown.
exportrefreshes the git state and turns the session into Markdown. Every value is flattened to a single line and escaped, so nothing you type can break the document or fake its markers. - The block goes where the agent looks. The Markdown is wrapped in
pas-agent:start/pas-agent:endmarkers and written into the file the target agent loads at startup. If the file has a block, only the block is replaced; if not, the block is appended. Your own content is never touched. - The next agent just reads a file. No plugin or API is involved. The agent loads its instruction file as usual and finds the task, progress, and decisions in it.
The session format carries a schema_version. New fields get defaults, so older files keep loading, and a file from a newer version is rejected rather than misread. PAS-Agent makes no network requests at any point.
System Overview
PAS-Agent CLI
↓ writes
.pas-agent/session.json (portable state)
↓ generates
CLAUDE.md / AGENTS.md / GEMINI.md (inside a marked block)
↓ read at startup by
Claude Code / Codex / OpenCode / Cursor / Kiro CLI / Antigravity / Gemini CLICrate Structure
crates/
├── pas-agent-core/ # Session model, storage, context generation
└── pas-agent-cli/ # CLI binary (clap-based)pas-agent-core
Core library with no CLI dependencies. Handles:
- Session data model (
Session,TaskState,Checkpoint,FileState,GitRef,Agent) - File-based session storage (
SessionStore) - Context generation and non-destructive writing (
generate_context,write_context_file) - Git state capture (
capture_git_state,get_changed_files)
pas-agent-cli
CLI binary providing user-facing commands: init,checkpoint, status, list,export, update, remove.
Storage Format
One versioned JSON file per project, written atomically. No database is required.
.pas-agent/
└── session.json # task state, git state, checkpointsIntegration Model
PAS-Agent does not parse internal agent session formats. Instead, it generates instruction files that each agent reads at session start:
| Agent | File | Reads At |
|---|---|---|
| Claude Code | CLAUDE.md | Session start |
| Codex | AGENTS.md | Session start |
| OpenCode | AGENTS.md | Session start |
| Kiro CLI | AGENTS.md | Session start |
| Antigravity | AGENTS.md | Session start |
| Cursor | AGENTS.md | Session start |
| Gemini CLI | GEMINI.md | Session start |
Design Decisions
| Decision | Rationale |
|---|---|
| JSON for storage | Simple, human-readable, no database dependency |
Flat .pas-agent/ directory | No hidden config complexity, easy to inspect |
| Marked export block | Coexists with hand-written instruction files instead of overwriting them |
schema_version + field defaults | Older session files keep loading; newer ones fail loudly instead of being misread |
| Markdown export | All target agents read markdown instruction files at session start |
| No daemon | Nothing runs in the background; every change happens when you run a command |
| No AI in core | Deterministic and offline; any future AI-assisted features stay optional |