Search by

voku / agent-session

voku

Working-memory layer for coding agents: per-task session plans, decisions, assumptions, checkpoints, claim metadata, and retention.

Package info

github.com/voku/agent-session

pkg:composer/voku/agent-session

Fund package maintenance!

voku

Statistics

Installs: 130 579

Dependents: 1

Suggesters: 0

Stars: 3

Open Issues: 1

0.7.4 2026-11-29 14:26 UTC

README

Build Status Latest Stable Version Total Downloads Monthly Downloads License PHP Version Require GitHub Stars GitHub Forks

When the agent's context resets, the task should not: per-task working memory (plan, assumptions, decisions, validation runs, checkpoints) as plain files that a fresh agent resumes from, and that you can prune once the task is done.

You get:

  • One owner per task. start --by claims the Session at once; claim refuses another actor's live claim unless you pass --force (checked before the locked write, so two claims racing on an unclaimed Session are not refused); a second open governed Session for the same task is refused, and activeForTask() throws AmbiguousActiveSession instead of guessing. Ephemeral Sessions are outside this rule in both directions.
  • Validation evidence that cannot lie about its exit code. Runs are appended to validation-evidence.jsonl, bound to the Contract revision that required them; a record with --status passed and a non-zero --exit-code is rejected.
  • A resume packet, not a transcript. handoff prints a bounded Markdown or JSON packet: task, claim, base commit, latest checkpoint, decisions. No runtime dependencies beyond PHP 8.3+.

Part of Agent Loop — a deterministic, local-first workflow for coding agents: approved Contracts, explicit next actions, evidence before "done". This package owns per-task working memory.

Quickstart

composer require voku/agent-session

Sessions are stored under <cwd>/.agent-loop/sessions by default; pass --root PATH to use another directory. A Session id is <date>-<slug> (with a numeric suffix on collision); the slug comes from --slug or, without it, from the task id.

# start working memory for a task (--by also claims it)
vendor/bin/agent-session start --task task.002.remove-session-access --slug remove-session-access --by lars --base-commit abc123
ID=2026-11-29-remove-session-access   # the id printed by "start"

# record what the agent decided, checkpointed and verified
vendor/bin/agent-session record "$ID" --kind decision --title "Keep change module-scoped" --body "..."
vendor/bin/agent-session checkpoint "$ID" --title "Implementation" --body "Updated the primary service."
vendor/bin/agent-session validation record "$ID" --contract-revision 1 --command "composer ci" --status passed --exit-code 0

# hand the task to a fresh agent, then retire the working memory
vendor/bin/agent-session handoff "$ID"
vendor/bin/agent-session close "$ID" --status done
vendor/bin/agent-session prune --keep-days 30 --status done,dropped --dry-run

start prints the new id and path:

Started session: 2026-11-29-remove-session-access
- path: /path/to/project/.agent-loop/sessions/2026-11-29-remove-session-access
- working-memory files: plan.md, assumptions.md, decisions.md, validation.md, checkpoints/

handoff prints a bounded resume packet (Markdown by default, --format json for machines); an excerpt:

# Session handoff: 2026-11-29-remove-session-access

- Task: task.002.remove-session-access
- Status: active
- Claimed by: lars
- Base commit: abc123
...
## Latest checkpoint

Updated the primary service.

## Decisions

- Keep change module-scoped

From PHP, embed SessionStore instead of shelling out; see docs/php-api.md.

Why pruneable?

A task is durable intent. A session is the temporary context an agent needs to finish it. That context helps the current task and is then pruned; it is not project memory, and a historical PASS recorded in a Session is not evidence that the current source is correct. Contract approval belongs to voku/agent-loop, durable findings to voku/agent-learning (boundaries).

Documentation

I want to… Read
Understand Sessions and what a Session directory holds docs/concepts.md
Look up a CLI command or option docs/cli.md
Embed Sessions in a PHP host (allocation, handoff, evidence selection) docs/php-api.md
Know what a Session must not be used for docs/boundaries.md
Upgrade from session_plan/ or an older release UPGRADING.md
See what changed CHANGELOG.md
Change this package, or point an agent at it docs/development.md, CONTRIBUTING.md, AGENTS.md
Browse every page docs/README.md

Part of the Agent Loop toolchain

Each package owns one concern and can be used on its own. voku/agent-loop composes them into one governed workflow.

Package Owns
agent-loop Task Contracts, lifecycle, next actions, validation and review gates
agent-kanban Git-native Markdown board and card semantics
agent-session Per-task working memory, decisions and checkpoints
agent-map Read-only repository symbol maps and typed edit plans
agent-edit Transactional, verified application of edit plans
agent-graph Deterministic SQLite graph index and runtime
agent-recall-compiler Bounded task context (Recall) and prompt recipes
agent-learning Reviewable findings, proposals and durable guidance
agent-skills Portable engineering skills for coding agents
agent-ui Local server-rendered control plane for humans
agent-decision Experimental bounded, advisory-only decision helper
agent-dotfiles Shell dotfiles for non-interactive agent shells

Development

composer install
composer ci   # validate --strict + phpunit + phpstan

Where each concern lives, and the shipped maintainer skill: docs/development.md. See CONTRIBUTING.md before opening a pull request.

License

MIT — see LICENSE.