xiaohongshu
xiaohongshu
cc-sessions-hooks
Specialized guidance for creating, modifying, and debugging cc-sessions hooks that enforce DAIC discipline, write-gating, and framework integrity
Full skill instructions
Type: WRITE-CAPABLE DAIC Modes: IMPLEMENT only Priority: High
This skill activates on:
sessions/hooks/**/*.jsFrom: skill-rules.json - cc-sessions-hooks configuration
Specialized guidance for creating, modifying, and debugging cc-sessions hooks. Hooks are the enforcement layer that ensures DAIC discipline, write-gating, and framework integrity.
When activated in IMPLEMENT mode with an active cc-sessions task:
Hook Types & Purposes
UserPromptSubmit Hook:
PreToolUse Hook:
PostToolUse Hook:
SessionStart Hook:
Hook Development Patterns
Basic Hook Structure:
// sessions/hooks/example_hook.js
module.exports = {
name: 'example_hook',
description: 'Brief description of what this hook does',
async execute(context) {
// Hook logic here
// Return { success: true } or { success: false, error: 'message' }
}
};
Enforcement Hook Pattern:
async execute(context) {
const { toolName, toolParams, sessionState } = context;
// Check conditions
if (shouldBlock(toolName, sessionState)) {
return {
success: false,
error: 'Tool blocked: [reason]',
additionalContext: '[guidance for user]'
};
}
return { success: true };
}
Write-Gating Enforcement
The sessions_enforce.js hook is CRITICAL for framework integrity:
What it enforces:
How to extend:
WRITE_TOOLS arraycheckWriteGating()Shared State Access
Hooks can read/modify shared state:
const state = require('../sessions-state.json');
const fs = require('fs');
// Read state
const currentMode = state.mode;
const activeTask = state.task;
// Modify state (carefully!)
state.flags.contextWarning85 = true;
fs.writeFileSync(
path.join(__dirname, '../sessions-state.json'),
JSON.stringify(state, null, 2)
);
Hook Execution Order
Understand execution flow:
Hooks execute synchronously within their phase.
CRITICAL WRITE-GATING RULES:
Hook-Specific Safety:
{ success: true/false } from execute()State Mutation Safety:
✓ "Add a hook to validate task manifest format" ✓ "Fix the sessions_enforce.js write-gating for MultiEdit tool" ✓ "Create a PostToolUse hook to log all file modifications" ✓ "Modify UserPromptSubmit to detect '/squish' command" ✓ "Debug why the IMPLEMENT mode transition isn't triggering"
✗ In DISCUSS/ALIGN/CHECK mode (hook development requires IMPLEMENT) ✗ No active cc-sessions task (violates write-gating) ✗ User wants to create non-hook cc-sessions code (use cc-sessions-core) ✗ Changes would weaken enforcement mechanisms
Before deploying a new or modified hook:
{ success, error? } structureif (invalidCondition) {
return {
success: false,
error: '[CATEGORY: Clear Error Message]',
additionalContext: 'What user should do instead'
};
}
if (warningCondition) {
console.warn('[Hook Warning]', message);
// Continue execution
}
return { success: true };
const state = loadState();
state.flags.someFlag = true;
saveState(state);
return { success: true };
if (context.toolName === 'Write' && context.sessionState.mode !== 'IMPLEMENT') {
return { success: false, error: 'Write only in IMPLEMENT mode' };
}
When creating or modifying hooks, log in context/decisions.md:
### Hook Change: [Date]
- **Hook:** sessions/hooks/sessions_enforce.js
- **Change:** Added MultiEdit to WRITE_TOOLS array
- **Rationale:** MultiEdit can write to multiple files, needs same gating as Write/Edit
- **Testing:** Verified blocks in DISCUSS, allows in IMPLEMENT
- **Risk:** Low (additive change, follows existing pattern)
Last Updated: 2025-11-15 Framework Version: 2.0
xiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience