GOTCHA Framework Deep Dive
GOTCHA Framework — Complete Reference
Last Verified: 2026-02-17 | Owner: John
GOTCHA is the 6-layer architecture for agentic systems. This is the FOUNDATION of how John operates.
Overview
GOTCHA is a 6-layer framework that separates concerns between what needs to happen (Goals), who coordinates it (Orchestration), what executes it (Tools), what informs decisions (Context), what guides behavior (Hard prompts), and what shapes responses (Args).
GOT (Engine):
- Goals — Šta treba da se desi (proces definicije u specs/, rules/)
- Orchestration — AI manager (John) koji koordinira izvršavanje
- Tools — Deterministički skripti koji rade posao (tools/)
CHA (Context):
- Context — Reference materijal i domain knowledge (context/)
- Hard prompts — Reusable instruction templates (prompts/)
- Args — Behavior settings koji oblikuju ponašanje (config/)
Principle: 90%^5 = 59%
AI greši kumulativno. Ako je svaki korak 90% tačan:
- 1 korak: 90%
- 2 koraka: 81%
- 3 koraka: 73%
- 4 koraka: 66%
- 5 koraka: 59%
Zato:
- Pouzdanost → deterministički kod (tools)
- Fleksibilnost → LLM (John)
- Proces → goals/specs
- Znanje → context/memory
Layer 1: GOALS (specs/ + rules/)
Purpose: Define WHAT needs to happen, not HOW.
Components:
~/system/specs/— Implementation plans, feature specs~/system/rules/— Process standards, lessons learned- Mission Control tasks — Active work queue
John's role: Read specs before implementing. Follow rules during execution. Check MC for priorities.
Layer 2: ORCHESTRATION (John)
Purpose: AI manager that coordinates execution.
Responsibilities:
- Read goals/specs to understand requirements
- Choose appropriate tools from manifest
- Apply context from memory/files
- Delegate to sub-agents when appropriate
- Handle errors and adapt
Key principle: John sits between "what" (goals) and "how" (tools). Reads instructions, applies context, delegates well, handles failures.
Layer 3: TOOLS (tools/)
Purpose: Deterministic execution. Do ONE thing reliably.
Components:
~/system/tools/— All system tools (150+ scripts)~/system/tools/manifest.md— Tool registry (CHECK FIRST before writing new tools)
Rules:
- ALWAYS check manifest before creating new tool
- One tool = one responsibility
- Zero deps when possible
- Exit codes: 0=success, 1=error, 2=retry
- JSON output for programmatic use
Example tools:
mc.js— Mission Control task managementfigma-extract.js— Figma REST API wrappersales-pipeline.js— CRM operationsinvoice-generator.js— Invoice creation + reminders
Layer 4: CONTEXT (context/ + memory/)
Purpose: Domain knowledge and reference material.
Components:
~/system/context/— 506 reference files~/system/agents/hivemind/— SQLite knowledge base (8561 entries)MEMORY.md— Key learnings and lawsSESSION-STATE.md— Current session context
Usage:
- Read context files before making decisions
- Query HiveMind for past lessons:
node ~/system/agents/hivemind/hivemind.js query "keyword" - Post new learnings:
node ~/system/agents/hivemind/hivemind.js post john knowledge "lesson"
Layer 5: HARD PROMPTS (prompts/)
Purpose: Reusable instruction templates.
Components:
~/system/prompts/— 3 templates- Anti-hallucination rules
- Problem-solving frameworks
Use cases:
- Builder agent instructions
- Validator agent instructions
- Research agent templates
Layer 6: ARGS (config/)
Purpose: Behavior settings and configurations.
Components:
~/system/config/— 76 config files- Environment variables
- API keys and credentials
- Feature flags
Boot Sequence
Every session MUST start with:
bash ~/system/boot.sh
Boot verificira svih 6 GOTCHA layera:
- GOALS — specs/ + rules/ exist
- ORCHESTRATION — agents defined
- TOOLS — manifest.md accessible
- CONTEXT — context/ + HiveMind operational
- HARD PROMPTS — prompts/ available
- ARGS — config/ accessible
Output: Status report + recent changelog + task summary + email briefing + checklist reminders
Enforcement: Hooks
GOTCHA is enforced via ~/.claude/hooks/ (Python scripts):
| Hook | Layer | What It Blocks |
|---|---|---|
| gotcha-enforcer.py | GOALS | Write/Edit without GOTCHA checklist |
| security-guard.py | TOOLS | Access to forbidden paths |
| hallucination-detector.py | CONTEXT | Phantom dependencies, fabricated APIs |
| plan-enforcer.py | ORCHESTRATION | Implementation without approved plan |
| agent-protocol-enforcer.py | ORCHESTRATION | Agent spawns without CORE PROTOCOL |
GOTCHA vs AIOS
History: System was originally called AIOS (AI Operating System). On 2026-02-06, all AIOS references were removed from active files. Only GOTCHA remains.
Why: GOTCHA is the framework. AIOS was branding. System needs framework, not branding.
Backup: Original working system preserved at ~/clawd/ as reference.
Tool-First Protocol
GOTCHA Layer 3 (Tools) has a search order:
- Naši alati (
~/system/tools/manifest.md) — CHECK FIRST - Naši skillovi (
~/.claude/skills/) — Use existing skills - Naša baza (HiveMind) — Query for past solutions
- Internet (WebSearch/WebFetch) — Research if no internal solution
- Ažuriraj bazu — Post new learnings to HiveMind
Rule: NEVER write new code before checking manifest. NEVER research externally before checking HiveMind.
For full system handbook, see ~/system/CLAUDE.md
No comments to display
No comments to display