OpenClaw Project Context
Agent-scoped project context for OpenClaw: durable, isolated projects with explicit capture, checkpoints and lifecycle.
Install
openclaw plugins install @zrzavywa/openclaw-project-context --accept-capabilities
The host resolves the package from ClawHub, verifies the artifact, and reports
Installed plugin: awf-project-context. The manifest id differs from the npm package
name by design; the host uses the manifest id as the configuration key.
Enable the plugin and let it inject project context into a conversation:
{
"plugins": {
"entries": {
"awf-project-context": {
"enabled": true,
"config": { "enabled": true },
"hooks": { "allowConversationAccess": true, "allowPromptInjection": true }
}
}
}
}
Restart the Gateway, then three commands get you started:
/project create First project— creates the project and selects it for this conversation./project status— shows the project card./project capture— proposes a compact working state;/project capture confirmstores it.
To update, install the newer ClawHub version with the same command and restart the Gateway.
Optional: load on name mention
With autoLoadOnMention enabled, a message that names exactly one project loads that project's
context for the turn, even when nothing is selected. It is off by default.
- Matching uses the project name (whole words, at least four characters) or the exact code, case-insensitive.
- An explicit selection always wins.
- If two or more projects match, nothing is loaded; the reply lists the candidates instead.
- Nothing is written, and the selection is unchanged.
Status at a glance
npm run status prints the state that matters and keeps it out of documents that go stale:
repo commit and version, installed version, and optionally the release mirror and the catalog.
npm run status # repo and installation, no network
npm run status -- --online # adds mirror tag and catalog latest
The report only reads. It writes nothing, and an unknown value prints UNKNOWN instead of a guess.
Goal
Let a user create and work inside a project through the OpenClaw agent already in use. The active agent determines the project domain:
| Agent | Domain | Example code |
|---|---|---|
main | A | A004 |
privat | P | P008 |
beruflich-work | B | B005 |
Projects live inside that agent's own workspace. Context is isolated to the selected project and the current conversation.
Why this exists
An agent discusses many different things in one conversation stream. Without structure it either loses the thread or drags unrelated details forward. This plugin gives every agent durable projects: you name the work once, and the agent keeps a stable reference, one compact current state, and an auditable trail of decisions — bound to that project, that agent, and that conversation.
What you get
- Isolation — a project's context never leaks into another project or into another agent's conversation.
- Deliberate loading — only
REFERENZ.mdand the optionalKONTEXT.mdload automatically. Capture history, legacy context and the decision archive are read only when requested. - Consent before writes — every capture and every closeout is shown as a preview and stored only after explicit confirmation.
- Nothing disappears silently — delete moves a project to a restorable trash; archives are counted and never pruned automatically; every state change is appended to
history/lifecycle.jsonl. - Owner-controlled naming — per-agent code models (A/P/B), custom prefix schemes, and the storage directory for new projects.
Included workflow
- Create a project from natural language or
/project create <name>; creation selects it for the current conversation. - Show a visible project status card with
/project status. - Capture a proposed summary from the visible conversation. The agent displays a preview; nothing is written until the owner runs
/project capture confirm. Use/project capture cancelto discard it. - Each confirmed capture is archived under
history/captures/;KONTEXT.mdis replaced with a compact working snapshot rather than appended. The first capture also preserves the prior context underhistory/legacy/. - Newly confirmed decisions are stored separately under
history/decisions/. Capture history, legacy context, and decisions are excluded from automatic prompt loading; use/project history,/project history legacy, or/project decisionsto inspect them on demand. - Close out a project with a preview and explicit confirmation. The approved closeout is saved, then the current conversation's project selection is cleared.
- Archive and restore projects; move a project to a recoverable trash and restore it later. Context loading is stopped as soon as a project leaves the active state.
- Merge two active projects in the same agent. The source context and reference are appended as quoted data to the target, then the source is archived.
- Move a project between configured agents. The destination receives a newly allocated A/P/B code and copied safe project assets; after the copy is verified, the source is archived with a destination reference.
- Doctor skips a directory only when it carries a private, owner-controlled
.awf-project-fixture.jsonmarker with schemaawf.project-fixture.v1, kindtest-fixture, matching agent and project IDs, and a non-empty reason. Skipped fixture IDs are listed in the result; an invalid marker does not hide the project. - Run
/project doctorfor read-only checks of project state, references, codes, permissions, context files, and lifecycle logs. Each finding names its project;/project doctor json(or the tool'sformat: 'json') returns the same data machine-readable. Doctor also reports the plugin's own release integrity separately from project findings. /project statusnames why no context is active:no-selection,selection-expired, orstate-generation-changed.- Doctor reports archive counts and total history size and flags projects above 2 MiB. Archives are reported, never pruned automatically;
/project history legacylists at most 50 records but states the total. - Doctor shows the loaded plugin version next to the installed manifest and flags
plugin-version-driftuntil the Gateway is restarted after an update. - Every status transition is appended to
history/lifecycle.jsonl(from/to, generation, timestamp, merge/move detail). Doctor warns when the log is unreadable or behind the project state. A log write failure is reported in the command result; the state change remains authoritative. - Run
/project repairfor a preview of limited safe repairs./project repair confirmapplies only owner-only permission fixes and creation of a minimal missingKONTEXT.md; ownership, symlink, reference, and content problems require manual review. - Run
/project helpfor the command list and/project listfor active projects in the current agent. - Configure agent-specific code models with
/project config set prefix model AXXX,/project config rename prefix AXXX BXXYY, and/project config delete prefix AXXX. X/Y positions are sequential decimal digits. Renamed/deactivated models remain as valid legacy codes for existing projects. - Configure the future-project location with
/project config set location projects-alt. Locations must be relative, owner-controlled directories inside that agent's workspace. Existing projects stay where they are and remain listed/selectable. - Link a project to an exact Codex root with
/project config link P001 /srv/work/example-project;/project config unlink P001removes the link. Selecting that root in Codex loads only the matching active OpenClaw project context for the current agent. The Codex Desktop picker still needs the root registered through its UI. - On later turns, load only
REFERENZ.mdand optionalKONTEXT.mdfrom the selected project. - A failed project creation rolls back the created directory and marks the reserved code
abandoned; the number is never recycled. - New working snapshots are limited to 16 KiB. Existing larger context remains readable under the 64 KiB safety ceiling until a confirmed capture compacts it; Doctor flags snapshots above 16 KiB.
- Context files are capped at 64 KiB each; this is the per-file read and write ceiling. For the prompt, reference and context are capped at 24 KiB each and truncated with an explicit marker.
- A failed cross-agent move keeps its partial destination in the workspace
.project-trash/instead of deleting it. - Keep allocation append-only and refuse unsafe paths, cross-agent access, invalid files, or stale authority.
- Command and tool results are German. Technical labels (
Release:,History:,integrity:,active/archived/trash) and low-level validation errors remain in English.
Capture uses only the conversation visible to the agent and its loaded working snapshot. It does not import chat exports, other conversations, or unrelated workspace files. Captured summaries are quoted as data and cannot change agent instructions. Archives are retained and are not silently pruned.
Command reference
Commands are issued as /project … in the conversation. The agent reaches the same capabilities through the awf_project tool. Results are German; technical labels (Release:, History:, integrity:, active/archived/trash) stay English.
Start and select
| Command | What it does |
|---|---|
/project help | Lists all commands and the loaded plugin version. |
/project list | Shows the active projects of the current agent. |
/project create <Name> | Creates a project with the next free code and selects it for this conversation. |
/project <Code> | Selects an existing project for this conversation; later turns load its context. |
/project status | Shows the active project card, or names why nothing is active: no-selection, selection-expired, state-generation-changed. |
/project clear | Releases the project binding of this conversation. |
Context and history
| Command | What it does |
|---|---|
/project capture | Proposes a compact working state from the visible conversation; nothing is written yet. |
/project capture confirm | Stores the previewed state: archives the entry under history/captures/ and replaces KONTEXT.md with the compact snapshot. |
/project capture cancel | Discards the proposal. |
/project close | Prepares a closeout report; after confirmation it is saved and the conversation's selection is cleared. |
/project history | Lists the most recent capture entries; /project history <ID> loads one entry. |
/project decisions | Shows the decision archive; /project decisions <ID> loads one entry. |
/project history legacy | Shows pre-capture context; with an ID it loads the archived legacy record. |
Search
| Command | What it does |
|---|---|
/project search <term> | Searches REFERENZ.md, KONTEXT.md, the capture history and the decision archive of this agent's active projects. Terms are AND-combined and case-insensitive and are never treated as patterns; at most 20 hits are shown, with the number of further matches. Read-only: no index file, no writes. |
Export and import
| Command | What it does |
|---|---|
/project export <code> | Writes one JSON file (awf.project-export.v1) with reference, working snapshot, captures and decisions to <agent workspace>/project-exports/. Never writes into the project; never includes selection state, the ledger or Codex links. |
/project history prune | Previews records older than retentionDays (default 180, 0 disables). /project history prune confirm moves them to history/pruned/<date>/. The newest five captures and three decisions always stay, and nothing is deleted. |
/project import <path> | Creates a new project with a fresh code from an export file. Never overwrites an existing project. Rejects unknown schema, missing reference, non-UTF-8 content and oversized records. |
Lifecycle and recovery
| Command | What it does |
|---|---|
/project archive <Code> | Archives a project; context loading stops immediately. |
/project archived | Lists archived and trashed projects. |
/project delete <Code> | Moves a project to the recoverable trash; files are not destroyed. |
/project restore <Code> | Restores an archived or trashed project. |
Diagnosis and repair
| Command | What it does |
|---|---|
/project doctor | Read-only check of project state, references, codes, permissions, context files and lifecycle log. Also reports release integrity and the loaded plugin version. |
/project doctor json | Same result, machine-readable. |
/project repair | Proposes a limited set of safe repairs. |
/project repair confirm | Applies only owner-only permission fixes and creation of a minimal missing KONTEXT.md; everything else needs manual review. |
Configuration
| Command | What it does |
|---|---|
/project config show | Shows prefix models and storage locations of this agent. |
/project config set prefix-model AXXX | Sets the active code model; X positions are sequential decimal digits. |
/project config rename prefix AXXX BXXYY | Changes the prefix for new codes; existing codes stay valid as legacy codes. |
/project config delete prefix AXXX | Deactivates a prefix for new projects. |
/project config set location <path> | Sets the storage directory for future projects (relative, inside the agent workspace). |
/project config set baseline <prefix> <max> <domain> | Raises a code baseline — never below the highest code already issued. |
/project config link <Code> <path> | Binds a project to an exact Codex workspace root. |
/project config unlink <Code> | Removes that binding. |
Transfer
| Command | What it does |
|---|---|
/project merge <Source> into <Target> | Previews a merge; the source context is appended as quoted data, and the source is archived afterwards. |
/project move <Code> to <Agent> | Previews a move; the destination receives a newly allocated code and verified copies before the source is archived. |
/project transfer confirm / cancel | Applies or discards a prepared merge or move. |
Tool surface
awf_project exposes the same capabilities with actions help, list, create, select, status, config, history, decisions, archived, doctor, repair-preview, merge-preview, move-preview, capture-preview, close-preview, archive, trash, restore and search. Preview actions only return a proposal; the confirming step is separate, so an agent cannot silently persist a context.
Where your data lives
projects/<project-id>/
REFERENZ.md stable reference, loaded automatically
KONTEXT.md compact working state, replaced by /project capture
state.json lifecycle state (active, archived, trash)
history/captures/ immutable capture records
history/decisions/ approved decisions
history/legacy/ pre-capture context, read-only
project-exports/ output of /project export, outside any project
Only REFERENZ.md and KONTEXT.md are loaded automatically. Everything under history/ is read only when you ask for it: /project history, /project decisions, /project history legacy.
Limits
| What | Limit |
|---|---|
Working snapshot (KONTEXT.md) | 16 KiB |
| A single project file | 64 KiB |
| One capture or decision record | 8 KiB |
| Export file | 10 MiB |
| Captures and decisions carried by export/import | 20 each, newest first |
| Doctor warning threshold per project | 2 MiB of history |
What this plugin does not do
- It does not read chat exports, transcripts, other conversations, or unrelated workspace files.
- It makes no network calls, in either direction.
- It keeps no search index and no embeddings;
/project searchreads the files on demand. - It never deletes or prunes history on its own.
- It does not encrypt at rest: project files are plain Markdown, protected by file permissions (0600 files, 0700 directories).
Checkpoint compatibility
/project capture owns projects/<id>/KONTEXT.md. A confirmed capture replaces that file atomically with the compact snapshot headed # Current project context; the plugin archives capture history separately and never reads or loads CHECKPOINTS.md.
A separate checkpoint helper treats KONTEXT.md as read-only. It appends dated events to projects/<id>/CHECKPOINTS.md and writes one minimized pointer into the daily memory. Legacy checkpoint blocks inside KONTEXT.md remain readable through --inspect; the plugin's own archive interface stays /project history, /project history legacy, and /project decisions.
A checkpoint does not refresh the capture snapshot. To include newer work in KONTEXT.md, prepare a capture preview and save it only after the owner confirms with /project capture confirm.
Data and security boundaries
- The runtime-supplied active agent and workspace are authoritative.
- A/P/B domains do not cross-read each other's workspaces.
- Project selection is scoped to the active conversation and expires.
- Summary drafts are bound to the agent, conversation, and selected project; they expire after 15 minutes.
- Merge, move, and repair previews are bound to the agent and conversation and expire after 15 minutes. They require
/project transfer confirmor/project repair confirm; transfer previews can be cancelled. - Code models and project locations are stored per agent in the OpenClaw retained project-config store and are bound to that agent's workspace. Code allocation remains append-only per model; deleted models are disabled rather than erasing historical codes.
- Codex links are stored per OpenClaw project in an owner-only metadata file. The plugin compares only exact canonical paths, and scans links only in the active agent's workspace. It does not read another agent's project files or write to Codex's internal saved-root state.
- Merge is limited to contexts that fit the existing per-file size guard. Move refuses unsafe assets and applies file-count and total-size limits.
- Delete is recoverable trash; this plugin does not permanently erase project data. A failed cross-agent move removes only its own freshly created destination directory.
- Snapshot replacement re-hashes the existing
KONTEXT.mdimmediately before the rename, not only when the preview was created. release.jsonlists size and SHA-256 for every declared package file. Doctor andnpm run release:verifyreport content, version, and manifest/package drift; the manifest is excluded from its own file list.- Only an authenticated owner command can confirm or cancel a draft.
- Project text is treated as untrusted data.
- No external secret store integration is required.
Agent portability
The plugin is not limited to the built-in agents (main, privat, beruflich-work).
Any agent id matching ^[a-z0-9][a-z0-9-]{0,63}$ can own projects:
- a configured baseline (
/project config set baseline <prefix> <high-water> <domain>) always wins; - otherwise the built-in A/P/B defaults apply;
- for every other agent the prefix is derived from the id (initials, up to four letters,
highWater0, domain = agent id), so the first project becomes e.g.R001forresearch; - the prefix registry still enforces uniqueness. A derived prefix that another agent already holds fails with a clear message instead of silently renumbering; assign it explicitly;
/project doctorreports anagent-baseline-derivedwarning for such an agent, so an implicit prefix is visible instead of silent.
Updating
Updates are an operator task. An install started from inside a running agent turn blocks itself: the host drain waits for that turn, the turn waits for the install, and the install aborts after the 60-second drain budget. Install and restart outside a turn, then verify with npm run verify:loaded.
See docs/UPDATING.md for the full procedure, the pre-flight checks and the rollback.
Publishing
The package is publishable metadata-wise (private: false, MIT, build metadata,
catalog category). Publishing itself is an explicit owner action and is not part of
any automated flow:
clawhub login # device flow, once per machine
clawhub package validate . # bundled Plugin Inspector
clawhub package publish . --dry-run --family code-plugin
clawhub package publish . --family code-plugin \
--topics openclaw,project-context,agent-workspace,productivity
Name @zrzavywa/openclaw-project-context, display name Project Context, plugin id
awf-project-context. The id is also the config key under plugins.entries, so a
rename would need a migration.
Status
Current state: this file deliberately does not pin a version — it would drift with every release. Authoritative sources are CHANGELOG.md for the release history and /project doctor for the installed and loaded version plus release integrity. Deployment target: OpenClaw >=2026.11.6. Since 0.7.2 npm run check:changelog and the CI workflow fail a release whose version has no changelog section. The repository is still private, private: true, and no license is declared, so nothing here is offered for publication.
Earlier deployments (kept for traceability):
This repository contains the private pilot source; it is not published on ClawHub. On 20 November 2026, compact project snapshots and on-demand history were deployed as plugin version 0.2.0 to the OpenClaw 2026.11.6 Gateway. The plugin reload succeeded (runtime generation 13), and runtime inspection reported the plugin loaded with no diagnostics. The previous 0.1.0 installation is backed up under ~/.openclaw/extensions/.openclaw-install-backups/. A live model-assisted user conversation remains an acceptance check.
Version 0.3.0 added release-integrity verification, a pre-rename snapshot hash gate, project-creation rollback with abandoned reservations, project-scoped Doctor output with JSON, and an append-only lifecycle audit log; it was merged and installed on 2026-11-22. Version 0.4.0 adds quarantine instead of deletion for failed moves, the history size report, loaded-version drift detection, explicit /project status reasons, a prompt budget with truncation markers, and a 50-record cap for legacy listings.
Release procedure: run npm run check:changelog, then npm test, then npm run release:manifest, then npm run release:verify; the packed tarball must contain the resulting release.json. Doctor reports integrity: MISSING when an installation has no manifest, which is expected only for development checkouts.
Codex workspace links
Each project can be linked to exactly one Codex workspace root by its owner:
/project config link P001 /srv/work/example-project
/project config unlink P001
Example mapping — values are illustrative, not shipped data:
| Agent | Code | Codex workspace root |
|---|---|---|
main | A001 | /srv/work/example-a |
research | R001 | /srv/work/example-b |
A link is stored per project and per agent, is validated against canonical and
owner-only paths, and only loads the matching project context when Codex opens
exactly that root. Linking requires a private, owner-controlled project
directory (mode 0700); the plugin never changes project content while linking.
Troubleshooting
An install reports success but the old version still runs. The host saved the new files, yet the running plugin generation keeps the old code while this conversation holds the plugin. Run openclaw plugins reload awf-project-context, or use the plugins tool with reloadAndResume, which ends the turn, swaps the generation and resumes. The message admitted work did not settle is a drain timeout, not a failed installation.
Doctor reports install-source-drift. The plugin is loaded through plugins.load.paths instead of a registered installation. Install the ClawHub package and remove that entry, so provenance and updates are recorded.
Doctor reports plugin-version-drift. The installed manifest is newer than the loaded code. Reload or restart the Gateway to load the new version.
A stale-context hint appears. That is by design: one line per project and day when the working snapshot is older than staleContextDays (default 14). /project capture refreshes it.
A capture or load is refused with an owner, mode, link or size error. The file failed the ownership and safety checks, which are intentionally strict. /project doctor names the affected project; /project repair previews the owner-only permission fixes it may apply.
A ClawHub publish stays pending. Nothing the plugin controls. clawhub package recover only works on failed attempts; on pending it aborts with Publish attempt is still pending. Waiting is the reliable path.
Package files
index.mjs: OpenClaw plugin entry; wires the prompt hook, theawf_projecttool and the/projectcommand.project-commands.mjs: command and tool dispatch, prompt-context assembly and status output.project-helpers.mjs: shared constants, project listing, selection, context budget and diagnostics.project-creation.mjs: secure workspace creation and append-only project code allocation.project-lifecycle.mjs: project state, safe transfer helpers, Doctor findings, and constrained Repair plans.project-config.mjs: per-agent prefix models and safe, workspace-local project locations.project-codex-link.mjs: owner-only per-project Codex root links and path validation.project-memory.mjs: safe capture and decision archives, compact snapshot replacement with a pre-rename hash gate, and on-demand reads.project-release.mjs: package manifest with per-file SHA-256, drift verification, and therelease.jsonCLI.openclaw.plugin.json: OpenClaw plugin manifest (id, tool contract, activation, config schema, catalog category).CHANGELOG.md: versioned change history; enforced bycheck-changelog.mjs.check-changelog.mjs: release gate, not part of the published package files.
Verification
Run npm test for the isolated command and security checks. Run npm run test:gateway for a temporary Gateway with a synthetic model; it uses loopback ports 19346 and 19349 and removes its temporary workspace when finished.
Known limitation (revised 2026-11-22 in 0.7.5): npm run test:gateway starts its synthetic Gateway and runs the agent turn. The stub model repeats the same create call: the first call succeeds and its result reaches the model, the repeat is rejected as a duplicate name. Up to 0.7.4 the host still logged [tools] awf_project failed: with an empty message, because index.mjs derived details.ok from English text prefixes while the messages have been German since 0.5.0; after three repetitions the turn was stopped. 0.7.5 centralises that decision in resultOk() and covers it with tests. The run needs roughly 1.1 GB RSS for the Gateway alone, so give it a host or worker without a 2 GiB cap.
Run npm run release:manifest after the final change and before packaging, then npm run release:verify. The suite covers release drift, the snapshot hash gate, creation rollback with an abandoned reservation, Doctor project IDs and JSON output, and lifecycle log writes.
