Skip to content

Repository files navigation

PSG — Project State Graph

Keep AI coding agents inside the task, preserve project decisions across sessions, and know when the work is done.

PSG gives coding agents a persistent task boundary and project state instead of making every model rediscover the repository and redefine the scope from scratch.

Install

Windows

python -m pip install "psg-runtime[mcp] @ git+https://github.com/niansia/PSG.git@v1.1.4"; psg setup

macOS / Linux

python3 -m pip install "psg-runtime[mcp] @ git+https://github.com/niansia/PSG.git@v1.1.4" && psg setup

Then, inside a Git project:

psg init

That's it. Use Codex, Claude Code, or Gemini CLI normally.

Everyday controls

psg status
psg on
psg off

What PSG does

Without PSG, a coding agent can keep discovering more files, more refactors, and more review suggestions until a small task becomes a project-wide rewrite.

PSG gives every task a boundary:

  • Context boundary — what the agent needs to read.
  • Mutation boundary — what it may change.
  • Review boundary — which findings may block this task.
  • Completion boundary — when the task is done and review must stop.

A reviewer may still discover unrelated bugs or future improvements, but PSG records them as follow-up work instead of silently expanding the current task.

Review the task, not the universe.

Why use PSG?

1. Stop scope drift

A task that only needs to fix A does not automatically become A + B + C + D because another model noticed more things that could be improved.

2. Preserve project decisions

Accepted decisions, constraints, frozen boundaries, and known debt do not need to be explained again every time the agent or session changes.

3. Make reviews converge

Only a regression caused by the current patch, an acceptance-criterion violation, or a project-constraint violation can block the current task. Other findings remain visible as follow-up work without reopening it.

4. Know when to stop

When acceptance criteria, deterministic verification, guardrails, and current-task blockers all agree, the gate returns:

SHIPPABLE

General review stops there.

Short tasks and long-horizon projects

PSG overview showing short-task overhead, reusable long-horizon project state, and the bounded workflow

Historical A/B result — superseded

Evidence status: Superseded.

This run is preserved for transparency, but it is not evidence of current-version performance. Codex loaded an older installed PSG Skill than the runtime under test, and the retrieval integration has since changed.

The historical run contains 10 matched Codex CLI task pairs using the same model, prompt, and repository baseline.

Metric PSG OFF PSG ON
Task success 9 / 10 10 / 10
Non-target edits 10 2
Regressions 0 0
False SHIPPABLE 0 0

The historical result showed better task-boundary discipline, but with measurable token and latency overhead. Because the run is superseded, it is not evidence of current-version performance. PSG currently claims no token or time savings from it.

See the benchmark protocol, raw results, and disclosed limitations.

How it works

PSG workflow: user request, Task Contract, relevant project state, coding agent, deterministic verification, bounded review, and SHIPPABLE

Git remains the implementation source of truth. PSG stores durable decisions and task state instead of full conversations. Context may expand when needed; write authority does not silently expand with it.

Where PSG works

Mode Hosts Capability
Full execution Codex, Claude Code, Gemini CLI Read, edit, verify, enforce, and ship
Review / handoff ChatGPT, Claude, Gemini Review against the same Task Contract

All hosts can use the same Task Boundary; execution hosts additionally receive runtime enforcement. Use psg handoff to create a compact review pack for another model or teammate.

Current limits

  • Rich symbol indexing is Python-first; other languages receive file-level indexing.
  • The included agentic benchmark uses a small generated repository, not production projects.
  • A fresh matched A/B run is still required for the current localization behavior.
  • PSG has no authenticated external CI attestation adapter yet.
  • PSG governs and evaluates changes; the coding agent still performs the edits.

Detailed documentation

A separate mechanics regression benchmark verifies that routing can reduce selected context when the relevant target is already known. It is not an end-to-end agent token-savings claim.

PSG is also being evaluated as a long-horizon software-agent research system. See the evaluation plan.

License

MIT

About

Persistent task boundaries, project decisions, and evidence-based ship gates for AI coding agents.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages