This folder is the portable brain. Any harness (Claude Code, Cursor, Windsurf, OpenCode, OpenClaw, Hermes, standalone Python) can mount it and get the same memory, skills, and protocols.
- Edit first, commit later - Make changes, AskUserQuestion if they're correct, commit if YES; no question or no answer is NOT a yes.
- Commit first, push later - Only push when everything is verified by the user and final. If unsure, use a disposable worktree.
- READ this first: https://github.com/diazMelgarejo/Perpetua-Tools/blob/main/SKILL.md
memory/personal/PREFERENCES.md— stable user conventionsmemory/working/WORKSPACE.md— current task statememory/working/REVIEW_QUEUE.md— pending candidate lessons waiting for youmemory/semantic/DECISIONS.md— past architectural choicesmemory/semantic/LESSONS.md— distilled patterns (rendered fromlessons.jsonl)memory/episodic/AGENT_LEARNINGS.jsonl— raw experience log (top-k by salience)
Candidate lessons are clustered + staged automatically by memory/auto_dream.py.
The host agent — you — does the actual review using the CLI tools below.
Check memory/working/REVIEW_QUEUE.md at session start. If pending > 10 or
oldest staged > 7 days, review before substantive work.
Workflow:
python .agent/tools/list_candidates.py— pending candidates, sorted by priority- For each: decide accept / reject / defer based on claim, evidence_ids, cluster_size, and any contradictions with existing LESSONS.md
python .agent/tools/graduate.py <id> --rationale "..."to acceptpython .agent/tools/reject.py <id> --reason "..."to rejectpython .agent/tools/reopen.py <id>to requeue
skills/_index.mdskills/_manifest.jsonl- Load SKILL.md only when triggers match task
- Playbook:
references/openclaw-oramasys-fleet-retrofit-playbook.md— MERGE-10 retrofit, 17-agent map, promotion to orama - Session:
memory/working/OPENCLAW_MERGE10_FLEET_RETROFIT_2026-07-26.md - Recall:
python .agent/tools/recall.py "openclaw fleet merge-10"before OpenClaw agent work
protocols/permissions.mdprotocols/delegation.mdprotocols/path-hygiene.md— anti-doxxing / LINT-006 (always apply)
Never write workstation-specific paths into git-tracked files — including
.agent/memory/*, lessons, review queue summaries, skills, and docs.
| Do | Don't |
|---|---|
Repo-relative paths (../../Perpetua-Tools/.agent) |
OS-specific home-directory paths, OS-specific home-directory path form |
Env anchors ($REPO_ROOT, PERPETUA_TOOLS_ROOT) |
workspace-tree paths |
Generic ~/.gstack/projects/<slug>/ |
Pinning "canonical workspace" paths in memory |
orama-system / Perpetua-Tools repo names |
Teaching agents your Downloads folder layout |
Write boundaries: all memory writers call sanitize_tracked_path_leaks() from
memory/path_hygiene.py (learn.py, graduate.py, review_state.py, episodic hooks).
Antipattern: Graduating or echoing lessons that treat a personal Downloads path as canonical — reject those candidates; use repo names + env vars instead.
Full contract: protocols/path-hygiene.md · lessons lesson_da04cbbae68b, lesson_456ea361526d, lesson_6fc89e22e3bb.
When addressing review findings on an ALREADY-OPEN PR (as opposed to merging independent branches): freeze main as a write target, cluster findings by root cause and fix the abstraction once, keep commits cohesive by failure class, and on any post-merge problem prefer a safety-ref-protected ancestry reset over accumulating revert commits.
Canonical doctrine (orama-way):
orama post-review-micro-remediation.md
— 6 phases: Freeze → Root-cause clustering → Branch discipline → Integration
(safety ref before reset) → Verification (fixed/superseded/documented, never
silent) → Closure. This section is the portable-brain summary; the reference
doc is authoritative.
When merging nested branches produced by independent agents against a moving main, follow this protocol exactly. Never guess conflict resolution.
Canonical doctrine (orama-way): load oramasys-method →
orama integrative-merge.md
(synthesize, never amputate; six resolution modes). This section is the portable-brain summary; the skill reference is authoritative.
Board-job source line: when claiming write work from a GossipBus / job
board row that carries source_ref and expected_base_sha, create a fresh
worktree from that exact source and stop if HEAD differs — same board plus
same repo is not enough. These fields are currently optional and
provisional (producer-side validated when present, not yet required on
every row); treat their absence as "no source-line guarantee available" for
that row, not as an error. See references/branch-local-review-remediation.md
and, for the schema's cross-repo status and the open question on making it
required in v2, docs/v2/48-board-job-source-line-schema.md in
orama-system.
-
Simulate first — touch nothing.
git merge --no-commit --no-ff <branch> git diff --name-only --diff-filter=U # enumerate ALL conflicts git merge --abort
-
Present every conflict to the human with both sides shown. One question per file. Wait for explicit direction before proceeding.
-
Human-directed resolution strategies:
additive— one side is empty, other has content → take the content sideunion— both sides have partial content → concatenate (ours first, theirs appended)superset— one is a structural superset of the other → verify all rows from the smaller are in the larger, then take the supersetsynthesize— both sides changed the same region for valid different reasons → blend both (e.g. new API + old branch's tests)architecturally-correct— one side has a bug the other fixes → take the correct side regardless of branch originapi-correct— casing/type mismatch → take the API-correct form
-
Resolve all conflicts in one pass using the directed strategy. Never delete content — archive/quarantine if something must be removed.
-
Verify before committing:
python3 -m pytest -q python3 scripts/review/repo_hygiene.py . git diff --name-only --diff-filter=U # must be empty
-
Push → wait for CI → perform GitHub API merge.
-
Wait 10 minutes between sequential merges. Before merge N+1, confirm
mergeable_state: cleanvia GitHub API.
- "Merged" on GitHub ≠ content is on the target branch. Always verify with
git diff origin/main...origin/<branch>after any merge. - CodeRabbit re-scans on every push and creates new comment threads. Run the post-merge sweep after every merge, not just once.
- JSONL memory files (lessons.jsonl, AGENT_LEARNINGS.jsonl): dedup by
id/run_idafter union — keep the first occurrence per id. - LESSONS.md is rendered from lessons.jsonl — never hand-edit it directly (AGENTS.md Rule 5). Always go through
graduate.py.
Daily driver, highest-leverage first:
recall.py "<intent>"— surface graduated lessons relevant to what you're about to do. Run before deploy / migration / timestamp / debug / refactor work. This is how lessons cross harnesses.learn.py "<rule>" --rationale "<why>"— teach the agent a new lesson in one shot (stage + graduate + render). For rules you already know.show.py— one-screen dashboard of brain state: episodes, candidates, lessons, failing skills, activity graph.list_candidates.py/graduate.py/reject.py/reopen.py— review protocol for patterns the dream cycle has staged.memory_reflect.py <skill> <action> <outcome>— log a significant event.
- Check memory before decisions you have been corrected on before.
- If
REVIEW_QUEUE.mdshows backlog past threshold, handle it before the new task. - Log every significant action to
memory/episodic/AGENT_LEARNINGS.jsonlvia.agent/tools/memory_reflect.py. - Update
memory/working/WORKSPACE.mdas you work; archive on completion. - Never hand-edit
memory/semantic/LESSONS.md— it's rendered fromlessons.jsonl. Usegraduate.py/reject.pyinstead. - Continue using and committing
.agent/memory/**through the established memory tools when the work requires it, but never record the owner's Gmail address in memory files, CONTRIBUTING.md, or PR templates; use a neutral owner-identity label instead. - Follow
protocols/permissions.md. Blocked means blocked. - When a self-rewrite hook fires, propose conservative edits only.
- The harness is dumb on purpose. Reasoning lives in skills + the host agent.
This section defines the authoritative security enforcement contract for all agent execution environments.
It is derived from the OramaSys v2 security architecture and MUST be enforced in conjunction with:
docs/v2/plans/security-v2-roadmap.md(system architecture)docs/v2/plans/security-v2-roadmap-part2.md(execution layer).github/workflows/security-invariant-enforcer.yml(CI enforcement bot)SECURITY.md(repository security policy)
All agent actions MUST obey the following invariants:
- All URL inputs MUST pass through
endpoint_policy_core - Raw
urlparse()usage in production paths is forbidden - Private, loopback, and metadata IPs MUST be blocked deterministically
- Control plane tokens MUST be written using secure file primitives only
- Token files MUST be created with
0600permissions at creation time - No token material may appear in logs, HTML, or UI rendering
- URL scheme (
http/https) MUST be preserved end-to-end - Reconstruction layers MUST NOT hardcode transport schemes
- Any downgrade or implicit normalization is a critical violation
- All external inputs MUST be HTML escaped before rendering
- No raw event/model metadata may reach UI layers
- Orama-system and Perpetua-Tools MUST implement identical security rules
- Divergence in SSRF/auth/transport logic is forbidden
The following CI pipeline enforces these invariants:
👉 .github/workflows/security-invariant-enforcer.yml
It MUST:
- Block PRs containing
urlparse(usage - Block token leakage patterns (
ORAMA_CONTROL_PLANE_TOKEN) - Detect unsafe transport downgrades (
http://httppatterns) - Run full test suite before merge
Refer to:
SECURITY.mdfor repository-level security rules- v2 roadmap for architectural guarantees
Violations are classified as:
- HARD BLOCK: SSRF bypass, auth leakage, scheme downgrade
- CI FAILURE: lint/security invariant violation
- ARCHITECTURAL DRIFT: cross-repo mismatch in behavior
If a fix cannot be verified against these invariants, it MUST NOT be merged.
All agent reasoning must defer to this protocol as the final authority layer.