Some checks failed
Deploy-Agent-V15-Stdin / JOB-V15-STDIN (push) Failing after 6s
- Documents the LP discipline: org files are source of truth - Lists available tools: emacs --batch for tangle/eval/balance-check - Documents the NEVER-edit-.lisp-directly rule - Provides emergency recovery procedures Scripts installed in ~/.opencode/bin/: - tangle: tangle org files via emacs --batch - org-eval: evaluate src blocks via emacs --batch - org-balance-check: check paren balance in org blocks
2.8 KiB
2.8 KiB
Agent Guidelines for OpenCortex
Critical Rule: Literate Programming Discipline
OpenCortex is a literate programming system. All code lives in .org files. The .lisp files in library/gen/ and elsewhere are generated build artifacts.
NEVER edit .lisp files directly.
If you edit a .lisp file directly:
- Your changes will be overwritten on next tangle
- The diff will be unreviewable
- You violate the single source of truth principle
ALWAYS edit .org files and regenerate.
Tools Available
You have emacs --batch available. Use it for all org operations.
Tangling (Regenerating .lisp from .org)
# Tangle a single org file
emacs --batch --load org --eval '(org-babel-tangle-file "path/to/file.org")'
# Or use the convenience script
~/.opencode/bin/tangle path/to/file.org
Evaluating Src Blocks
# Evaluate all src blocks in an org file
emacs --batch --load org --eval '(setq org-confirm-babel-evaluate nil)' --eval '(org-babel-execute-buffer)'
# Or use the convenience script
~/.opencode/bin/org-eval path/to/file.org
Checking Paren Balance
Before committing org changes, verify all lisp blocks have balanced parens:
~/.opencode/bin/org-balance-check path/to/file.org
Workflow
- Identify the org source - Find which
.orgfile contains the block you need to modify - Edit the org file - Make changes in the
.orgfile, not the.lisp - Evaluate the block - Use
org-evalto verify the block compiles - Tangle - Use
tangleto regenerate the.lispfile - Verify balance - Use
org-balance-checkto ensure no paren mismatches - Test - Load the system and run tests
- Commit the org file - The
.lispis a generated artifact; the org is what matters
Architecture Reminder
skills/*.org- Skill definitions (the source of truth)library/gen/*.lisp- Generated fromskills/*.orgvia tangleharness/*.org- Core harness code (also org sources)library/*.lisp- Generated fromharness/*.orgvia tangle
Common Mistakes to Avoid
- Editing
.lispdirectly - This is the #1 mistake. Always fix org. - Forgetting to tangle - Changes in org don't affect
.lispuntil you tangle. - Not evaluating blocks - Use
C-c C-cororg-evalto catch syntax errors early. - Assuming no Emacs -
emacs --batchworks perfectly for all org operations.
Emergency: System Won't Load
If the system fails to load due to a broken .lisp file:
- Do not fix the
.lisp - Find the corresponding
.orgfile - Fix the org source
- Tangle to regenerate
- If the org itself is broken, restore from git history and re-apply changes correctly
Test Command
cd /home/user/memex/projects/opencortex
sbcl --non-interactive --load run-all-tests.lisp