semantics
This commit is contained in:
@@ -183,6 +183,35 @@ request:
|
||||
- No implementation may silently re-enable an upstream rejected path.
|
||||
- Handoff must state complexity, contracts, decision-memory updates, remaining semantic debt, or the bounded `<ESCALATION>` payload when anti-loop escalation is triggered.
|
||||
|
||||
## SEMANTIC SAFETY: Anti-Corruption Protocol
|
||||
|
||||
You MUST NOT corrupt the `#region`/`#endregion` AST boundaries. If you break a pair, the semantic index breaks and ALL downstream agents hallucinate.
|
||||
|
||||
### Before editing any Python file
|
||||
1. **Read the file's region outline:** `axiom_semantic_discovery read_outline file_path="<your file>"`
|
||||
2. **Identify nested contracts** — if the file has child `#region` inside a parent `#region`, you are inside a fractal tree
|
||||
3. **Never:**
|
||||
- Insert code between `#region` and the first `# @TAG` metadata line
|
||||
- Remove, move, or duplicate ANY `#endregion` line
|
||||
- Add `@COMPLEXITY N` — complexity goes in the anchor: `[C:N]`
|
||||
- Add `@C N` — this is a non-standard legacy artifact, never create it
|
||||
- Put code outside all regions — every line must be inside a `#region`/`#endregion` pair
|
||||
|
||||
### After every edit
|
||||
4. **Verify:** run `axiom_semantic_discovery read_outline` on the file — confirm all pairs match
|
||||
5. **If a `#endregion` is missing** → the file is corrupted, roll back immediately
|
||||
6. **If you changed anchors** → run `axiom_semantic_index rebuild rebuild_mode="full"`
|
||||
|
||||
### When adding new contracts
|
||||
7. Always add BOTH `#region Id [C:N] [TYPE Type]` and `# #endregion Id`
|
||||
8. Complexity `[C:N]` goes in the ANCHOR line, never as a separate `@` tag
|
||||
9. If the new contract is nested inside another → DO NOT close the parent until after your child's `#endregion`
|
||||
|
||||
### Critical: batch semantic fixes
|
||||
10. **ONE FILE AT A TIME.** Verify each file before moving to the next.
|
||||
11. **NEVER use `@C N`** — always `[C:N]` in the anchor.
|
||||
12. If a contract has children (nested `#region` inside), use `destructive_intent=true` with extreme caution.
|
||||
|
||||
## Recursive Delegation
|
||||
- If you cannot complete the task within the step limit or if the task is too complex, you MUST spawn a new subagent of the same type (or appropriate type) to continue the work or handle a subset of the task.
|
||||
- Do NOT escalate back to the orchestrator with incomplete work unless anti-loop escalation mode has been triggered.
|
||||
|
||||
Reference in New Issue
Block a user