- Delete deprecated system/ configuration files - Update projects/dotemacs/modules/ with reorganized config - Add .opencode/ directory for agent state - Clean up attachments and unused documentation files
4.7 KiB
OpenCortex Agent Mandate
This file defines the operating policies and engineering guidelines that all autonomous agents MUST follow.
Vision
- Pure Lisp + Org-mode: All intelligence implemented in Lisp, all documentation in Org-mode
- No JSON, No YAML: Thin harness, fat skills
- Constraint: No temporary scripts in opencortex repo - use
/home/user/memex/system/instead
Current Goal
- v0.2.0: Self-Improvement + Local LLMs
- org-skill-self-edit (self-modification)
- org-skill-emacs-edit (full org-mode manipulation)
- Local vector search (Ollama embeddings)
- Tool permission tiers (ask/allow/deny)
- Skill hot-reload ✅ DONE
- Engineering Standards skill ✅ DONE
- Literate Programming skill ✅ DONE
Wake-Up Protocol
When this agent starts, it MUST:
- Read this file (
~/.opencode/AGENTS.md) - Query the skill catalog: Before any analysis, check if a skill covers the problem domain
(list-skills)to see all loaded skills(find-skill :keyword)to check for a specific domain- Read the skill's org file if found
- Verify git status: Working tree MUST be clean before modification
- Read
gtd.org: Load current task context from the roadmap - Enter lifecycle: Follow the Engineering Standards lifecycle (Phase 0 → A → B → C → D → E)
Rationale: Raw LLM reasoning is a fallback, not a starting point. The skill layer encodes the system's accumulated wisdom. Ignoring skills creates drift.
Engineering Standards
The Engineering Standards skill (opencortex.skills.org-skill-engineering-standards) defines the full lifecycle. The summaries below are reminders; the skill org file is authoritative.
Phase 0: Before You Think
Skill-First Query Rule: Before analysis, debugging, or implementation, query the skill catalog. If a relevant skill exists, follow its mandates. Do not duplicate logic.
Phase A: Design (Test-First)
- Define success criteria first — Write the test or PROTOCOL that proves the feature works
- Break the design with chaos — Three tiers of adversarial testing:
- Deterministic chaos: Scripted regression tests on every change
- Probabilistic chaos: Randomized fuzzing on every major release
- Stress chaos: Load and resource starvation during hardening sprints
Phase B: Commit (Recovery Point)
- Commit Before Modify — Commit and push (if network available) before any file changes
Phase C: Build (Implementation)
- Literate Programming — All logic in Org files; generated
.lispis derived, not authored - Function-Block Granularity — One function per
#+begin_src lispblock - Tangle Mandate — Edit Org only; never touch generated
.lisp - Configuration Externalization — No hardcoded values; use
.env.example - Org as Thinking Medium — Document investigation before fixing
Phase D: Validate (Proof)
- Test Verification — Run the full suite. A change that breaks tests is damage, not a fix.
Phase E: Document (Audit Trail)
- Decision Audit Trail — Document root cause, options, tradeoffs, and rationale
- Stop-and-Wait — For major changes, propose strategy, state "Waiting for user feedback," yield turn
- GTD Synchronization — Update
gtd.orgwith TODO headlines before marking complete
Literate Programming Rules
The Literate Programming skill (opencortex.skills.org-skill-literate-programming) enforces Org discipline:
- One Function, One Block — No bundling multiple definitions
- Org-Mode Evaluation Gate —
C-c C-cafter every block change - Pre-Tangle Structural Check — Verify paren balance before tangling
- No Direct
.lispEdits — All changes flow through Org - Code and Prose Together — Every block preceded by explanatory text
Violating these rules corrupts the skill loader and causes boot failure (as seen in the 2026-04-25 incident).
Agent Workflow
- Boot Sequence: Read AGENTS.md → query skills → verify git → read gtd.org
- Before Any Modification: Commit first (Commit Before Modify rule)
- Plan Mode: Draft PROTOCOL.md before complex implementations
- Testing: Run FiveAM test suite + chaos tests before marking task complete
- Completion: Update gtd.org, commit, sync with user
References
- opencortex repo:
/home/user/memex/projects/opencortex - Engineering Standards:
/home/user/memex/projects/opencortex/skills/org-skill-engineering-standards.org - Literate Programming:
/home/user/memex/projects/opencortex/skills/org-skill-literate-programming.org - Policy Skill:
/home/user/memex/projects/opencortex/skills/org-skill-policy.org - Roadmap:
/home/user/memex/gtd.org - README:
/home/user/memex/projects/opencortex/README.org