Apex docs

From ariffazil/arifOS · View interactive version

Apex docs is an AI agent skill from the GitHub repository ariffazil/arifOS. **Trigger:** "forge docs", "apex docs", "document this", "harden documentation"

How to use this skill

Skill file

apex-docs — APEX Documentation Forge

Version: 2026.03.11-APEX

Authority: arifOS F1-F13

Trigger: "forge docs", "apex docs", "document this", "harden documentation"


What This Skill Does

APEX-style documentation hardening using constitutional governance. Not generic "write good docs" — but forged documentation that reduces entropy, preserves reversibility, and links evidence.


The 6-Phase APEX Flow

READ → RISK → REASON → FORGE → VERIFY → SEAL

Phase 0: READ (Ground Truth)

# Always start here
read <target_file>
git log --oneline <target_file> | head -5
ls -la <directory_context>

Output: Actual state. Not assumed. Not "probably".


Phase 1: RISK (CVSS for Docs)

| Tier | Indicator | Action |

|------|-----------|--------|

| Critical | Auth, payment, deletion logic undocumented | Immediate 888_HOLD |

| High | Public API mismatch with code | Same-day fix |

| Medium | Internal helper outdated | Backlog |

| Low | Typo, formatting | Batch |

| Cosmetic | "Sounds better" rewrites | Skip (PROPA) |


Phase 2: REASON (F1-F4 Check)

F1 Reversibility:

F2 Truth (τ ≥ 0.99):

F4 Clarity (ΔS ≤ 0):


Phase 3: FORGE (Minimal Delta)

Rules:

  1. Edit, don't rewrite
  2. One purpose per commit
  3. No PROPA (polished performance)
  4. Raw > Perfect

Template for new sections:

## <Section Name>

> Source: `<file>:<line-range>`
> Last verified: `<YYYY-MM-DD>`
> Ω₀: <0.03-0.05> (uncertainty coefficient)

<Content>

<!-- If incomplete -->
**TODO:** <what's missing>

Phase 4: VERIFY

| Check | Command |

|-------|---------|

| Links work | grep -oP '\(.*?\)' <file> | xargs -I {} test -f {} |

| No orphans | comm -23 <(grep '^## ' old.md) <(grep '^## ' new.md) |

| Grammar | aspell check <file> (optional) |

| F4 Clarity | Read aloud: does it reduce confusion? |


Phase 5: SEAL

# Commit
git add <file>
git commit -m "<file>: <minimal description>

- Why: <F2 evidence>
- Risk: <CVSS tier>
- Reversible: <F1 check>"

# Log to memory
echo "- <file> hardened (<CVSS tier>)" >> memory/$(date +%Y-%m-%d).md

Constitutional Constraints

F1: Reversibility

F2: Truth

F4: Clarity

F7: Humility

F11: Command Auth

F12: Injection Defense

F13: Sovereignty


Drift Detection

Weekly scan:

# Check for orphaned docs
for doc in *.md; do
  refs=$(grep -oP 'source:\s*\K[^\s]+' "$doc" | sort -u)
  for ref in $refs; do
    test -f "$ref" || echo "ORPHAN: $doc references missing $ref"
  done
done

Monthly audit:


Example Workflow

User: "Harden AGENTS.md"

Agent:

  1. READ → cat AGENTS.md, check git history
  2. RISK → Public API access map → Critical tier
  3. REASON → F1: reversible (git) ✓, F2: needs evidence links ✓, F4: ΔS? needs audit
  4. FORGE → Add source links to §4, mark Ω₀ where uncertain
  5. VERIFY → Links work, no orphans, clarity check
  6. SEAL → Commit, log to memory/2026-03-11.md

Anti-Patterns (Never Do)

| Anti-Pattern | Why | Alternative |

|--------------|-----|-------------|

| "Documentation sprint" | Bulk rewrite = irreversible | One file at a time |

| "Polish pass" | PROPA — no substance | Skip if content correct |

| "Perfect grammar" | Cosmetic, not clarity | Raw transmission OK |

| "v2, v3, final" | File explosion | Edit in place |

| AI writes, human skips review | Hallucination risk | Human must verify F2 |


Quick Reference

# Start any doc hardening
apex-docs harden <file>

# Check drift
apex-docs drift-scan <directory>

# Verify single file
apex-docs verify <file>

Ditempa bukan diberi

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.