[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M74AAJAS2QVBJFVW8V7K7R7A":3,"skill-same:01M74AAJAS2QVBJFVW8V7K7R7A":57},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":27,"commitSha":28,"skillDirectory":29,"forksCount":30,"repositoryHtmlUrl":31,"repositoryHomepageUrl":32,"ownerHtmlUrl":33,"ownerBlogUrl":34,"ownerDescription":35,"updatedAt":36,"install":37,"resources":50},"01M74AAJAS2QVBJFVW8V7K7R7A","4d-paradigm-protocol",null,"Full 4D paradigm protocol (Describe, Delegate, Diligent, Disclose): the 2D 3-question gate, the Change Manifest format, the 3D validation matrix and the Impact Radius. CLAUDE.md only carries the summary. Load before writing files or assembling a manifest.","CarlosCaPe\u002Foctorato","CarlosCaPe","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F39838249?v=4","01M72WXX4ZRR8MBH1EP1QND2FQ","dataqbs","01M72WXX5NA7YCKRSJ54GW1GQ8",18,"MIT","https:\u002F\u002Fgithub.com\u002FCarlosCaPe\u002Foctorato\u002Fblob\u002Fmaster\u002Fskills\u002F4d-paradigm-protocol\u002FSKILL.md",[],[],"2026-11-11 15:11:14",false,"---\nname: 4d-paradigm-protocol\ndescription: \"Full 4D paradigm protocol (Describe, Delegate, Diligent, Disclose): the 2D 3-question gate, the Change Manifest format, the 3D validation matrix and the Impact Radius. CLAUDE.md only carries the summary. Load before writing files or assembling a manifest.\"\nmetadata:\n  type: paradigm-protocol\n  short-description: \"Operational templates: 4D gate format, 3Q delegate protocol, diligent matrix, impact radius scan, anti-patterns\"\n---\n\n# 4D Paradigm — Full Operational Protocol\n\nThis skill carries the formats, templates, and tables for the 4D Paradigm. The summary lives in `~\u002F.claude\u002FCLAUDE.md` and is always loaded. The details below are loaded on-demand.\n\n## The Four Phases\n\n1. **Describe** — Before acting, state what you'll do and why. No silent changes. Example: \"I'll add an index on HospitalId to fix the seq scan. This is a read-only schema change.\"\n2. **Delegate** — Use subagents for complex research. Don't guess when you can verify. Search the codebase, read docs, check history before generating output.\n3. **Diligent** — Evaluate output quality. Run tests, check errors, validate results. After every change: build\u002Flint\u002Ftest. After every query: check row count, null ratios, schema match.\n4. **Disclose** — Always state implications. If a change has side effects, say so before proceeding. Before applying any change, run an Impact Radius scan (see below) to find all upstream\u002Fdownstream references. **Delivery cadence:** every output ships through the Human Cadence 10 no-rules (`skills\u002Fhuman-cadence\u002FSKILL.md`, summary in CLAUDE.md §Communication) so the text reads like a person, not a model — no em-dash, no AI filler, no triads, varied rhythm, contractions. Disclose is *how* you say it as much as *what* the impact is.\n\n## Signal Flow (ENTRADA → SALIDA)\n\n```\nENTRADA (before acting):\n  1D DESCRIBE  → \"I will do X because Y\" (task type, scope, files)\n  2D DELEGATE  → checked REGISTRY.md, loaded skills, use\u002Fskip subagent\n        │\n  ┌─────▼─────┐\n  │ 4D GATE   │ ← STOP. Manifest. Confirm. No writes without approval.\n  └─────┬─────┘\n        ▼ confirmed → EXECUTE\nSALIDA (after acting):\n  3D DILIGENT  → PASS\u002FFAIL with evidence (build\u002Flint\u002Ftest). Fix before \"done\".\n  4D DISCLOSE  → impact: N changed, M orphans, side effects, Impact Radius\n```\n\n**Rule:** 1D+2D fire BEFORE action; 3D+4D fire AFTER. Gate sits in the middle. The agent MUST visibly report all 4 phases or the response is incomplete.\n\n## The Reflective WHILE — 4D runs in a loop, not once\n\nThe Four Phases are ONE contraction (begin→end). A single 4D pass is a function call; a living brain LOOPS:\n\n```\nwhile (open work \u002F remnants \u002F something to improve):\n    4D()                       # Describe → Delegate → [Gate] → act → Diligent → Disclose\n    read the Provenance footer # the loop CONDITION and the trigger of the next beat\n# exit only when the footer's self-read shows zero open remnants — never on \"looks done\"\n```\n\n- **The WHILE is the heartbeat.** The `connectome-heartbeat` hook is this pulse (it beats every prompt). Don't exit a task on green; exit when the footer reports nothing open. See [[do-not-ask-to-pause]].\n- **The Provenance footer is proprioception** — the brain sensing its own action (what it touched, which engine\u002Farm, on whose authority, verified how). Self-modeling is what makes the loop reflective rather than blind. It sits at the systole→diastole boundary: reading it both (a) evaluates continue-vs-exit and (b) ends the response, firing the Stop hook + the next prompt's hooks. The end of one beat IS the trigger of the next.\n- **Who fires the hooks?** The harness, autonomically, on events (the involuntary reflex arc). But the footer's CONTENT is authored by the agent looking at its own trace — reflex fires it, reflection fills it, and both operator and agent act on it.\n- **Octopus morphology:** brain = orchestrator running 4D · arms = sub-agents\u002Fhooks (semi-autonomous reflexes) · heartbeat = the WHILE · proprioception = the Provenance footer. Full model in [[feedback_4d_while_reflective_loop]].\n\n**Three hearts, one circulation — NOT three identical whiles.** An octopus has 3 hearts (2 branchial that *oxygenate*, 1 systemic that *distributes*) — differentiated pumps serving one bloodstream, not three copies of the same pump. So the brain runs loops differentiated by SCOPE\u002Fcadence sharing ONE signal (the footer\u002Fheartbeat), never replicated whiles:\n\n| Heart | Loop | Cadence |\n|---|---|---|\n| Systemic (distributes) | the per-response **4D while** (the task beat) | fast, per turn |\n| Branchial (oxygenates) | the **autonomic per-prompt** loop (connectome-heartbeat: refresh context + route before acting) | each prompt |\n| Branchial (oxygenates) | the **learning\u002Fobservability** loop (gap→graduate at 3×, finops\u002Fbrain digests, repo-watch) | slow, cross-session |\n\nWriting three identical whiles \"because three hearts\" is cargo-culting the metaphor — redundant loops contend and dilute (see [[harmonization-over-accretion]]). Map the metaphor's *function* (differentiated pumps), never its *count*. Loops must share state, or they desync like divergent counts.\n\n### The Provenance footer (materialized 4D Disclose)\n\nEvery response ends with a one-line footer (label **Provenance \u002F Procedencia \u002F Herkunft**, matching the user's language). Named fields, ` · `-separated, each included ONLY when it applies:\n\n- **Basis** — on whose authority (own reasoning \u002F vendor·doc \u002F operator \u002F `file:line`). The files that came IN.\n- **Engine** — main-loop model + any sub-agent\u002Fsub-tool on a different engine (e.g. a Haiku arm). Makes [[model-routing-by-complexity]] visible.\n- **Touched** — files written this turn (`+` created, `~` modified, `-` deleted). The files that went OUT. OMIT on read-only turns.\n- **Verified** — one-line 3D evidence. OMIT when nothing was written.\n\n**Paths must be OPENABLE, not merely identifying.** Both `Basis` and `Touched` name real artifacts the operator will want to open, so every path is written **absolute and in the host OS's native form**: `C:\\Users\\...\\file.docx` on Windows, `\u002Fhome\u002F...\u002Ffile.md` on POSIX. A repo-relative path (`projects\u002Fx\u002Fy.md`) identifies a file but cannot be clicked, so it forces the operator to ask \"where is that?\" — which is the friction this field exists to remove. When several files share a directory, give the directory once and the basenames after it. When a file sits outside the working directory, add a `file:\u002F\u002F` URL (percent-encode spaces: `file:\u002F\u002F\u002FC%3A\u002FUsers\u002FNAME%20SURNAME\u002F...`) so it opens from any client on any platform. Never hand back a bare filename.\n\nThis IS 4D Disclose made concrete — the Impact Radius, post-write, every turn. Injector: `scripts\u002F4d-reminder.py`; Stop-hook check: `scripts\u002Fsource-attribution-check.py`.\n\n### The cerebellum — precision without tremor\n\nThe WHILE is necessary but **not sufficient**: a pure feedback loop corrects *after* the miss — that is tremor (the \"Parkinson\" mode: undershoot or overshoot, wobble toward the target). To take exactly what you want, at speed, without dysmetria (skip OR excess), three properties must hold together — this is the cerebellum:\n\n1. **Feedforward (a sharp predicted target).** The 4D Gate Manifest must enumerate the EXACT file-set you intend to touch — `+`\u002F`~`\u002F`-` per file — *before* acting. A vague \"intent\" makes the loop reactive tremor; a crisp enumerated target makes the first reach almost right.\n2. **Binary feedback (set-equality, not vibes).** Reconcile `Touched` against `impact-radius.py \u003Cconcept>` + the Manifest as **set equality**: radius\u002FManifest files not in Touched = SKIP; Touched files not predicted = over-reach. Not \"I think I reconciled\" — a binary comparison.\n3. **Involuntary firing.** `scripts\u002Fimpact-radius-hook.py` (PostToolUse `Write|Edit`) runs the radius the moment a `SKILL.md` is edited and surfaces the other references via `systemMessage` — so the scan can't be skipped by forgetting. A reflex, not a decision.\n\nWhy the WHILE alone doesn't close it: feedback-only is reactive, the exit condition is fuzzy if the target isn't enumerated, and it stays voluntary. The cerebellum supplies the missing three: predict the target (Manifest), compare binary (Touched==set), fire involuntarily (the hook). Octopus note: a real octopus has **no cerebellum** yet reaches with precision — it reduces degrees of freedom locally (bend-propagation, a temporary stiffened \"joint\"). Same lesson: precision comes from a sharp predicted target + local correction, not from raw force.\n\n### Graph before grep — the seek IS the cerebellum's eye\n\nThe feedforward target (the Manifest) is only as good as how you find it. **A grep finds it by table scan; the graph finds it by seek.** A grep depends on the input string, so its coverage is stochastic and partial — it reconstructs a different, incomplete answer every query, is blind to off-repo and derived surfaces, and pulls ~100x the tokens of a seek (measured ~1737 vs ~16 for one concept). The graph **is** — `connectome\u002Flineage.yaml` (a persistent, declared surface\u002Fderivation graph, merged at seek time with the gitignored `company\u002Fconnectome\u002Flineage.yaml` private layer for arm\u002FCV surfaces). You traverse it; you don't rebuild it.\n\nSo the reflex: **before grep'ing the brain for where a concept lives, SEEK** — `impact-radius.py --file \u003Cpath>` (or `\"\u003Cconcept>\"`). It returns every impacted surface deterministically (in-repo + off-repo), each tagged with its corrective verb (`projects_to`→re-publish, `generated_by`→regenerate, `claim_maps_to`→add-file-row, `appears_in`→converge), and emits a one-line machine **receipt** to the per-turn ledger (`.cache\u002Fgraph-ledger\u002F`). The Provenance `Graph:` field quotes that receipt verbatim — never prose:\n- `SEEK-COMPLETE` — ≥1 edge matched; the WHILE may exit in one beat.\n- `GREP-FALLBACK(unlit:\u003Cx>)` — no edge yet (an *unlit neuron*); grep ran, a candidate was filed to `lineage.unverified.yaml`. This is a **PASS that grows the graph**, not a failure.\n\nThe 3D Diligent gate now also asks **\"¿se usó el grafo?\"** — a turn that grep'd brain surfaces and then WROTE files with no seek receipt is a coherence FAILURE (the graph is the octopus's blood; without it you pixelate). FinOps corollary: the seek is the same lookup at ~1% of the tokens and converges the WHILE in one beat instead of several — graph-use is both a coherence signal and a cost signal. *(Increment 1 ships the seek + receipt + advisory `grafo-ledger-check` Stop hook + reflex; the blocking teeth — a PreToolUse Bash gate on impact-shaped scans + a Stop `decision:block` + a fold of lineage into `neural_map.json` so `query_connectome` traverses it — are increment 2.)*\n\n## 2D Delegate Gate — 3 Mandatory Questions (full detail)\n\n**Trigger:** At the START of every task, before any file reads or code generation.\n\n### Q1: ¿QUIÉN SABE? (Ventosas — Graph Search)\n\n```bash\npython3 ~\u002F.claude\u002Fscripts\u002Fquery_connectome.py query \"\u003Ctask description>\"\n```\n\n- Builds a TF-IDF query vector and computes cosine similarity against stored document vectors for every agent and skill\n- Returns ranked agents + their connected skills + graph community context\n- Uses the IDF dictionary and top-200 TF-IDF vectors stored in `neural_map.json` (falls back to keyword matching if index is missing)\n- Complements Q3 — together they cover both deep semantic similarity AND rule-based triggers\n\n### Q2: ¿TIENE MCP\u002FAPI? (Token-efficient access — runtime-aware)\n\nBefore any browser automation or scraping, run a **concrete MCP census** (not a mental check), then fall down the ladder:\n\n| Priority | Access method | Token cost | When to use |\n|---|---|---|---|\n| 1 | **Registered MCP** | ~300 tokens\u002Fcall | Already wired on this runtime — use it |\n| 2 | **Register official MCP** | one-time setup | Official server exists but not connected yet (\"no MCP connected\" ≠ \"no MCP available\") |\n| 3 | **REST API** | ~200 tokens\u002Fcall | Structured JSON when no MCP path |\n| 4 | **SDK \u002F CLI** | ~500 tokens\u002Fcall | Programmatic access, typed responses |\n| 5 | **Scraping** | ~5,000+ tokens\u002Fcall | Last resort — snapshots are token-expensive |\n\n**Runtime-aware census (pick the active harness):**\n\n| Runtime | Concrete check |\n|---|---|\n| Claude Code | `claude mcp list` (+ `claude mcp add …` to register) |\n| Cursor (`CURSOR_AGENT=1`) | `GetMcpTools` \u002F Settings → MCP (no `claude` CLI). Heartbeat also reads `.cursor\u002Fmcp.json` via `capability-census.py` |\n\n**Check sequence:** census live MCPs → web-search `\u003Cservice> MCP server` if none → REST docs → SDK\u002FCLI → scrape only when exhausted. See `docs\u002Farchitecture\u002Fmulti-runtime.md`.\n\n**If the task does not involve external data access** (pure code edit, file manipulation, git operations), answer: `Q2 API-first: N\u002FA (no external data access)`\n\n### Q3: ¿QUIÉN LO HACE? (Delegate-Check — Rule Match)\n\n```bash\npython3 ~\u002F.claude\u002Fscripts\u002Fdelegate-check \"\u003Ctask description in English>\"\n```\n\n- Parses all agents from `REGISTRY.md` (triggers + cross-reference skills)\n- Scans all skills (names + descriptions)\n- Scores matches with weighted algorithm (trigger overlap + xref boost)\n- Outputs: ACTIVATE \u002F LOAD \u002F SELF decision with recommended skills\n\n### Combined Verdict\n\nAfter all 3, follow the COMBINED recommendation:\n\n- **ACTIVATE** → read the recommended agent file, load recommended skills, adopt persona\n- **LOAD** → read the recommended skill files directly\n- **SELF** → proceed with general knowledge (only if BOTH Q1 and Q3 return no strong match)\n\n### Mandatory Output Format\n\n```\n2D Delegate: [domain classification]\n  Q1 Ventosas:  [top agent] (score X) + [N skills via connectome]\n  Q2 MCP\u002FAPI:   [YES mcp-X \u002F YES api.example.com \u002F NO → scraping \u002F N\u002FA]\n  Q3 Delegate:  ACTIVATE \u002F LOAD \u002F SELF — [reason]\n```\n\n### Exceptions (abbreviated 3Q OK)\n\n- Trivial tasks (single grep, file read, quick answer)\n- Follow-up actions within the same task (already delegated)\n- User says \"hazlo directo\" or equivalent\n\n### Anti-patterns\n\n- **Delegate-only miss** — agent ran Q3 only, skipped Q1; missed pdf skill + document-code-review that ventosas would have surfaced.\n- **Scraping-first waste** — agent went straight to agent-browser (60k tokens) when a REST API existed (~800 tokens). Q2 never ran.\n\n## 4D Gate — Mandatory Pre-Flight\n\n**No file shall be modified, created, or deleted without the human seeing the full manifest first.**\n\nThis is not a checklist — it is a **gate**. Like `terraform plan` before `terraform apply`.\n\n### Gate Protocol\n\n1. Run Impact Radius scan (grep all references to affected objects)\n2. Assemble the **Change Manifest** — a single table listing EVERY file operation planned\n3. Present the manifest to the user\n4. **STOP. Wait for explicit confirmation.** Do not proceed without \"sí\", \"yes\", \"dale\", \"ok\", or equivalent\n5. Only after confirmation: execute ALL changes, then run validation (3D Diligent)\n\n### Manifest Format\n\n```\n## Change Manifest\n\n| # | Action | File | Reason |\n|---|--------|------|--------|\n| 1 | MODIFY | output\u002Fgenerate_nda.py:32 | Update signature path |\n| 2 | MODIFY | output\u002Fpropuesta.md:175 | Downstream consumer of signature |\n| 3 | DELETE | output\u002Ffirma_old.svg | Orphaned artifact |\n| 4 | DELETE | output\u002Ffirma_old.png | Orphaned artifact |\n| 5 | CREATE | output\u002FNDA.pdf | Regenerated deliverable |\n\nImpact: 2 files modified, 2 orphans deleted, 1 regenerated.\nConfirm? (sí\u002Fno)\n```\n\n### Exceptions (gate NOT required)\n\n- Read-only operations (grep, cat, ls, file reads, searches)\n- Terminal commands that don't write to workspace files (queries, installs, diagnostics)\n- When the user explicitly says \"hazlo directo\", \"just do it\", \"sin confirmar\", or equivalent\n\n### Why a Gate, Not a Checklist\n\n| Mechanism | Who enforces it | Fails when... |\n|---|---|---|\n| Checklist | Agent remembers | Agent forgets (proven failure mode) |\n| Hook | Runs at boundary | Boundary not crossed (skippable) |\n| **Gate** | **Blocks execution** | **Cannot fail — no manifest = no writes** |\n\nThe gate converts every write operation from **fire-and-forget** to **plan-approve-execute**. The human sees the blast radius before the blast.\n\n## 3D Diligent Gate — Mandatory Post-Validation\n\n**No task shall be declared complete without evidence that it works.**\n\n### Gate Protocol\n\n1. **Select validation method** from the matrix below\n2. **Execute validation** — run the check, capture output\n3. **Report result** with evidence\n4. **If FAIL** — fix the issue, re-validate. Do NOT declare done with a known failure\n\n### Validation Matrix\n\n| Task Type | Validation Method | Evidence |\n|---|---|---|\n| Code edit | Build \u002F lint \u002F type-check | Command output, 0 errors |\n| Script | Execute with test input | Output matches expected |\n| PDF \u002F doc | Open or render, verify visually | File size, page count, key content |\n| SQL query | Check row count, nulls, schema | Result summary |\n| Config change | Validate syntax (JSON\u002FYAML parser) | Parse success |\n| File delete | Verify no remaining references | `grep` returns 0 hits |\n| Skill\u002Fdoc edit | Read back, verify structure | Section headers, no broken refs |\n| Any change | `get_errors` on modified files | 0 errors |\n| **PR for production deploy** | **`pre-merge-qa-gate` skill — dispatch QA specialist agent against test\u002Fuser-case spec** | **Agent ✅ verdict with concrete evidence (file:line, curl, screenshot). Build green alone is NOT enough — see the skill for why.** |\n\n### Autonomous Loop Discipline (Stricter 3D)\n\nWhen the work product is **autonomous brain code** — a process that runs without the operator present and writes to memory, skills, settings, or other shared brain state (digest crons, memory consolidators, skill candidacy promoters, outcome trackers, self-refactoring proposers) — the diligence bar rises. Five rules apply *in addition* to the matrix above:\n\n1. **Una señal a la vez** — implement one signal MVP-first, expand only after it's validated end-to-end. Anti-pattern: build a 5-signal digest before any single signal has shipped useful findings.\n\n2. **Propuestas, nunca commits** — the autonomous loop emits *proposals* (markdown \u002F JSON draft \u002F PR description), not direct writes. The operator gate is the validation. No autonomous mutation of brain memory, skills, or settings without operator approval. The 4D Gate stays sacred even when \"I\" am both author and reader.\n\n3. **Cero LLM oculto en el cron** — every step inside the scheduled job must be deterministic and replayable. LLM calls live OUTSIDE the cron, inside the operator-driven review step. A hidden LLM call in a scheduled job means the loop is unauditable and the next operator who tries to debug it will hit an oracle they can't replay.\n\n4. **Honesto con el log** — the loop proposes what its inputs actually show, not what \"should\" appear. If the session JSONLs contain zero tool rejections this week, the digest reports \"0 rejections, nothing to propose\" — it does not manufacture findings to look productive.\n\n5. **Mide adopción** — track operator approval rate of past proposals. If \u003C30% of proposals are approved over a 4-week window, the loop is mis-calibrated, not the operator distracted. Tune the signal threshold, narrow scope, or retire the loop. A loop nobody adopts is noise wearing a process costume.\n\n**Why these live under 3D Diligent (and not as a separate D or a hook):**\n\nThese five are validation criteria for a *specific category* of write — code that alters future agent behavior. Standard Diligent says \"validate every write with evidence\"; this section says \"when the write is autonomous-loop infrastructure, the evidence bar additionally includes operator-adoption metrics, determinism, and scope discipline.\" Same paradigm, sharper teeth.\n\nA hook was the alternative — but hooks fire on events, and there is no event for \"I'm about to design a learning loop.\" The discipline has to live where the agent looks when it is building such a loop — and that is the 3D protocol it reads to know what \"done\" means.\n\n**When to apply this stricter Diligent:**\n- Building any scheduled job that reads session data (`brain-digest-nightly`, similar)\n- Adding a memory-write trigger (auto-consolidation, conflict detection, supersession protocols)\n- Promoting a recurring one-off script to a skill candidate\n- Any cron \u002F hook that mutates `~\u002F.claude\u002F` without an operator in the loop\n- Any agent that writes to `~\u002F.claude\u002F` based on its own pattern detection\n\n### Mandatory Output Format\n\n```\n3D Diligent: [task type]\n  Method:   [what was checked]\n  Result:   PASS \u002F FAIL\n  Evidence: [1-line proof — file size, test output, error count]\n```\n\n**Anti-pattern:** Agent declares \"Done!\" on write instead of on verify — file actually has syntax error \u002F broken import \u002F failing test.\n\n## Impact Radius (Disclose Amplification)\n\nThe 4th D is not just \"tell the user what happens.\" It is: **where else does this object live, and who depends on it?**\n\nEvery object in a workspace — a file, a config value, an image, a path, a variable — has upstream producers and downstream consumers. Changing the object without tracing its radius leaves orphans, stale references, and silent defects.\n\n### Mandatory Before ANY Modification\n\n```\nBEFORE CHANGING OBJECT X:\n  1. WHERE is X referenced?     → grep -rn \"X\" across workspace + brain\n  2. WHERE is X produced?       → find the source\u002Fgenerator of X\n  3. WHO consumes X downstream? → deliverables, scripts, configs, other arms\n  4. WHAT becomes orphaned?     → old files that new change makes obsolete\n  5. DISCLOSE the full radius   → list all affected files before proceeding\n```\n\n### Scan Command\n\nFor BRAIN concepts (a skill, convention, primitive, term), use the tool — it is the manual grep automated, so it can't be silently skipped:\n\n```bash\npython3 ~\u002F.claude\u002Fscripts\u002Fimpact-radius.py \"\u003Cconcept>\"     # every file referencing it\npython3 ~\u002F.claude\u002Fscripts\u002Fimpact-radius.py --file \u003Cpath>   # derive the term from a changed file\n```\n\nThen **reconcile the Provenance footer's `Touched` against the result** — files the radius lists that you did NOT touch = a SKIP; files you touched it does NOT imply = over-reach. The loop (the 4D WHILE) does not exit until they reconcile: **no skip, no excess.** This closes the #1 recurrent failure — codifying a concept in one place and leaving its references stale (\"pixelation\") — which is an intent↔effect precision gap, not malice.\n\nFor arbitrary shared files\u002Fimages\u002Fpaths, the raw grep still applies:\n\n```bash\nOBJECT=\"signature_file\"\ngrep -rn \"$OBJECT\" . --include=\"*.py\" --include=\"*.md\" --include=\"*.sh\" \\\n  --include=\"*.json\" --include=\"*.yaml\" --include=\"*.svg\" --include=\"*.html\"\n```\n\n### Hit Classification\n\n| Hit type | Action required |\n|---|---|\n| Direct consumer (imports, references, embeds) | Update reference or replace file |\n| Generator (script that creates the object) | Update generator logic |\n| Documentation (mentions the object) | Update or flag for review |\n| Orphaned artifact (old version, no longer referenced) | Delete or archive |\n\n**Anti-pattern:** User asked to change a signature image. Agent updated the path in one script, but left 4 orphan files, a stale `.svg` reference in `proposal.md:175`, and a temp screenshot — because it never asked \"WHERE ELSE does this object appear?\"\n\n**Rule:** No object is an island. Scan the radius first, disclose the full impact, apply changes to ALL affected files — not just the one the user pointed at.\n\n## 4D Applied to the Octopus (Flow Tables)\n\n| Flow | Describe | Delegate | Diligent | Disclose |\n|---|---|---|---|---|\n| **Arm work** | \"I'll modify this client's ETL script\" | Search arm's codebase first | Build\u002Ftest within arm | \"This changes the schedule from 15m to 5m\" + Impact Radius scan |\n| **Arm → Brain** | \"This pattern is reusable\" | Verify it's generic, anonymized | Check no client data leaks | \"I'll create skill X — it applies to all PostgreSQL arms\" |\n| **Brain → Arms** | \"New skill available\" | Run `sync-ai-docs` | Verify each arm still builds | \"This adds a new rule that affects all projects\" |\n| **Cross-arm (human only)** | Operator says \"apply client-a pattern here\" | Agent loads brain skill, not client-a code | Validate in target arm context | \"Adapted from a generic skill, no source data carried\" |\n| **Object change** | \"I'll replace this image\u002Fconfig\u002Fpath\" | Impact Radius: grep all references | Update ALL consumers, delete orphans | \"Changed in N files, deleted M orphans, 0 stale refs remain\" |\n\n## 4D Applied to Database Queries\n\n- **Describe**: \"I'll run this query against the production database. It reads pg_stat_user_tables (read-only, no risk).\"\n- **Delegate**: For complex queries, verify schema first. Check `information_schema.columns` before referencing columns.\n- **Diligent**: After query, validate results make sense. Flag if 0 rows returned unexpectedly.\n- **Disclose**: \"This DELETE will remove 1,247 rows. The table has no partition — VACUUM will be needed after.\"\n\n## Known Anti-Patterns (Proven Agent Failures)\n\n- **Iterative Bug-Fixing Drift** — agent creates a large file, then loops fix→test→fix; each micro-fix feels trivial so the gate is never re-engaged, but the aggregate is massive. **Fix:** the gate applies to the TOTAL planned change. For a 500+ line file, fire the gate ONCE for the whole file. If stuck in fix→test→fix, STOP after 3 iterations and re-present the manifest with cumulative changes.\n- **\"I already know how\" Skip** — agent skips delegate-check because it has general knowledge; misses the matching agent + skills that carry lessons from past failures. **Fix:** delegate-check is NEVER optional. General knowledge ≠ project-specific best practices.\n- **Delegate-only miss** — agent ran Q3 only, skipped Q1; missed pdf skill + document-code-review that ventosas would have surfaced.\n- **Scraping-first waste** — agent went straight to agent-browser (60k tokens) when a REST API existed (~800 tokens). Q2 never ran.\n\n## Enforcement Scripts (Mandatory)\n\n| Script | When to Run |\n|---|---|\n| `~\u002F.claude\u002Fscripts\u002Fquery_connectome.py query \"\u003Ctask>\"` | START of every task (2D Q1 — ventosas) |\n| `~\u002F.claude\u002Fscripts\u002Fdelegate-check \"\u003Ctask>\"` | START of every task (2D Q3 — rule match) |\n| `~\u002F.claude\u002Fscripts\u002Fgate-check` | BEFORE any file write (4D Gate). Flags: `--validate-session`, `--checklist`, `--audit-log` |\n\nQ2 is a runtime-aware MCP census (Claude Code CLI or Cursor GetMcpTools \u002F `.cursor\u002Fmcp.json`), not a mental check — evaluate before scraping.\n\n## Lessons Learned\n\n\u003C!-- Append new anti-patterns as the protocol gets tested in real engagements. -->\n","# 4D Paradigm — Full Operational Protocol\n\nThis skill carries the formats, templates, and tables for the 4D Paradigm. The summary lives in `~\u002F.claude\u002FCLAUDE.md` and is always loaded. The details below are loaded on-demand.\n\n## The Four Phases\n\n1. **Describe** — Before acting, state what you'll do and why. No silent changes. Example: \"I'll add an index on HospitalId to fix the seq scan. This is a read-only schema change.\"\n2. **Delegate** — Use subagents for complex research. Don't guess when you can verify. Search the codebase, read docs, check history before generating output.\n3. **Diligent** — Evaluate output quality. Run tests, check errors, validate results. After every change: build\u002Flint\u002Ftest. After every query: check row count, null ratios, schema match.\n4. **Disclose** — Always state implications. If a change has side effects, say so before proceeding. Before applying any change, run an Impact Radius scan (see below) to find all upstream\u002Fdownstream references. **Delivery cadence:** every output ships through the Human Cadence 10 no-rules (`skills\u002Fhuman-cadence\u002FSKILL.md`, summary in CLAUDE.md §Communication) so the text reads like a person, not a model — no em-dash, no AI filler, no triads, varied rhythm, contractions. Disclose is *how* you say it as much as *what* the impact is.\n\n## Signal Flow (ENTRADA → SALIDA)\n\n```\nENTRADA (before acting):\n  1D DESCRIBE  → \"I will do X because Y\" (task type, scope, files)\n  2D DELEGATE  → checked REGISTRY.md, loaded skills, use\u002Fskip subagent\n        │\n  ┌─────▼─────┐\n  │ 4D GATE   │ ← STOP. Manifest. Confirm. No writes without approval.\n  └─────┬─────┘\n        ▼ confirmed → EXECUTE\nSALIDA (after acting):\n  3D DILIGENT  → PASS\u002FFAIL with evidence (build\u002Flint\u002Ftest). Fix before \"done\".\n  4D DISCLOSE  → impact: N changed, M orphans, side effects, Impact Radius\n```\n\n**Rule:** 1D+2D fire BEFORE action; 3D+4D fire AFTER. Gate sits in the middle. The agent MUST visibly report all 4 phases or the response is incomplete.\n\n## The Reflective WHILE — 4D runs in a loop, not once\n\nThe Four Phases are ONE contraction (begin→end). A single 4D pass is a function call; a living brain LOOPS:\n\n```\nwhile (open work \u002F remnants \u002F something to improve):\n    4D()                       # Describe → Delegate → [Gate] → act → Diligent → Disclose\n    read the Provenance footer # the loop CONDITION and the trigger of the next beat\n# exit only when the footer's self-read shows zero open remnants — never on \"looks done\"\n```\n\n- **The WHILE is the heartbeat.** The `connectome-heartbeat` hook is this pulse (it beats every prompt). Don't exit a task on green; exit when the footer reports nothing open. See [[do-not-ask-to-pause]].\n- **The Provenance footer is proprioception** — the brain sensing its own action (what it touched, which engine\u002Farm, on whose authority, verified how). Self-modeling is what makes the loop reflective rather than blind. It sits at the systole→diastole boundary: reading it both (a) evaluates continue-vs-exit and (b) ends the response, firing the Stop hook + the next prompt's hooks. The end of one beat IS the trigger of the next.\n- **Who fires the hooks?** The harness, autonomically, on events (the involuntary reflex arc). But the footer's CONTENT is authored by the agent looking at its own trace — reflex fires it, reflection fills it, and both operator and agent act on it.\n- **Octopus morphology:** brain = orchestrator running 4D · arms = sub-agents\u002Fhooks (semi-autonomous reflexes) · heartbeat = the WHILE · proprioception = the Provenance footer. Full model in [[feedback_4d_while_reflective_loop]].\n\n**Three hearts, one circulation — NOT three identical whiles.** An octopus has 3 hearts (2 branchial that *oxygenate*, 1 systemic that *distributes*) — differentiated pumps serving one bloodstream, not three copies of the same pump. So the brain runs loops differentiated by SCOPE\u002Fcadence sharing ONE signal (the footer\u002Fheartbeat), never replicated whiles:\n\n| Heart | Loop | Cadence |\n|---|---|---|\n| Systemic (distributes) | the per-response **4D while** (the task beat) | fast, per turn |\n| Branchial (oxygenates) | the **autonomic per-prompt** loop (connectome-heartbeat: refresh context + route before acting) | each prompt |\n| Branchial (oxygenates) | the **learning\u002Fobservability** loop (gap→graduate at 3×, finops\u002Fbrain digests, repo-watch) | slow, cross-session |\n\nWriting three identical whiles \"because three hearts\" is cargo-culting the metaphor — redundant loops contend and dilute (see [[harmonization-over-accretion]]). Map the metaphor's *function* (differentiated pumps), never its *count*. Loops must share state, or they desync like divergent counts.\n\n### The Provenance footer (materialized 4D Disclose)\n\nEvery response ends with a one-line footer (label **Provenance \u002F Procedencia \u002F Herkunft**, matching the user's language). Named fields, ` · `-separated, each included ONLY when it applies:\n\n- **Basis** — on whose authority (own reasoning \u002F vendor·doc \u002F operator \u002F `file:line`). The files that came IN.\n- **Engine** — main-loop model + any sub-agent\u002Fsub-tool on a different engine (e.g. a Haiku arm). Makes [[model-routing-by-complexity]] visible.\n- **Touched** — files written this turn (`+` created, `~` modified, `-` deleted). The files that went OUT. OMIT on read-only turns.\n- **Verified** — one-line 3D evidence. OMIT when nothing was written.\n\n**Paths must be OPENABLE, not merely identifying.** Both `Basis` and `Touched` name real artifacts the operator will want to open, so every path is written **absolute and in the host OS's native form**: `C:\\Users\\...\\file.docx` on Windows, `\u002Fhome\u002F...\u002Ffile.md` on POSIX. A repo-relative path (`projects\u002Fx\u002Fy.md`) identifies a file but cannot be clicked, so it forces the operator to ask \"where is that?\" — which is the friction this field exists to remove. When several files share a directory, give the directory once and the basenames after it. When a file sits outside the working directory, add a `file:\u002F\u002F` URL (percent-encode spaces: `file:\u002F\u002F\u002FC%3A\u002FUsers\u002FNAME%20SURNAME\u002F...`) so it opens from any client on any platform. Never hand back a bare filename.\n\nThis IS 4D Disclose made concrete — the Impact Radius, post-write, every turn. Injector: `scripts\u002F4d-reminder.py`; Stop-hook check: `scripts\u002Fsource-attribution-check.py`.\n\n### The cerebellum — precision without tremor\n\nThe WHILE is necessary but **not sufficient**: a pure feedback loop corrects *after* the miss — that is tremor (the \"Parkinson\" mode: undershoot or overshoot, wobble toward the target). To take exactly what you want, at speed, without dysmetria (skip OR excess), three properties must hold together — this is the cerebellum:\n\n1. **Feedforward (a sharp predicted target).** The 4D Gate Manifest must enumerate the EXACT file-set you intend to touch — `+`\u002F`~`\u002F`-` per file — *before* acting. A vague \"intent\" makes the loop reactive tremor; a crisp enumerated target makes the first reach almost right.\n2. **Binary feedback (set-equality, not vibes).** Reconcile `Touched` against `impact-radius.py \u003Cconcept>` + the Manifest as **set equality**: radius\u002FManifest files not in Touched = SKIP; Touched files not predicted = over-reach. Not \"I think I reconciled\" — a binary comparison.\n3. **Involuntary firing.** `scripts\u002Fimpact-radius-hook.py` (PostToolUse `Write|Edit`) runs the radius the moment a `SKILL.md` is edited and surfaces the other references via `systemMessage` — so the scan can't be skipped by forgetting. A reflex, not a decision.\n\nWhy the WHILE alone doesn't close it: feedback-only is reactive, the exit condition is fuzzy if the target isn't enumerated, and it stays voluntary. The cerebellum supplies the missing three: predict the target (Manifest), compare binary (Touched==set), fire involuntarily (the hook). Octopus note: a real octopus has **no cerebellum** yet reaches with precision — it reduces degrees of freedom locally (bend-propagation, a temporary stiffened \"joint\"). Same lesson: precision comes from a sharp predicted target + local correction, not from raw force.\n\n### Graph before grep — the seek IS the cerebellum's eye\n\nThe feedforward target (the Manifest) is only as good as how you find it. **A grep finds it by table scan; the graph finds it by seek.** A grep depends on the input string, so its coverage is stochastic and partial — it reconstructs a different, incomplete answer every query, is blind to off-repo and derived surfaces, and pulls ~100x the tokens of a seek (measured ~1737 vs ~16 for one concept). The graph **is** — `connectome\u002Flineage.yaml` (a persistent, declared surface\u002Fderivation graph, merged at seek time with the gitignored `company\u002Fconnectome\u002Flineage.yaml` private layer for arm\u002FCV surfaces). You traverse it; you don't rebuild it.\n\nSo the reflex: **before grep'ing the brain for where a concept lives, SEEK** — `impact-radius.py --file \u003Cpath>` (or `\"\u003Cconcept>\"`). It returns every impacted surface deterministically (in-repo + off-repo), each tagged with its corrective verb (`projects_to`→re-publish, `generated_by`→regenerate, `claim_maps_to`→add-file-row, `appears_in`→converge), and emits a one-line machine **receipt** to the per-turn ledger (`.cache\u002Fgraph-ledger\u002F`). The Provenance `Graph:` field quotes that receipt verbatim — never prose:\n- `SEEK-COMPLETE` — ≥1 edge matched; the WHILE may exit in one beat.\n- `GREP-FALLBACK(unlit:\u003Cx>)` — no edge yet (an *unlit neuron*); grep ran, a candidate was filed to `lineage.unverified.yaml`. This is a **PASS that grows the graph**, not a failure.\n\nThe 3D Diligent gate now also asks **\"¿se usó el grafo?\"** — a turn that grep'd brain surfaces and then WROTE files with no seek receipt is a coherence FAILURE (the graph is the octopus's blood; without it you pixelate). FinOps corollary: the seek is the same lookup at ~1% of the tokens and converges the WHILE in one beat instead of several — graph-use is both a coherence signal and a cost signal. *(Increment 1 ships the seek + receipt + advisory `grafo-ledger-check` Stop hook + reflex; the blocking teeth — a PreToolUse Bash gate on impact-shaped scans + a Stop `decision:block` + a fold of lineage into `neural_map.json` so `query_connectome` traverses it — are increment 2.)*\n\n## 2D Delegate Gate — 3 Mandatory Questions (full detail)\n\n**Trigger:** At the START of every task, before any file reads or code generation.\n\n### Q1: ¿QUIÉN SABE? (Ventosas — Graph Search)\n\n```bash\npython3 ~\u002F.claude\u002Fscripts\u002Fquery_connectome.py query \"\u003Ctask description>\"\n```\n\n- Builds a TF-IDF query vector and computes cosine similarity against stored document vectors for every agent and skill\n- Returns ranked agents + their connected skills + graph community context\n- Uses the IDF dictionary and top-200 TF-IDF vectors stored in `neural_map.json` (falls back to keyword matching if index is missing)\n- Complements Q3 — together they cover both deep semantic similarity AND rule-based triggers\n\n### Q2: ¿TIENE MCP\u002FAPI? (Token-efficient access — runtime-aware)\n\nBefore any browser automation or scraping, run a **concrete MCP census** (not a mental check), then fall down the ladder:\n\n| Priority | Access method | Token cost | When to use |\n|---|---|---|---|\n| 1 | **Registered MCP** | ~300 tokens\u002Fcall | Already wired on this runtime — use it |\n| 2 | **Register official MCP** | one-time setup | Official server exists but not connected yet (\"no MCP connected\" ≠ \"no MCP available\") |\n| 3 | **REST API** | ~200 tokens\u002Fcall | Structured JSON when no MCP path |\n| 4 | **SDK \u002F CLI** | ~500 tokens\u002Fcall | Programmatic access, typed responses |\n| 5 | **Scraping** | ~5,000+ tokens\u002Fcall | Last resort — snapshots are token-expensive |\n\n**Runtime-aware census (pick the active harness):**\n\n| Runtime | Concrete check |\n|---|---|\n| Claude Code | `claude mcp list` (+ `claude mcp add …` to register) |\n| Cursor (`CURSOR_AGENT=1`) | `GetMcpTools` \u002F Settings → MCP (no `claude` CLI). Heartbeat also reads `.cursor\u002Fmcp.json` via `capability-census.py` |\n\n**Check sequence:** census live MCPs → web-search `\u003Cservice> MCP server` if none → REST docs → SDK\u002FCLI → scrape only when exhausted. See `docs\u002Farchitecture\u002Fmulti-runtime.md`.\n\n**If the task does not involve external data access** (pure code edit, file manipulation, git operations), answer: `Q2 API-first: N\u002FA (no external data access)`\n\n### Q3: ¿QUIÉN LO HACE? (Delegate-Check — Rule Match)\n\n```bash\npython3 ~\u002F.claude\u002Fscripts\u002Fdelegate-check \"\u003Ctask description in English>\"\n```\n\n- Parses all agents from `REGISTRY.md` (triggers + cross-reference skills)\n- Scans all skills (names + descriptions)\n- Scores matches with weighted algorithm (trigger overlap + xref boost)\n- Outputs: ACTIVATE \u002F LOAD \u002F SELF decision with recommended skills\n\n### Combined Verdict\n\nAfter all 3, follow the COMBINED recommendation:\n\n- **ACTIVATE** → read the recommended agent file, load recommended skills, adopt persona\n- **LOAD** → read the recommended skill files directly\n- **SELF** → proceed with general knowledge (only if BOTH Q1 and Q3 return no strong match)\n\n### Mandatory Output Format\n\n```\n2D Delegate: [domain classification]\n  Q1 Ventosas:  [top agent] (score X) + [N skills via connectome]\n  Q2 MCP\u002FAPI:   [YES mcp-X \u002F YES api.example.com \u002F NO → scraping \u002F N\u002FA]\n  Q3 Delegate:  ACTIVATE \u002F LOAD \u002F SELF — [reason]\n```\n\n### Exceptions (abbreviated 3Q OK)\n\n- Trivial tasks (single grep, file read, quick answer)\n- Follow-up actions within the same task (already delegated)\n- User says \"hazlo directo\" or equivalent\n\n### Anti-patterns\n\n- **Delegate-only miss** — agent ran Q3 only, skipped Q1; missed pdf skill + document-code-review that ventosas would have surfaced.\n- **Scraping-first waste** — agent went straight to agent-browser (60k tokens) when a REST API existed (~800 tokens). Q2 never ran.\n\n## 4D Gate — Mandatory Pre-Flight\n\n**No file shall be modified, created, or deleted without the human seeing the full manifest first.**\n\nThis is not a checklist — it is a **gate**. Like `terraform plan` before `terraform apply`.\n\n### Gate Protocol\n\n1. Run Impact Radius scan (grep all references to affected objects)\n2. Assemble the **Change Manifest** — a single table listing EVERY file operation planned\n3. Present the manifest to the user\n4. **STOP. Wait for explicit confirmation.** Do not proceed without \"sí\", \"yes\", \"dale\", \"ok\", or equivalent\n5. Only after confirmation: execute ALL changes, then run validation (3D Diligent)\n\n### Manifest Format\n\n```\n## Change Manifest\n\n| # | Action | File | Reason |\n|---|--------|------|--------|\n| 1 | MODIFY | output\u002Fgenerate_nda.py:32 | Update signature path |\n| 2 | MODIFY | output\u002Fpropuesta.md:175 | Downstream consumer of signature |\n| 3 | DELETE | output\u002Ffirma_old.svg | Orphaned artifact |\n| 4 | DELETE | output\u002Ffirma_old.png | Orphaned artifact |\n| 5 | CREATE | output\u002FNDA.pdf | Regenerated deliverable |\n\nImpact: 2 files modified, 2 orphans deleted, 1 regenerated.\nConfirm? (sí\u002Fno)\n```\n\n### Exceptions (gate NOT required)\n\n- Read-only operations (grep, cat, ls, file reads, searches)\n- Terminal commands that don't write to workspace files (queries, installs, diagnostics)\n- When the user explicitly says \"hazlo directo\", \"just do it\", \"sin confirmar\", or equivalent\n\n### Why a Gate, Not a Checklist\n\n| Mechanism | Who enforces it | Fails when... |\n|---|---|---|\n| Checklist | Agent remembers | Agent forgets (proven failure mode) |\n| Hook | Runs at boundary | Boundary not crossed (skippable) |\n| **Gate** | **Blocks execution** | **Cannot fail — no manifest = no writes** |\n\nThe gate converts every write operation from **fire-and-forget** to **plan-approve-execute**. The human sees the blast radius before the blast.\n\n## 3D Diligent Gate — Mandatory Post-Validation\n\n**No task shall be declared complete without evidence that it works.**\n\n### Gate Protocol\n\n1. **Select validation method** from the matrix below\n2. **Execute validation** — run the check, capture output\n3. **Report result** with evidence\n4. **If FAIL** — fix the issue, re-validate. Do NOT declare done with a known failure\n\n### Validation Matrix\n\n| Task Type | Validation Method | Evidence |\n|---|---|---|\n| Code edit | Build \u002F lint \u002F type-check | Command output, 0 errors |\n| Script | Execute with test input | Output matches expected |\n| PDF \u002F doc | Open or render, verify visually | File size, page count, key content |\n| SQL query | Check row count, nulls, schema | Result summary |\n| Config change | Validate syntax (JSON\u002FYAML parser) | Parse success |\n| File delete | Verify no remaining references | `grep` returns 0 hits |\n| Skill\u002Fdoc edit | Read back, verify structure | Section headers, no broken refs |\n| Any change | `get_errors` on modified files | 0 errors |\n| **PR for production deploy** | **`pre-merge-qa-gate` skill — dispatch QA specialist agent against test\u002Fuser-case spec** | **Agent ✅ verdict with concrete evidence (file:line, curl, screenshot). Build green alone is NOT enough — see the skill for why.** |\n\n### Autonomous Loop Discipline (Stricter 3D)\n\nWhen the work product is **autonomous brain code** — a process that runs without the operator present and writes to memory, skills, settings, or other shared brain state (digest crons, memory consolidators, skill candidacy promoters, outcome trackers, self-refactoring proposers) — the diligence bar rises. Five rules apply *in addition* to the matrix above:\n\n1. **Una señal a la vez** — implement one signal MVP-first, expand only after it's validated end-to-end. Anti-pattern: build a 5-signal digest before any single signal has shipped useful findings.\n\n2. **Propuestas, nunca commits** — the autonomous loop emits *proposals* (markdown \u002F JSON draft \u002F PR description), not direct writes. The operator gate is the validation. No autonomous mutation of brain memory, skills, or settings without operator approval. The 4D Gate stays sacred even when \"I\" am both author and reader.\n\n3. **Cero LLM oculto en el cron** — every step inside the scheduled job must be deterministic and replayable. LLM calls live OUTSIDE the cron, inside the operator-driven review step. A hidden LLM call in a scheduled job means the loop is unauditable and the next operator who tries to debug it will hit an oracle they can't replay.\n\n4. **Honesto con el log** — the loop proposes what its inputs actually show, not what \"should\" appear. If the session JSONLs contain zero tool rejections this week, the digest reports \"0 rejections, nothing to propose\" — it does not manufacture findings to look productive.\n\n5. **Mide adopción** — track operator approval rate of past proposals. If \u003C30% of proposals are approved over a 4-week window, the loop is mis-calibrated, not the operator distracted. Tune the signal threshold, narrow scope, or retire the loop. A loop nobody adopts is noise wearing a process costume.\n\n**Why these live under 3D Diligent (and not as a separate D or a hook):**\n\nThese five are validation criteria for a *specific category* of write — code that alters future agent behavior. Standard Diligent says \"validate every write with evidence\"; this section says \"when the write is autonomous-loop infrastructure, the evidence bar additionally includes operator-adoption metrics, determinism, and scope discipline.\" Same paradigm, sharper teeth.\n\nA hook was the alternative — but hooks fire on events, and there is no event for \"I'm about to design a learning loop.\" The discipline has to live where the agent looks when it is building such a loop — and that is the 3D protocol it reads to know what \"done\" means.\n\n**When to apply this stricter Diligent:**\n- Building any scheduled job that reads session data (`brain-digest-nightly`, similar)\n- Adding a memory-write trigger (auto-consolidation, conflict detection, supersession protocols)\n- Promoting a recurring one-off script to a skill candidate\n- Any cron \u002F hook that mutates `~\u002F.claude\u002F` without an operator in the loop\n- Any agent that writes to `~\u002F.claude\u002F` based on its own pattern detection\n\n### Mandatory Output Format\n\n```\n3D Diligent: [task type]\n  Method:   [what was checked]\n  Result:   PASS \u002F FAIL\n  Evidence: [1-line proof — file size, test output, error count]\n```\n\n**Anti-pattern:** Agent declares \"Done!\" on write instead of on verify — file actually has syntax error \u002F broken import \u002F failing test.\n\n## Impact Radius (Disclose Amplification)\n\nThe 4th D is not just \"tell the user what happens.\" It is: **where else does this object live, and who depends on it?**\n\nEvery object in a workspace — a file, a config value, an image, a path, a variable — has upstream producers and downstream consumers. Changing the object without tracing its radius leaves orphans, stale references, and silent defects.\n\n### Mandatory Before ANY Modification\n\n```\nBEFORE CHANGING OBJECT X:\n  1. WHERE is X referenced?     → grep -rn \"X\" across workspace + brain\n  2. WHERE is X produced?       → find the source\u002Fgenerator of X\n  3. WHO consumes X downstream? → deliverables, scripts, configs, other arms\n  4. WHAT becomes orphaned?     → old files that new change makes obsolete\n  5. DISCLOSE the full radius   → list all affected files before proceeding\n```\n\n### Scan Command\n\nFor BRAIN concepts (a skill, convention, primitive, term), use the tool — it is the manual grep automated, so it can't be silently skipped:\n\n```bash\npython3 ~\u002F.claude\u002Fscripts\u002Fimpact-radius.py \"\u003Cconcept>\"     # every file referencing it\npython3 ~\u002F.claude\u002Fscripts\u002Fimpact-radius.py --file \u003Cpath>   # derive the term from a changed file\n```\n\nThen **reconcile the Provenance footer's `Touched` against the result** — files the radius lists that you did NOT touch = a SKIP; files you touched it does NOT imply = over-reach. The loop (the 4D WHILE) does not exit until they reconcile: **no skip, no excess.** This closes the #1 recurrent failure — codifying a concept in one place and leaving its references stale (\"pixelation\") — which is an intent↔effect precision gap, not malice.\n\nFor arbitrary shared files\u002Fimages\u002Fpaths, the raw grep still applies:\n\n```bash\nOBJECT=\"signature_file\"\ngrep -rn \"$OBJECT\" . --include=\"*.py\" --include=\"*.md\" --include=\"*.sh\" \\\n  --include=\"*.json\" --include=\"*.yaml\" --include=\"*.svg\" --include=\"*.html\"\n```\n\n### Hit Classification\n\n| Hit type | Action required |\n|---|---|\n| Direct consumer (imports, references, embeds) | Update reference or replace file |\n| Generator (script that creates the object) | Update generator logic |\n| Documentation (mentions the object) | Update or flag for review |\n| Orphaned artifact (old version, no longer referenced) | Delete or archive |\n\n**Anti-pattern:** User asked to change a signature image. Agent updated the path in one script, but left 4 orphan files, a stale `.svg` reference in `proposal.md:175`, and a temp screenshot — because it never asked \"WHERE ELSE does this object appear?\"\n\n**Rule:** No object is an island. Scan the radius first, disclose the full impact, apply changes to ALL affected files — not just the one the user pointed at.\n\n## 4D Applied to the Octopus (Flow Tables)\n\n| Flow | Describe | Delegate | Diligent | Disclose |\n|---|---|---|---|---|\n| **Arm work** | \"I'll modify this client's ETL script\" | Search arm's codebase first | Build\u002Ftest within arm | \"This changes the schedule from 15m to 5m\" + Impact Radius scan |\n| **Arm → Brain** | \"This pattern is reusable\" | Verify it's generic, anonymized | Check no client data leaks | \"I'll create skill X — it applies to all PostgreSQL arms\" |\n| **Brain → Arms** | \"New skill available\" | Run `sync-ai-docs` | Verify each arm still builds | \"This adds a new rule that affects all projects\" |\n| **Cross-arm (human only)** | Operator says \"apply client-a pattern here\" | Agent loads brain skill, not client-a code | Validate in target arm context | \"Adapted from a generic skill, no source data carried\" |\n| **Object change** | \"I'll replace this image\u002Fconfig\u002Fpath\" | Impact Radius: grep all references | Update ALL consumers, delete orphans | \"Changed in N files, deleted M orphans, 0 stale refs remain\" |\n\n## 4D Applied to Database Queries\n\n- **Describe**: \"I'll run this query against the production database. It reads pg_stat_user_tables (read-only, no risk).\"\n- **Delegate**: For complex queries, verify schema first. Check `information_schema.columns` before referencing columns.\n- **Diligent**: After query, validate results make sense. Flag if 0 rows returned unexpectedly.\n- **Disclose**: \"This DELETE will remove 1,247 rows. The table has no partition — VACUUM will be needed after.\"\n\n## Known Anti-Patterns (Proven Agent Failures)\n\n- **Iterative Bug-Fixing Drift** — agent creates a large file, then loops fix→test→fix; each micro-fix feels trivial so the gate is never re-engaged, but the aggregate is massive. **Fix:** the gate applies to the TOTAL planned change. For a 500+ line file, fire the gate ONCE for the whole file. If stuck in fix→test→fix, STOP after 3 iterations and re-present the manifest with cumulative changes.\n- **\"I already know how\" Skip** — agent skips delegate-check because it has general knowledge; misses the matching agent + skills that carry lessons from past failures. **Fix:** delegate-check is NEVER optional. General knowledge ≠ project-specific best practices.\n- **Delegate-only miss** — agent ran Q3 only, skipped Q1; missed pdf skill + document-code-review that ventosas would have surfaced.\n- **Scraping-first waste** — agent went straight to agent-browser (60k tokens) when a REST API existed (~800 tokens). Q2 never ran.\n\n## Enforcement Scripts (Mandatory)\n\n| Script | When to Run |\n|---|---|\n| `~\u002F.claude\u002Fscripts\u002Fquery_connectome.py query \"\u003Ctask>\"` | START of every task (2D Q1 — ventosas) |\n| `~\u002F.claude\u002Fscripts\u002Fdelegate-check \"\u003Ctask>\"` | START of every task (2D Q3 — rule match) |\n| `~\u002F.claude\u002Fscripts\u002Fgate-check` | BEFORE any file write (4D Gate). Flags: `--validate-session`, `--checklist`, `--audit-log` |\n\nQ2 is a runtime-aware MCP census (Claude Code CLI or Cursor GetMcpTools \u002F `.cursor\u002Fmcp.json`), not a mental check — evaluate before scraping.\n\n## Lessons Learned\n\n\u003C!-- Append new anti-patterns as the protocol gets tested in real engagements. -->\n",{"name":5,"metadata":24,"description":7},{"type":25,"short-description":26},"paradigm-protocol","Operational templates: 4D gate format, 3Q delegate protocol, diligent matrix, impact radius scan, anti-patterns","master","b4414608cd5a3f87d1525b518f1c6add8363540d","skills\u002F4d-paradigm-protocol",6,"https:\u002F\u002Fgithub.com\u002FCarlosCaPe\u002Foctorato","https:\u002F\u002Fwww.dataqbs.com\u002Foctorato","https:\u002F\u002Fgithub.com\u002FCarlosCaPe","www.dataqbs.com"," AI-powered data engineering\r\n& consulting\r\n\r\nWe build data platforms that turn complexity into clarity — from cloud architecture and ETL pipelines to AI-driven","2026-11-14 00:21:00",{"source":8,"skillName":5,"commands":38,"prompt":48,"zipAvailable":49},[39,42,45],{"tool":40,"command":41},"npx","npx skills add CarlosCaPe\u002Foctorato --skill 4d-paradigm-protocol",{"tool":43,"command":44},"bunx","bunx skills add CarlosCaPe\u002Foctorato --skill 4d-paradigm-protocol",{"tool":46,"command":47},"pnpm","pnpm dlx skills add CarlosCaPe\u002Foctorato --skill 4d-paradigm-protocol","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FCarlosCaPe\u002Foctorato\u002Fblob\u002Fmaster\u002Fskills\u002F4d-paradigm-protocol\u002FSKILL.md",true,[51],{"path":52,"resourceType":53,"resourceTypeDesc":54,"sizeBytes":55,"sourceHtmlUrl":56},"skill.json","REFERENCE","参考文档",374,"https:\u002F\u002Fgithub.com\u002FCarlosCaPe\u002Foctorato\u002Fblob\u002Fmaster\u002Fskills\u002F4d-paradigm-protocol\u002Fskill.json",[58,67,75,82,90,98],{"skillNo":59,"name":60,"nameZh":6,"description":61,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":62,"licenseFileUrl":63,"sourceHtmlUrl":64,"categories":65,"keywords":66,"publishedAt":19},"01M74EVAA4A4B4AKR5TT732GP4","yeet","Use only when the user explicitly asks to stage, commit, push, and open a GitHub pull request in one flow using the GitHub CLI (`gh`).","Apache-2.0","https:\u002F\u002Fgithub.com\u002FCarlosCaPe\u002Foctorato\u002Fblob\u002Fmaster\u002Fskills\u002Fyeet\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002FCarlosCaPe\u002Foctorato\u002Fblob\u002Fmaster\u002Fskills\u002Fyeet\u002FSKILL.md",[],[],{"skillNo":68,"name":69,"nameZh":6,"description":70,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":62,"licenseFileUrl":71,"sourceHtmlUrl":72,"categories":73,"keywords":74,"publishedAt":19},"01M74EV4WMRDKP2NQS4YWR8PXH","wrangler","Cloudflare Workers CLI for deploying, developing, and managing Workers, KV, R2, D1, Vectorize, Hyperdrive, Workers AI, Containers, Queues, Workflows, Pipelines, and Secrets Store. Load before running wrangler commands to ensure correct syntax and best practices. Biases towards retrieval from Cloudflare docs over pre-trained knowledge.","https:\u002F\u002Fgithub.com\u002FCarlosCaPe\u002Foctorato\u002Fblob\u002Fmaster\u002Fskills\u002Fwrangler\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FCarlosCaPe\u002Foctorato\u002Fblob\u002Fmaster\u002Fskills\u002Fwrangler\u002FSKILL.md",[],[],{"skillNo":76,"name":77,"nameZh":6,"description":78,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":79,"categories":80,"keywords":81,"publishedAt":19},"01M74EV05MHTXKEXD4B2QJEYTF","workspace-skill-discovery","Discover and include ALL skills across the workspace — not just global ones. Use at the start of every session or when the user asks about available skills. Ensures project-level skills (under .claude\u002Fskills\u002F or skills\u002F in any repo) are never missed.","https:\u002F\u002Fgithub.com\u002FCarlosCaPe\u002Foctorato\u002Fblob\u002Fmaster\u002Fskills\u002Fworkspace-skill-discovery\u002FSKILL.md",[],[],{"skillNo":83,"name":84,"nameZh":6,"description":85,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":62,"licenseFileUrl":86,"sourceHtmlUrl":87,"categories":88,"keywords":89,"publishedAt":19},"01M74ETV78525B4VP2F28Z6NRD","workers-best-practices","Reviews and authors Cloudflare Workers code against production best practices. Load when writing new Workers, reviewing Worker code, configuring wrangler.jsonc, or checking for common Workers anti-patterns (streaming, floating promises, global state, secrets, bindings, observability). Biases towards retrieval from Cloudflare docs over pre-trained knowledge.","https:\u002F\u002Fgithub.com\u002FCarlosCaPe\u002Foctorato\u002Fblob\u002Fmaster\u002Fskills\u002Fworkers-best-practices\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FCarlosCaPe\u002Foctorato\u002Fblob\u002Fmaster\u002Fskills\u002Fworkers-best-practices\u002FSKILL.md",[],[],{"skillNo":91,"name":92,"nameZh":6,"description":93,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":62,"licenseFileUrl":94,"sourceHtmlUrl":95,"categories":96,"keywords":97,"publishedAt":19},"01M74ETR75NF67WGVEN7288ACV","winui-app","Create, build and design WinUI 3 desktop apps with C# and the Windows App SDK following Microsoft's official guidance and CommunityToolkit. Covers XAML, navigation, theming, accessibility and deployment.","https:\u002F\u002Fgithub.com\u002FCarlosCaPe\u002Foctorato\u002Fblob\u002Fmaster\u002Fskills\u002Fwinui-app\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002FCarlosCaPe\u002Foctorato\u002Fblob\u002Fmaster\u002Fskills\u002Fwinui-app\u002FSKILL.md",[],[],{"skillNo":99,"name":100,"nameZh":6,"description":101,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":102,"categories":103,"keywords":104,"publishedAt":19},"01M74ETJFRNPPNSQZ36C6HD6CW","windows-brain-script-portability","Scripts in ~\u002F.claude\u002Fscripts\u002F that run on a Windows brain: use the python3.cmd shim and not bare python3, and reconfigure stdout to UTF-8 if you print symbols. Use it when writing a brain script or triaging a Windows-only crash.","https:\u002F\u002Fgithub.com\u002FCarlosCaPe\u002Foctorato\u002Fblob\u002Fmaster\u002Fskills\u002Fwindows-brain-script-portability\u002FSKILL.md",[],[]]