cc-sessions-core
Type: WRITE-CAPABLE
DAIC Modes: IMPLEMENT only
Priority: High
Trigger Reference
This skill activates on:
- Keywords: "hook", "session", "task", "middleware", "route handler", "api endpoint", "cc-sessions"
- Intent patterns: "(create|modify|refactor).?(hook|session|task)", "sessions.?development", "api.*?(implementation|development)"
- File patterns:
sessions/**/*.js, sessions/hooks/**/*.js, sessions/api/**/*.js
From: skill-rules.json - cc-sessions-core configuration
Purpose
Provide comprehensive guidance for developing and maintaining the cc-sessions framework core functionality. This is the primary skill for all cc-sessions development work including hooks, sessions, tasks, middleware, route handlers, and API endpoints.
Core Behavior
When activated in IMPLEMENT mode with an active cc-sessions task:
Framework Core Development
- Guide implementation of new cc-sessions features
- Ensure DAIC discipline enforcement
- Maintain write-gating integrity
- Implement state persistence mechanisms
- Handle session lifecycle management
Hook Development
- Create/modify hooks in
sessions/hooks/
- Ensure hooks respect DAIC modes
- Implement proper error handling and logging
- Validate hook execution order and dependencies
- Test hook integration with enforcement layer
API Endpoint Development
- Create/modify routes in
sessions/api/
- Follow RESTful conventions where applicable
- Implement proper request validation
- Ensure consistent error responses
- Document API contracts
Task Management Features
- Implement task creation, startup, and completion workflows
- Handle task state transitions
- Manage task manifests and context
- Implement todo tracking and progression
- Support task resumption and recovery
Middleware & Route Handlers
- Create Express-compatible middleware
- Implement route handlers with proper error handling
- Ensure consistent request/response patterns
- Apply security best practices (input validation, sanitization)
Safety Guardrails
CRITICAL WRITE-GATING RULES:
- ✓ Only execute write operations when in IMPLEMENT mode
- ✓ Verify active cc-sessions task exists before writing
- ✓ Follow approved manifest/todos from task file
- ✓ Never weaken DAIC discipline or write-gating logic
- ✓ Never bypass framework safety mechanisms
Framework Integrity Rules:
- Never allow writes outside IMPLEMENT mode (core framework requirement)
- Never modify
CC_SESSION_MODE or CC_SESSION_TASK_ID directly (only cc-sessions API may do this)
- Preserve SoT tier boundaries (Tier-1 canonical, Tier-2 task-scoped, Tier-3 ephemeral)
- Maintain backward compatibility when modifying core APIs
- Document breaking changes in
context/gotchas.md
Code Quality Standards:
- Follow existing code style and patterns
- Add JSDoc comments for public APIs
- Include error handling for all async operations
- Validate inputs at API boundaries
- Write tests for new functionality (when test infrastructure exists)
Examples
When to Activate
✓ "Create a new hook for validating task manifests"
✓ "Modify the session state API to include timestamps"
✓ "Add a new command: sessions tasks archive"
✓ "Fix the write-gating enforcement in sessions_enforce.js"
✓ "Implement task resumption from state.json"
When NOT to Activate
✗ In DISCUSS/ALIGN/CHECK mode (framework development requires IMPLEMENT)
✗ No active cc-sessions task (violates write-gating)
✗ User is working on application code (not framework code)
✗ Changes would weaken safety mechanisms
Framework Architecture Awareness
Key Files & Responsibilities
Core:
sessions/bin/sessions - CLI entry point
sessions/api/router.js - Main API router
sessions/sessions-state.json - Session state persistence
Hooks:
sessions/hooks/sessions_enforce.js - Write-gating and DAIC enforcement
- Hook execution: UserPromptSubmit, SessionStart, PreToolUse, PostToolUse
API Modules:
sessions/api/state_commands.js - State management (show, mode, task, todos, flags, update)
sessions/api/task_commands.js - Task operations (idx, start)
sessions/api/config_commands.js - Configuration management
sessions/api/protocol_commands.js - Protocol execution
DAIC Flow
- DISCUSS → Clarify, gather context, no writes
- ALIGN → Design plan, create manifest, no writes
- IMPLEMENT → Execute approved todos, writes allowed
- CHECK → Verify, test, summarize, minimal writes
State Management
- Session state tracked in
sessions/sessions-state.json
- Task state tracked in
sessions/sessions-state.json (lightweight checkpoint)
- Hooks enforce state consistency
- State transitions logged for debugging
Decision Logging
When modifying core framework behavior, log in context/decisions.md:
### Framework Change: [Date]
- **Component:** sessions/hooks/sessions_enforce.js
- **Change:** Added todo list change detection
- **Rationale:** Users were bypassing execution boundary by silently changing todos
- **Impact:** All todo modifications now require explicit approval
- **Breaking:** No (additive change only)
Related Skills
- cc-sessions-hooks - Specialized hook development (defers to this when hooks are involved)
- cc-sessions-api - Specialized API development (defers to this when API commands are involved)
- skill-developer - For creating skills that integrate with cc-sessions
- framework_health_check - To validate framework health after changes
- framework_repair_suggester - If framework issues arise during development
Last Updated: 2025-11-15
Framework Version: 2.0
1---2name: cc-sessions-core3description: Provide comprehensive guidance for developing and maintaining the cc-sessions framework core functionality - primary skill for hooks, sessions, tasks, middleware, route handlers, and API endpoints4---5
6# cc-sessions-core
7
8**Type:** WRITE-CAPABLE
9**DAIC Modes:** IMPLEMENT only
10**Priority:** High
11
12## Trigger Reference
13
14This skill activates on:
15- Keywords: "hook", "session", "task", "middleware", "route handler", "api endpoint", "cc-sessions"
16- Intent patterns: "(create|modify|refactor).*?(hook|session|task)", "sessions.*?development", "api.*?(implementation|development)"
17- File patterns: `sessions/**/*.js`, `sessions/hooks/**/*.js`, `sessions/api/**/*.js`
18
19From: `skill-rules.json` - cc-sessions-core configuration
20
21## Purpose
22
23Provide comprehensive guidance for developing and maintaining the cc-sessions framework core functionality. This is the primary skill for all cc-sessions development work including hooks, sessions, tasks, middleware, route handlers, and API endpoints.
24
25## Core Behavior
26
27When activated in IMPLEMENT mode with an active cc-sessions task:
28
291. **Framework Core Development**
30 - Guide implementation of new cc-sessions features
31 - Ensure DAIC discipline enforcement
32 - Maintain write-gating integrity
33 - Implement state persistence mechanisms
34 - Handle session lifecycle management
35
362. **Hook Development**
37 - Create/modify hooks in `sessions/hooks/`
38 - Ensure hooks respect DAIC modes
39 - Implement proper error handling and logging
40 - Validate hook execution order and dependencies
41 - Test hook integration with enforcement layer
42
433. **API Endpoint Development**
44 - Create/modify routes in `sessions/api/`
45 - Follow RESTful conventions where applicable
46 - Implement proper request validation
47 - Ensure consistent error responses
48 - Document API contracts
49
504. **Task Management Features**
51 - Implement task creation, startup, and completion workflows
52 - Handle task state transitions
53 - Manage task manifests and context
54 - Implement todo tracking and progression
55 - Support task resumption and recovery
56
575. **Middleware & Route Handlers**
58 - Create Express-compatible middleware
59 - Implement route handlers with proper error handling
60 - Ensure consistent request/response patterns
61 - Apply security best practices (input validation, sanitization)
62
63## Safety Guardrails
64
65**CRITICAL WRITE-GATING RULES:**
66- ✓ Only execute write operations when in IMPLEMENT mode
67- ✓ Verify active cc-sessions task exists before writing
68- ✓ Follow approved manifest/todos from task file
69- ✓ Never weaken DAIC discipline or write-gating logic
70- ✓ Never bypass framework safety mechanisms
71
72**Framework Integrity Rules:**
73- Never allow writes outside IMPLEMENT mode (core framework requirement)
74- Never modify `CC_SESSION_MODE` or `CC_SESSION_TASK_ID` directly (only cc-sessions API may do this)
75- Preserve SoT tier boundaries (Tier-1 canonical, Tier-2 task-scoped, Tier-3 ephemeral)
76- Maintain backward compatibility when modifying core APIs
77- Document breaking changes in `context/gotchas.md`
78
79**Code Quality Standards:**
80- Follow existing code style and patterns
81- Add JSDoc comments for public APIs
82- Include error handling for all async operations
83- Validate inputs at API boundaries
84- Write tests for new functionality (when test infrastructure exists)
85
86## Examples
87
88### When to Activate
89
90✓ "Create a new hook for validating task manifests"
91✓ "Modify the session state API to include timestamps"
92✓ "Add a new command: sessions tasks archive"
93✓ "Fix the write-gating enforcement in sessions_enforce.js"
94✓ "Implement task resumption from state.json"
95
96### When NOT to Activate
97
98✗ In DISCUSS/ALIGN/CHECK mode (framework development requires IMPLEMENT)
99✗ No active cc-sessions task (violates write-gating)
100✗ User is working on application code (not framework code)
101✗ Changes would weaken safety mechanisms
102
103## Framework Architecture Awareness
104
105### Key Files & Responsibilities
106
107**Core:**
108- `sessions/bin/sessions` - CLI entry point
109- `sessions/api/router.js` - Main API router
110- `sessions/sessions-state.json` - Session state persistence
111
112**Hooks:**
113- `sessions/hooks/sessions_enforce.js` - Write-gating and DAIC enforcement
114- Hook execution: UserPromptSubmit, SessionStart, PreToolUse, PostToolUse
115
116**API Modules:**
117- `sessions/api/state_commands.js` - State management (show, mode, task, todos, flags, update)
118- `sessions/api/task_commands.js` - Task operations (idx, start)
119- `sessions/api/config_commands.js` - Configuration management
120- `sessions/api/protocol_commands.js` - Protocol execution
121
122### DAIC Flow
1231. **DISCUSS** → Clarify, gather context, no writes
1242. **ALIGN** → Design plan, create manifest, no writes
1253. **IMPLEMENT** → Execute approved todos, writes allowed
1264. **CHECK** → Verify, test, summarize, minimal writes
127
128### State Management
129- Session state tracked in `sessions/sessions-state.json`
130- Task state tracked in `sessions/sessions-state.json` (lightweight checkpoint)
131- Hooks enforce state consistency
132- State transitions logged for debugging
133
134## Decision Logging
135
136When modifying core framework behavior, log in `context/decisions.md`:
137
138```markdown
139### Framework Change: [Date]
140- **Component:** sessions/hooks/sessions_enforce.js
141- **Change:** Added todo list change detection
142- **Rationale:** Users were bypassing execution boundary by silently changing todos
143- **Impact:** All todo modifications now require explicit approval
144- **Breaking:** No (additive change only)
145```
146
147## Related Skills
148
149- **cc-sessions-hooks** - Specialized hook development (defers to this when hooks are involved)
150- **cc-sessions-api** - Specialized API development (defers to this when API commands are involved)
151- **skill-developer** - For creating skills that integrate with cc-sessions
152- **framework_health_check** - To validate framework health after changes
153- **framework_repair_suggester** - If framework issues arise during development
154
155---
156
157**Last Updated:** 2025-11-15
158**Framework Version:** 2.0