con un clic
debug
Debug Command
Instalar con Codex o Claude Copia este prompt, pégalo en Codex, Claude u otro asistente, y deja que revise la página de la skill y la instale por ti.
Menú
Debug Command
Instalar con Codex o Claude Copia este prompt, pégalo en Codex, Claude u otro asistente, y deja que revise la página de la skill y la instale por ti.
Basado en la clasificación ocupacional SOC
Canonical turn protocol for agents writing to Neotoma. Bounded retrieval on the user message, store user message PART_OF conversation with REFERS_TO edges to retrieved entities, store assistant reply the same way. Use this skill in any agent loop that should persist conversation state to Neotoma.
Session-end audit. Files remaining work as task entities and lists them as bullets, verifies all data intended for Neotoma storage from this session is actually stored, and persists what's missing. Invoke at the natural close of a working session, before context is lost.
Mid-session status report. Summarizes what's been achieved so far this session and what work remains, in succinct qualitative prose and bullets with only light technical detail. Read-only — stores nothing, files nothing. Invoke any time to take stock without closing the session.
Close a Neotoma working session — store the assistant reply and a session-close summary.
Retrieve the bounded context for the current session — recent interactions and relevant entities.
Begin a Neotoma working session — open a conversation and record the opening interaction.
| name | debug |
| description | Debug Command |
name: debug description: Debug workflow per foundation command. triggers:
Check for pending error reports and debug/resolve them. Supports cross-repo error queue checking for sibling repositories. Also manages the error debugging automation watcher.
/debug [action|target-repo-name]
Modes of Operation:
The command operates in two modes based on the first argument:
If the first argument is a watcher management action (start, stop, status, logs, restart), manage the error debugging automation watcher:
/debug start # Start the error debugging watcher
/debug stop # Stop the running watcher
/debug status # Check watcher status
/debug logs # Show watcher logs
/debug restart # Restart the watcher
If the first argument is not a watcher action (or no arguments provided), check and debug pending errors:
/debug # Check current repo's pending errors (default)
/debug neotoma # Check sibling repo's pending errors
/debug personal-project # Check another sibling repo
Note: To check watcher status, use /debug status. The default behavior (no arguments) checks for pending errors in the current repository.
Parameters:
action (optional): Watcher management action (start, stop, status, logs, restart)
target-repo-name (optional): Name of sibling repository to check for pending errors
Examples:
# Watcher management
/debug start # Start watcher
/debug status # Check watcher status
/debug logs # View watcher logs
/debug stop # Stop watcher
# Error debugging
/debug # Check current repo's pending errors
/debug neotoma # Check sibling repo's pending errors
/debug --list-only # List errors without debugging
/debug --all --auto # Process all errors automatically
start, stop, status, logs, or restart:
startCheck if already running:
.cursor/error_reports/watcher.pidVerify configuration:
foundation-config.yamldevelopment.error_debugging.enabled === trueCreate necessary directories:
.cursor/error_reports/ existsStart watcher in background:
node scripts/trigger_error_debug_cli.js --watch > .cursor/error_reports/watcher.log 2>&1 &.cursor/error_reports/watcher.pidVerify start:
stopCheck if running:
.cursor/error_reports/watcher.pidVerify process exists:
Stop process:
status (default)Check PID file:
.cursor/error_reports/watcher.pidCheck if process is running:
If running, show:
Also show pending errors count:
.cursor/error_reports/pending.json/debug to debuglogsCheck log file:
.cursor/error_reports/watcher.logDisplay logs:
--follow flag providedrestartImplementation Notes for Watcher Management:
.cursor/error_reports/watcher.pid.cursor/error_reports/watcher.logps -p $PID (macOS/Linux) or platform-specific commandsGet Current Repository Path:
git rev-parse --show-toplevel
Store as current_repo_path
Resolve Target Repository Path:
target-repo-name provided:
report: alphanumeric, hyphens, underscores, dots only)dirname(current_repo_path)parent_dir/target-repo-namecurrent_repo_path (check current repo)Validate Target Repository:
.git directory (is git repo).cursor/error_reports/ directorypending.json file (if not, no pending errors)Read Pending Queue:
const pendingPath = path.join(targetRepoPath, '.cursor', 'error_reports', 'pending.json');
if (!fs.existsSync(pendingPath)) {
console.log(`No pending errors found in ${targetRepoName}.`);
return;
}
const pending = JSON.parse(fs.readFileSync(pendingPath, 'utf8'));
if (pending.length === 0) {
console.log(`No pending errors found in ${targetRepoName}. All clear!`);
return;
}
Sort by Priority:
const severityOrder = { critical: 0, high: 1, medium: 2, low: 3 };
pending.sort((a, b) => {
// Sort by severity first
const severityDiff = severityOrder[a.severity] - severityOrder[b.severity];
if (severityDiff !== 0) return severityDiff;
// Then by timestamp (oldest first)
return new Date(a.timestamp) - new Date(b.timestamp);
});
Display Pending Errors:
Found {count} pending error(s) in {target_repo_name}:
1. [CRITICAL] Build Error (error_20250131_143022_build.json)
- ID: 01JQZ8X9K2M3N4P5Q6R7S8T9U0
- Timestamp: 2025-01-31T14:30:22Z
- Message: Cannot find module '../db'
2. [HIGH] Runtime Error (error_20250131_144510_runtime.json)
- ID: 01JQZ8X9K2M3N4P5Q6R7S8T9U1
- Timestamp: 2025-01-31T14:45:10Z
- Message: MCP error -32603: UNKNOWN_CAPABILITY
Default Behavior: Auto-select highest priority
Select First Error:
Prompt User for Confirmation:
Debugging highest priority error:
Error ID: 01JQZ8X9K2M3N4P5Q6R7S8T9U0
Category: build
Severity: critical
Message: Cannot find module '../db'
Affected files: src/services/raw_storage.ts
Proceed with debugging? (yes/no/choose-different/list-only)
- yes: Debug this error
- no: Skip debugging
- choose-different: Select a different error from the list
- list-only: Display errors without debugging
Handle User Response:
yes: Proceed to step 4no: Exit without debuggingchoose-different: Display numbered list, prompt for selectionlist-only: Display all errors and exit (same as --list-only flag)Read Full Error Report:
const errorJsonPath = pending[selectedIndex].file_path;
const errorReport = JSON.parse(fs.readFileSync(errorJsonPath, 'utf8'));
Display Error Details:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Error Report Details
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Error ID: 01JQZ8X9K2M3N4P5Q6R7S8T9U0
Category: build
Severity: critical
Timestamp: 2025-01-31T14:30:22Z
Error Message:
Cannot find module '../db'
Stack Trace:
Error: Cannot find module '../db'
at Object.<anonymous> (src/services/raw_storage.ts:1:1)
at Module._compile (node:internal/modules/cjs/loader:1376:14)
...
Affected Files:
- src/services/raw_storage.ts
- src/services/interpretation.ts
- src/services/entity_queries.ts
Affected Modules:
- db
Original Task:
Transfer contacts from Parquet to Neotoma
Source Repository:
personal-project (/Users/user/Projects/personal-project)
Target Repository:
neotoma (/Users/user/Projects/neotoma)
Environment:
- Node: v20.11.0
- OS: darwin
- Environment: development
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Integration with fix_feature_bug Command:
Prepare Context for Bug Fix:
Trigger Bug Fix Workflow:
development.error_debugging.integrate_fix_feature_bug: true:
fix_feature_bug command with error contextFollow Standard Bug Fix Process:
Alternative: Manual Debugging Mode:
After successful fix:
Update Error Report:
errorReport.resolution_status = 'resolved';
errorReport.resolution_notes = 'Fixed by correcting import path in raw_storage.ts';
errorReport.resolved_at = new Date().toISOString();
errorReport.resolved_by = 'cursor-agent';
fs.writeFileSync(errorJsonPath, JSON.stringify(errorReport, null, 2), 'utf8');
Move to Resolved Directory:
const resolvedDir = path.join(targetRepoPath, '.cursor', 'error_reports', 'resolved');
fs.mkdirSync(resolvedDir, { recursive: true });
const jsonBasename = path.basename(errorJsonPath);
const mdBasename = jsonBasename.replace('.json', '.md');
const resolvedJsonPath = path.join(resolvedDir, jsonBasename);
const resolvedMdPath = path.join(resolvedDir, mdBasename);
const errorMdPath = errorJsonPath.replace('.json', '.md');
fs.renameSync(errorJsonPath, resolvedJsonPath);
if (fs.existsSync(errorMdPath)) {
fs.renameSync(errorMdPath, resolvedMdPath);
}
Remove from Pending Queue:
const pending = JSON.parse(fs.readFileSync(pendingPath, 'utf8'));
const filtered = pending.filter(e => e.error_id !== errorReport.error_id);
fs.writeFileSync(pendingPath, JSON.stringify(filtered, null, 2), 'utf8');
Update Markdown Summary:
If fix fails:
Update Status to Failed:
errorReport.resolution_status = 'failed';
errorReport.resolution_notes = 'Fix attempted but tests still failing. Requires manual investigation.';
errorReport.failed_at = new Date().toISOString();
fs.writeFileSync(errorJsonPath, JSON.stringify(errorReport, null, 2), 'utf8');
Keep in Pending Queue:
On Successful Resolution:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Error Resolved Successfully
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Error ID: 01JQZ8X9K2M3N4P5Q6R7S8T9U0
Category: build
Severity: critical
Resolution:
Fixed by correcting import path in raw_storage.ts
Files Changed:
- src/services/raw_storage.ts
Tests Added:
- tests/integration/import_resolution.test.ts
Archived to:
- {target_repo}/.cursor/error_reports/resolved/error_20250131_143022_build.json
- {target_repo}/.cursor/error_reports/resolved/error_20250131_143022_build.md
Remaining pending errors: 1
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
# Check watcher status (default)
/debug
/debug status
# Start watcher
/debug start
# View logs
/debug logs
# Stop watcher
/debug stop
# Restart watcher
/debug restart
Output (status):
Error Debugging Watcher Status
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Status: Running
PID: 12345
Uptime: 2h 15m 30s
Configuration: Enabled
Pending Errors: 2
Last Activity: 2025-01-31T15:30:00Z
Use /debug to debug pending errors.
On Failed Resolution:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Error Resolution Failed
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Error ID: 01JQZ8X9K2M3N4P5Q6R7S8T9U0
Category: build
Severity: critical
Status: Failed
Notes: Fix attempted but tests still failing. Requires manual investigation.
Error remains in pending queue for retry.
Remaining pending errors: 2
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Display pending errors without debugging:
/debug --list-only
/debug neotoma --list-only
Behavior:
Process all pending errors in priority order:
/debug --all
/debug neotoma --all
Behavior:
Skip confirmation prompts:
/debug --auto
/debug neotoma --auto
Behavior:
/debug neotoma --all --auto
Process all pending errors in neotoma repo without prompts
No Error Reports Directory:
No error reports found in {target_repo}.
Directory .cursor/error_reports/ does not exist.
Use /report to create error reports.
Empty Pending Queue:
No pending errors found in {target_repo}.
All clear!
Invalid Target Repo:
Error: Target repository not found: /Users/user/Projects/non-existent-repo
Check repo name and try again.
Invalid Repo Name (Path Traversal):
Error: Invalid repo name: ../secret-repo. Only alphanumeric, hyphens, underscores, and dots allowed.
Permission Error:
Error: No write permission for target repository: /Users/user/Projects/neotoma
Cannot update error reports. Check file permissions.
Add to foundation-config.yaml:
development:
error_debugging:
enabled: true
auto_select_highest_priority: true
require_confirmation: true # Prompt before debugging
integrate_fix_feature_bug: true # Use fix_feature_bug for resolution
max_errors_to_display: 10
auto_archive_resolved: true # Move resolved errors to archive
automation:
watch_mode: true # Enable continuous monitoring via watcher
cursor_cli:
# ... cursor_cli configuration ...
Watcher Management:
watch_mode: true, the watcher automatically monitors for new errors/debug start to start the watcher/debug status to check watcher and pending errors.cursor/error_reports/watcher.logreport Commandreportreportfix_feature_bug Commandfix_feature_bug for each error/debug
Output:
Found 2 pending error(s) in neotoma:
1. [CRITICAL] Build Error (error_20250131_143022_build.json)
- ID: 01JQZ8X9K2M3N4P5Q6R7S8T9U0
- Timestamp: 2025-01-31T14:30:22Z
- Message: Cannot find module '../db'
2. [HIGH] Runtime Error (error_20250131_144510_runtime.json)
- ID: 01JQZ8X9K2M3N4P5Q6R7S8T9U1
- Timestamp: 2025-01-31T14:45:10Z
- Message: MCP error -32603: UNKNOWN_CAPABILITY
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Debugging highest priority error (CRITICAL):
Error ID: 01JQZ8X9K2M3N4P5Q6R7S8T9U0
Category: build
Severity: critical
Message: Cannot find module '../db'
Affected files:
- src/services/raw_storage.ts
- src/services/interpretation.ts
- src/services/entity_queries.ts
Proceed with debugging? (yes/no/choose-different/list-only)
/debug neotoma
Output:
Checking pending errors in: /Users/user/Projects/neotoma
Found 1 pending error(s) in neotoma:
1. [HIGH] Runtime Error (error_20250131_144510_runtime.json)
- ID: 01JQZ8X9K2M3N4P5Q6R7S8T9U1
- Timestamp: 2025-01-31T14:45:10Z
- Message: Storage bucket not found
- Source: personal-project
Debugging error...
[Proceeds with debugging workflow]
/debug --list-only
Output:
Found 2 pending error(s) in neotoma:
1. [CRITICAL] Build Error (2025-01-31T14:30:22Z)
- ID: 01JQZ8X9K2M3N4P5Q6R7S8T9U0
- Message: Cannot find module '../db'
- Affected: src/services/raw_storage.ts
2. [HIGH] Runtime Error (2025-01-31T14:45:10Z)
- ID: 01JQZ8X9K2M3N4P5Q6R7S8T9U1
- Message: MCP error -32603: UNKNOWN_CAPABILITY
- Affected: src/server.ts
Use /debug to debug highest priority error.
/debug
Output (if no watcher action specified, shows status):
Error Debugging Watcher Status
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Status: Running
PID: 12345
Uptime: 2h 15m 30s
Pending Errors: 0
All clear! No pending errors to debug.
Or if checking errors directly:
No pending errors found in current repository.
All clear!
/debug --all
Output:
Found 3 pending error(s). Processing all in priority order...
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Processing error 1 of 3: [CRITICAL] Build Error
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
[Debugging workflow for error 1]
[After error 1 resolved]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Processing error 2 of 3: [HIGH] Runtime Error
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
[Debugging workflow for error 2]
...
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
All Errors Processed
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Total errors: 3
Resolved: 2
Failed: 1
Remaining pending errors: 1
start action (check if running, verify config, start watcher, verify)stop action (read PID, verify process, graceful shutdown, cleanup)status action (check PID, verify process, show status + pending errors)logs action (read log file, display last N lines or tail)restart action (stop then start)For each error report, collect repository metadata:
function getRepositoryMetadata(repoPath) {
const name = path.basename(repoPath);
let remoteUrl = null;
try {
remoteUrl = execSync('git remote get-url origin', { cwd: repoPath })
.toString()
.trim();
} catch {
// No remote or error getting remote
}
return {
path: repoPath,
name: name,
remote_url: remoteUrl
};
}
Setup: Create sample pending.json with 2 errors Expected: Display errors, debug highest priority
Setup: Create errors in sibling repo Expected: Display errors from sibling repo, debug highest priority
Setup: Empty or missing pending.json Expected: Message "No pending errors found. All clear!"
Setup: Target repo without .cursor/error_reports/ Expected: Error message with instruction to use /report
Setup: Use non-existent sibling repo name Expected: Error message about target repo not found
Setup: Pending errors exist Expected: Display errors without debugging, exit
Setup: Multiple pending errors Expected: Process all errors in priority order
Setup: Pending errors exist Expected: Debug highest priority without confirmation prompt
Setup: Error exists, user chooses manual mode Expected: Display error details, wait for user to fix, then update status
Setup: Fix attempt fails (tests still failing) Expected: Update status to 'failed', keep in pending queue
/debug
/debug status
Output:
Error Debugging Watcher Status
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Status: Running
PID: 12345
Uptime: 2h 15m 30s
Configuration: Enabled
Pending Errors: 2
Last Activity: 2025-01-31T15:30:00Z
Use /debug to debug pending errors.
/debug start
Output:
Started error debugging watcher (PID: 12345)
Watcher is monitoring for new errors and will automatically
debug them when found.
/debug logs
/debug logs --follow # Tail logs
Output:
Error Debugging Watcher Logs (last 50 lines)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
2025-01-31T15:30:00Z [INFO] Checking for pending errors...
2025-01-31T15:30:00Z [INFO] Found 2 pending errors
2025-01-31T15:30:01Z [INFO] Debugging error: 01JQZ8X9K2M3N4P5Q6R7S8T9U0
2025-01-31T15:30:05Z [INFO] Error resolved successfully
...
report-error (.cursor/skills/report-error/SKILL.md) - Error reporting workflowfix-feature-bug (.cursor/skills/fix-feature-bug/SKILL.md) - Bug fix workflowfoundation-config.yaml - Configuration file/manage_error_debugging - Deprecated: Use /debug [action] instead
/manage_error_debugging start → /debug start/manage_error_debugging stop → /debug stop/manage_error_debugging status → /debug status/manage_error_debugging logs → /debug logs/manage_error_debugging restart → /debug restart