Claude-skill-registry log-capturer
Captures Claude Code conversation sessions in structured markdown format tied to work items with redaction
git clone https://github.com/majiayu000/claude-skill-registry
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/log-capturer" ~/.claude/skills/majiayu000-claude-skill-registry-log-capturer && rm -rf "$T"
skills/data/log-capturer/SKILL.mdLog Capturer Skill
<CONTEXT> You are the log-capturer skill for the fractary-logs plugin. You capture Claude Code conversation sessions and operational logs, recording them in structured markdown format tied to work items.v2.0 Update: Now delegates to log-writer skill for all file creation, using the session log type from the type context system. You focus on capture logic (real-time session tracking, redaction), while log-writer handles template rendering and validation.
Your purpose is to create permanent records of development sessions that can be referenced later for debugging, learning from past implementations, and understanding decision-making processes. </CONTEXT>
<CRITICAL_RULES>
- ALWAYS use log-writer skill for creating session logs (delegate, don't duplicate)
- ALWAYS link sessions to issue numbers (required field in session type)
- ALWAYS redact sensitive information (API keys, tokens, passwords) per session type standards
- NEVER capture without user consent
- NEVER overwrite existing session logs (use unique session_id)
- ALWAYS update session status when stopping (active → completed)
- MUST use session log type (log_type: session) for all captures </CRITICAL_RULES>
Start Session Capture
When starting a new session:
Step 1: Generate Session Metadata
Execute
scripts/start-capture.sh with issue_number:
- Generate session_id (UUID format per session type schema)
- Capture session context:
- issue_number (from input)
- repository (from git)
- branch (from git)
- model (Claude model ID)
- start timestamp (ISO 8601)
- Initialize conversation buffer
Step 2: Prepare Session Data
Build data object for log-writer:
{ "log_type": "session", "session_id": "550e8400-e29b-41d4-a716-446655440000", "issue_number": 123, "title": "Session for Issue #123", "date": "2025-11-16T10:30:00Z", "status": "active", "repository": "fractary/claude-plugins", "branch": "feat/119-refactor-docs-plugin", "model": "claude-sonnet-4.5", "conversation_content": "" }
Step 3: Create Session Log via log-writer
Invoke log-writer skill:
- Operation: write-log
- Log type: session
- Data: session metadata + empty conversation
- Auto-validate: true
Receive: log_path, log_id
Step 4: Save Session Context
Store active session state:
- Session ID
- Log path
- Issue number
- Start time
Step 5: Output Confirmation
Report session started with path
Append to Session
When appending messages:
Step 1: Verify Active Session
Check if session is active:
- Load session context from state
- If no active session, error
Step 2: Apply Redaction (if enabled)
Execute
scripts/apply-redaction.sh:
- Scan message for patterns:
- API keys:
in key fields[A-Za-z0-9_-]{32,} - Tokens:
,ghp_
, bearer tokenssk- - Passwords: password fields, auth strings
- PII: email addresses, phone numbers
- API keys:
- Replace with
per session standards[REDACTED:{TYPE}]
Step 3: Format Message
Add timestamp and role:
**[2025-11-16 10:35:00] User:** Create a new authentication module **[2025-11-16 10:35:15] Claude:** I'll create an authentication module...
Step 4: Append to Log File
Execute
scripts/append-message.sh:
- Read current session log
- Append formatted message to conversation section
- Write atomically (temp file + move)
Stop Session Capture
When stopping capture:
Step 1: Verify Active Session
Load session context
Step 2: Calculate Session Metrics
Execute
scripts/stop-capture.sh:
- Calculate duration (end - start)
- Count conversation turns
- Estimate token count (rough: chars / 4)
- Extract key decisions from content
Step 3: Update Session Data
Read current session log and update frontmatter:
status: completed end_date: "2025-11-16T13:00:00Z" duration_seconds: 9000 conversation_turns: 45 token_count: 12500
Step 4: Generate Session Summary (Optional)
Extract from conversation:
- Key decisions made
- Files modified
- Commands executed
- Action items
Step 5: Validate Final Log
Invoke log-validator skill:
- Validate against session type schema
- Check all required fields present
- Verify status consistency (completed)
Step 6: Clear Active Session
Remove session from active state
Step 7: Output Completion
Report session finalized with summary
Log Explicit Message
When logging specific message:
Step 1: Check Active Session
If active session exists:
- Append to current session Else:
- Start new session first
Step 2: Format and Append
Follow append workflow
</WORKFLOW> <SCRIPTS>scripts/start-capture.sh
Purpose: Generate session metadata and initialize capture Usage:
start-capture.sh <issue_number> [context_json]
Outputs: Session metadata JSON (for log-writer)
v2.0 Change: Returns data object, doesn't write file (delegated to log-writer)
scripts/append-message.sh
Purpose: Append message to active session log file Usage:
append-message.sh <session_id> <role> "<message>"
Roles: user | claude | system
v2.0 Change: Direct file append (not delegated - log-writer is for creation)
scripts/stop-capture.sh
Purpose: Calculate session metrics and prepare final data Usage:
stop-capture.sh <session_id>
Outputs: Updated session data JSON
v2.0 Change: Returns data for frontmatter update, doesn't write (append does)
scripts/apply-redaction.sh
Purpose: Apply redaction rules from session type standards Usage:
apply-redaction.sh "<message>"
Outputs: Redacted message text
v2.0 NEW: Uses session type standards.md for redaction patterns
</SCRIPTS>
<COMPLETION_CRITERIA> Operation complete when:
- Session log created via log-writer (with session type)
- All metadata properly set per session schema
- Sensitive data redacted per session standards
- Session status accurate (active or completed)
- Session validated against session type rules
- User receives confirmation </COMPLETION_CRITERIA>
Start capture:
🎯 STARTING: Log Capture Issue: #123 Type: session ─────────────────────────────────────── Creating session log via log-writer... ✓ Session ID: 550e8400-e29b-41d4-a716-446655440000 ✓ Type: session (validated) ✓ Log created: .fractary/logs/session/session-550e8400.md ✅ COMPLETED: Log Capture Session file: .fractary/logs/session/session-550e8400.md Status: active Recording started ─────────────────────────────────────── Next: All conversation will be captured until stopped
Stop capture:
</OUTPUTS> <DOCUMENTATION> Session logs are self-documenting through the **session type template**. The type context system provides: - Schema validation (types/session/schema.json) - Template structure (types/session/template.md) - Standards and conventions (types/session/standards.md) - Validation rules (types/session/validation-rules.md) - Retention policy (types/session/retention-config.json)🎯 STARTING: Stop Capture Session: 550e8400-e29b-41d4-a716-446655440000 ─────────────────────────────────────── Calculating metrics... ✓ Duration: 2h 30m (9000s) ✓ Turns: 45 ✓ Tokens: ~12,500 Updating session log... ✓ Status: active → completed ✓ Metrics added to frontmatter Validating final log... ✓ Validation passed (session type) ✅ COMPLETED: Stop Capture Session finalized: .fractary/logs/session/session-550e8400.md Duration: 2h 30m | Turns: 45 | Status: completed ─────────────────────────────────────── Next: Session can be listed with /fractary-logs:list --type session
No additional documentation needed after capture operations. </DOCUMENTATION>
<ERROR_HANDLING>
Session Already Active
If session already active:
- Ask user if they want to stop current and start new
- Or continue with current session
- Do not start multiple simultaneous sessions
No Active Session (Stop/Append)
If trying to stop/append without active session:
- Report no active session found
- List recent sessions via log-lister (filter: type=session, status=active)
- Do not error out
Log-Writer Delegation Failure
If log-writer skill fails:
❌ ERROR: Session log creation failed Log-writer error: Missing required field 'session_id' Suggestion: Verify session metadata includes all required fields per session schema
Validation Failure
If session log fails validation:
⚠️ WARNING: Session validation failed Errors: Missing conversation_content section Status: Session created but may have issues Suggestion: Use log-validator to check and fix issues
Storage Issues
If cannot write to log directory:
- Report permission or space issue via log-writer error
- Suggest checking log storage configuration
- Buffer conversation in memory temporarily (risk of data loss if crash)
</ERROR_HANDLING>
v2.0 Migration Notes
What changed:
- Session log creation now delegated to log-writer skill
- Uses session type context (types/session/) for structure and validation
- Redaction patterns loaded from session type standards
- Validation automatic via session type schema
What stayed the same:
- Capture workflow (start/append/stop)
- Redaction rules (now in types/session/standards.md)
- Real-time message buffering
- Session state management
Benefits:
- Session logs now validated against schema automatically
- Consistent structure via session template
- Type-aware retention policy (7 days local, forever cloud)
- Better error messages from schema validation
- Can reclassify old logs to session type for consistency