context-first-gatekeeping
Skill51 starsChanged 7 months agoMITView on GitHub
The absolute gatekeeping factor for app development success. Context-first, never act without verified planning, unbroken hierarchy chains, and domain boundaries enforced.
In this repository17 other files it gives its agents.
- .github/copilot-instructions.mdCopilot instructions
- .github/get-shit-done/templates/copilot-instructions.mdCopilot instructions
- debug-orchestrationSkill
- delegation-intelligenceSkill
- hivefiver-bilingual-tutorSkill
- hivefiver-domain-pack-routerSkill
- hivefiver-gsd-compatSkill
- hivefiver-mcp-research-loopSkill
- hivefiver-persona-routingSkill
- hivefiver-ralph-taskingSkill
- hivefiver-skill-auditorSkill
- hivefiver-spec-distillationSkill
- hivemind-architect-strategistSkill
- hivemind-governanceSkill
- parallel-debugging-hivemindSkill
- sequential-orchestrationSkill
- systematic-debugging-hivemindSkill
The file
We split this skill into the rules it gives an agent
6 rules. About 0 are common, 3 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 32
Check anchors for constraints (list_anchors)
- Very specific: line 33
Verify chain integrity (think_back)
- Distinctive: line 141
Before ANY implementation action:
- Distinctive: line 162
When a gate fails:
- Distinctive: line 169
No plan found → Ask user to provide/confirm plan
- Very specific: line 173
No trajectory → Must declare_intent (new session)
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
<EXTREMELY-IMPORTANT>
This is the absolute gatekeeping factor. NEVER ACT WITHOUT SUCCESS RETRIEVAL OF PLANNING.
Skipping this gatekeeping is the #1 cause of app development failures.
</EXTREMELY-IMPORTANT>Context-First Gatekeeping Skill
The Prime Directive
NEVER ACT WITHOUT SUCCESS RETRIEVAL OF PLANNING
This is the absolute gatekeeping factor that determines whether app development succeeds or fails.
The Five Pillars
Pillar 1: Context-First Protocol
Before ANY action:
- Load context (
scan_hierarchy) - Recall relevant memories (
recall_mems) - Check anchors for constraints (
list_anchors) - Verify chain integrity (
think_back)
Pattern:
LOAD → VERIFY → ACTNEVER: Assume, guess, or "I think I remember..."
Pillar 2: Parent Hierarchy Must Exist
Unbroken chain requirement:
Trajectory (Level 1)
└── Tactic (Level 2)
└── Action (Level 3)Validation:
function validateHierarchy(): boolean {
const hierarchy = scan_hierarchy({ action: "status" })
// Level 1: Trajectory must exist
if (!hierarchy.trajectory) {
throw new Error("NO TRAJECTORY - Use declare_intent first")
}
// Level 2: Tactic must exist for actions
if (!hierarchy.tactic && isActionLevel()) {
throw new Error("NO TACTIC - Use map_context first")
}
// Level 3: Chain must be unbroken
const ancestors = getAncestors()
if (ancestors.length < requiredLevel) {
throw new Error("BROKEN CHAIN - Repair with map_context")
}
return true
}Pillar 3: Never Act Without Verified Planning
Planning must be retrieved, not assumed:
// WRONG - Acting on assumption
// "I remember we planned to do X, let me implement it"
// RIGHT - Verifying planning exists
const plan = recall_mems({ query: "plan trajectory tactic" })
if (!plan || plan.length === 0) {
throw new Error("NO PLAN FOUND - Create plan before acting")
}
// THEN act based on verified planPillar 4: Domain Boundaries Enforced
Never cross domains without explicit approval:
| Domain | Allowed Paths | Forbidden Paths |
| Backend | src/lib/, src/tools/, src/schemas/, src/hooks/ | src/dashboard/, src/views/ |
| Frontend | src/dashboard/, src/views/, src/components/ | src/lib/, src/tools/, src/schemas/ |
| Shared | src/types/, src/utils/, tests/ | None (can cross) |
Validation:
function validateDomainBoundary(files: string[], domain: string): boolean {
const boundaries = DOMAIN_BOUNDARIES[domain]
for (const file of files) {
const inAllowed = boundaries.allowed.some(p => file.startsWith(p))
const inForbidden = boundaries.forbidden.some(p => file.startsWith(p))
if (!inAllowed || inForbidden) {
throw new Error(`DOMAIN VIOLATION: ${file} not in ${domain}`)
}
}
return true
}Pillar 5: Context-Purified State
After context compaction, NEVER trust memory:
// After compaction event
if (justCompacted) {
// RELOAD everything
think_back({ mode: "full" }) // Reload context
recall_mems({ query: "recent" }) // Reload memories
list_anchors() // Reload constraints
// VERIFY chain still intact
validateHierarchy()
}The Gatekeeping Checklist
Before ANY implementation action:
┌─────────────────────────────────────────────────────────────┐
│ GATEKEEPING CHECKLIST │
├─────────────────────────────────────────────────────────────┤
│ [ ] 1. Trajectory exists? (declare_intent) │
│ [ ] 2. Tactic defined? (map_context) │
│ [ ] 3. Plan retrieved from mems? (recall_mems) │
│ [ ] 4. Anchors loaded? (list_anchors) │
│ [ ] 5. Chain unbroken? (scan_hierarchy) │
│ [ ] 6. Drift acceptable (<60)? (think_back) │
│ [ ] 7. Domain boundaries OK? (validateDomainBoundary) │
│ [ ] 8. No pending failures? (brain.metrics.failures) │
└─────────────────────────────────────────────────────────────┘
IF ANY CHECK FAILS → STOP, FIX BEFORE PROCEEDINGFailure Escalation Protocol
When a gate fails:
Level 1: Auto-Recoverable
- Missing tactic →
map_context({ level: "tactic" }) - High drift →
think_back({ mode: "full" })
Level 2: User Guidance Needed
- No plan found → Ask user to provide/confirm plan
- Domain violation → Ask user for cross-domain approval
Level 3: Critical - Stop Chain
- No trajectory → Must
declare_intent(new session) - Broken chain → Must manually repair hierarchy
Integration with Sequential Orchestration
This skill is the first step in sequential-orchestration:
1. context-first-gatekeeping (THIS SKILL)
↓ All gates pass
2. sequential-orchestration
↓ Sequential delegation
3. export_cycle
↓ Intelligence captured
4. map_context
↓ Hierarchy updatedRed Flags - Immediate Stop
| Red Flag | Meaning | Required Action |
| "I think..." | Assumption, not verified | STOP, verify with recall_mems |
| "Let me just..." | Bypassing gatekeeping | STOP, run gatekeeping checklist |
| "Probably works" | No verification | STOP, run quality gates |
| "I'll fix later" | Leaving broken chain | STOP, fix now before proceeding |
| "Crossing to other domain" | Boundary violation | STOP, get approval or reroute |
Quick Commands
# Full gatekeeping check
scan_hierarchy({ action: "status" }) # Check hierarchy
think_back({ mode: "check" }) # Check drift
recall_mems({ query: "plan" }) # Check planning
list_anchors() # Check constraints
# Repair broken chain
map_context({ level: "tactic", content: "..." })
map_context({ level: "action", content: "..." })
# Context recovery
think_back({ mode: "full" })Gatekeeping Flow Diagram
digraph gatekeeping {
"Action Requested" [shape=doublecircle];
"Trajectory Exists?" [shape=diamond];
"Declare Intent" [shape=box];
"Tactic Defined?" [shape=diamond];
"Map Context" [shape=box];
"Plan Retrieved?" [shape=diamond];
"Recall Mems" [shape=box];
"Chain Unbroken?" [shape=diamond];
"Think Back" [shape=box];
"Drift OK?" [shape=diamond];
"Domain OK?" [shape=diamond];
"Get Approval" [shape=box];
"PROCEED" [shape=doublecircle, style=filled, fillcolor=green];
"STOP" [shape=doublecircle, style=filled, fillcolor=red];
"Action Requested" -> "Trajectory Exists?";
"Trajectory Exists?" -> "Declare Intent" [label="no"];
"Trajectory Exists?" -> "Tactic Defined?" [label="yes"];
"Declare Intent" -> "Tactic Defined?";
"Tactic Defined?" -> "Map Context" [label="no"];
"Tactic Defined?" -> "Plan Retrieved?" [label="yes"];
"Map Context" -> "Plan Retrieved?";
"Plan Retrieved?" -> "Recall Mems" [label="no"];
"Plan Retrieved?" -> "Chain Unbroken?" [label="yes"];
"Recall Mems" -> "Chain Unbroken?";
"Chain Unbroken?" -> "Think Back" [label="no"];
"Chain Unbroken?" -> "Drift OK?" [label="yes"];
"Think Back" -> "Drift OK?";
"Drift OK?" -> "Think Back" [label="no (>60)"];
"Drift OK?" -> "Domain OK?" [label="yes (<60)"];
"Domain OK?" -> "Get Approval" [label="no"];
"Domain OK?" -> "PROCEED" [label="yes"];
"Get Approval" -> "PROCEED" [label="approved"];
"Get Approval" -> "STOP" [label="denied"];
}This skill is a companion to hivemind-governance and must be loaded BEFORE any implementation work begins.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

