voku / agent-session
Working-memory layer for coding agents: per-task session plans, decisions, assumptions, checkpoints, claim metadata, and retention.
Fund package maintenance!
Requires
- php: ^8.3
Requires (Dev)
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^11.5 || ^12.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
- dev-main / 0.7.x-dev
- 0.7.4
- 0.7.3
- 0.7.2
- 0.7.1
- 0.7.0
- 0.6.4
- 0.6.3
- 0.6.2
- 0.6.1
- 0.6.0
- 0.5.0
- 0.4.0
- 0.3.0
- 0.2.2
- 0.2.1
- 0.2.0
- 0.1.1
- 0.1.0
- 0.0.1
- dev-ccr-44bf1ea9-qiofzm
- dev-ccr-784c9e99-0jrxgb
- dev-ccr-7dac2082-p9mp2n
- dev-docs/trim-session-agent-guidance-20261113
- dev-ci/skillevaluator-tier1-20261113
- dev-docs/readme-file-guide-20261110
- dev-experiment/navi-brain-ci-evidence-20261106
- dev-codex/release-security-20261024
- dev-ccr-3d900b81-gjumfz
- dev-chore/renovate-phpunit-php83-floor
- dev-fix/session-release-hygiene
- dev-release/0.6.4
- dev-fix/enforce-session-metadata-version
- dev-fix/24-equals-long-options
- dev-docs/agents-owner-boundary
- dev-chore/harden-release-tag-workflow
- dev-fix/release-0.6.2-changelog
- dev-release/0.6.2
- dev-docs/housekeeping-current-workflow
- dev-claude/agent-session-sync-slice-b2-rddx9z
- dev-docs/host-rehydration-api
- dev-agent/security-session-path-containment
- dev-fix/exact-session-rehydration
- dev-agent/token-diet-20260815
- dev-agent/implementation-snapshot-evidence
- dev-agent/fix-current-cli-docs
- dev-fix/prune-rejects-invalid-input
- dev-renovate-integration
- dev-reset/pruneable-working-memory
- dev-fix/compact-cli-default
- dev-breaking/default-agent-loop-paths
- dev-release/0.4.0
- dev-feat/govern-operating-prompts
- dev-fix/validation-evidence-status-exit
- dev-agent/fix-main-branch-alias
This package is auto-updated.
Last update: 2026-11-29 19:57:58 UTC
README
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 --byclaims the Session at once;claimrefuses 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, andactiveForTask()throwsAmbiguousActiveSessioninstead 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 passedand a non-zero--exit-codeis rejected. - A resume packet, not a transcript.
handoffprints 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.