@tyroneross/build-loop 0.30.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/plugins/marketplace.json +10 -0
- package/.claude-plugin/marketplace.json +38 -0
- package/.claude-plugin/plugin.json +30 -0
- package/.codex-plugin/plugin.json +41 -0
- package/.cursor/rules/build-loop-surface.mdc +22 -0
- package/AGENTS.md +498 -0
- package/LICENSE +202 -0
- package/README.md +403 -0
- package/agents/alignment-checker.md +124 -0
- package/agents/api-assessor.md +136 -0
- package/agents/architecture-scout.md +185 -0
- package/agents/assessment-orchestrator.md +163 -0
- package/agents/build-orchestrator.md +198 -0
- package/agents/database-assessor.md +133 -0
- package/agents/design-contract-specialist.md +239 -0
- package/agents/fact-checker.md +69 -0
- package/agents/fix-critique.md +161 -0
- package/agents/frontend-assessor.md +136 -0
- package/agents/implementer.md +185 -0
- package/agents/independent-auditor.md +143 -0
- package/agents/mock-scanner.md +78 -0
- package/agents/optimize-runner.md +112 -0
- package/agents/overfitting-reviewer.md +96 -0
- package/agents/performance-assessor.md +159 -0
- package/agents/plan-critic.md +85 -0
- package/agents/promotion-reviewer.md +121 -0
- package/agents/recurring-pattern-detector.md +248 -0
- package/agents/retrospective-synthesizer.md +109 -0
- package/agents/root-cause-investigator.md +285 -0
- package/agents/scope-auditor.md +121 -0
- package/agents/security-reviewer.md +151 -0
- package/agents/self-improvement-architect.md +125 -0
- package/agents/synthesis-critic.md +99 -0
- package/agents/transcript-pattern-miner.md +165 -0
- package/agents/ui-validator.md +193 -0
- package/codex-skills/build-loop/SKILL.md +20 -0
- package/codex-skills/debug-loop/SKILL.md +18 -0
- package/codex-skills/handoff/SKILL.md +22 -0
- package/codex-skills/knowledge/SKILL.md +21 -0
- package/codex-skills/optimize/SKILL.md +18 -0
- package/codex-skills/research/SKILL.md +18 -0
- package/commands/agent-rally-point.md +301 -0
- package/commands/assess.md +41 -0
- package/commands/debug.md +20 -0
- package/commands/debugger-detail.md +34 -0
- package/commands/debugger-scan.md +15 -0
- package/commands/debugger-status.md +20 -0
- package/commands/debugger.md +32 -0
- package/commands/handoff.md +113 -0
- package/commands/knowledge-review.md +16 -0
- package/commands/optimize.md +31 -0
- package/commands/plan-verify.md +39 -0
- package/commands/promote-experiment.md +129 -0
- package/commands/research.md +22 -0
- package/commands/run.md +12 -0
- package/commands/self-review.md +51 -0
- package/commands/start-prd.md +57 -0
- package/commands/test.md +34 -0
- package/dist/src/assessment-orchestrator.d.ts +78 -0
- package/dist/src/assessment-orchestrator.d.ts.map +1 -0
- package/dist/src/assessment-orchestrator.js +304 -0
- package/dist/src/assessment-orchestrator.js.map +1 -0
- package/dist/src/audit-miner.d.ts +21 -0
- package/dist/src/audit-miner.d.ts.map +1 -0
- package/dist/src/audit-miner.js +421 -0
- package/dist/src/audit-miner.js.map +1 -0
- package/dist/src/batch-operations.d.ts +30 -0
- package/dist/src/batch-operations.d.ts.map +1 -0
- package/dist/src/batch-operations.js +339 -0
- package/dist/src/batch-operations.js.map +1 -0
- package/dist/src/config.d.ts +83 -0
- package/dist/src/config.d.ts.map +1 -0
- package/dist/src/config.js +176 -0
- package/dist/src/config.js.map +1 -0
- package/dist/src/context-engine.d.ts +45 -0
- package/dist/src/context-engine.d.ts.map +1 -0
- package/dist/src/context-engine.js +135 -0
- package/dist/src/context-engine.js.map +1 -0
- package/dist/src/debug-wrapper.d.ts +58 -0
- package/dist/src/debug-wrapper.d.ts.map +1 -0
- package/dist/src/debug-wrapper.js +285 -0
- package/dist/src/debug-wrapper.js.map +1 -0
- package/dist/src/index.d.ts +31 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +149 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/interactive-verifier.d.ts +26 -0
- package/dist/src/interactive-verifier.d.ts.map +1 -0
- package/dist/src/interactive-verifier.js +435 -0
- package/dist/src/interactive-verifier.js.map +1 -0
- package/dist/src/lessons.d.ts +59 -0
- package/dist/src/lessons.d.ts.map +1 -0
- package/dist/src/lessons.js +172 -0
- package/dist/src/lessons.js.map +1 -0
- package/dist/src/log-reader.d.ts +39 -0
- package/dist/src/log-reader.d.ts.map +1 -0
- package/dist/src/log-reader.js +291 -0
- package/dist/src/log-reader.js.map +1 -0
- package/dist/src/logger.d.ts +59 -0
- package/dist/src/logger.d.ts.map +1 -0
- package/dist/src/logger.js +328 -0
- package/dist/src/logger.js.map +1 -0
- package/dist/src/parallel-retrieval.d.ts +52 -0
- package/dist/src/parallel-retrieval.d.ts.map +1 -0
- package/dist/src/parallel-retrieval.js +309 -0
- package/dist/src/parallel-retrieval.js.map +1 -0
- package/dist/src/pattern-extractor.d.ts +30 -0
- package/dist/src/pattern-extractor.d.ts.map +1 -0
- package/dist/src/pattern-extractor.js +386 -0
- package/dist/src/pattern-extractor.js.map +1 -0
- package/dist/src/result-aggregator.d.ts +44 -0
- package/dist/src/result-aggregator.d.ts.map +1 -0
- package/dist/src/result-aggregator.js +315 -0
- package/dist/src/result-aggregator.js.map +1 -0
- package/dist/src/retrieval.d.ts +139 -0
- package/dist/src/retrieval.d.ts.map +1 -0
- package/dist/src/retrieval.js +724 -0
- package/dist/src/retrieval.js.map +1 -0
- package/dist/src/setup/auto-setup.d.ts +15 -0
- package/dist/src/setup/auto-setup.d.ts.map +1 -0
- package/dist/src/setup/auto-setup.js +157 -0
- package/dist/src/setup/auto-setup.js.map +1 -0
- package/dist/src/setup/configure-hooks.d.ts +8 -0
- package/dist/src/setup/configure-hooks.d.ts.map +1 -0
- package/dist/src/setup/configure-hooks.js +16 -0
- package/dist/src/setup/configure-hooks.js.map +1 -0
- package/dist/src/setup/create-slash-commands.d.ts +8 -0
- package/dist/src/setup/create-slash-commands.d.ts.map +1 -0
- package/dist/src/setup/create-slash-commands.js +101 -0
- package/dist/src/setup/create-slash-commands.js.map +1 -0
- package/dist/src/setup/index.d.ts +8 -0
- package/dist/src/setup/index.d.ts.map +1 -0
- package/dist/src/setup/index.js +17 -0
- package/dist/src/setup/index.js.map +1 -0
- package/dist/src/setup/inject-claude-md.d.ts +10 -0
- package/dist/src/setup/inject-claude-md.d.ts.map +1 -0
- package/dist/src/setup/inject-claude-md.js +150 -0
- package/dist/src/setup/inject-claude-md.js.map +1 -0
- package/dist/src/setup/uninstall.d.ts +22 -0
- package/dist/src/setup/uninstall.d.ts.map +1 -0
- package/dist/src/setup/uninstall.js +235 -0
- package/dist/src/setup/uninstall.js.map +1 -0
- package/dist/src/storage.d.ts +192 -0
- package/dist/src/storage.d.ts.map +1 -0
- package/dist/src/storage.js +1037 -0
- package/dist/src/storage.js.map +1 -0
- package/dist/src/string-similarity.d.ts +8 -0
- package/dist/src/string-similarity.d.ts.map +1 -0
- package/dist/src/string-similarity.js +57 -0
- package/dist/src/string-similarity.js.map +1 -0
- package/dist/src/traces/adapters/browser.d.ts +69 -0
- package/dist/src/traces/adapters/browser.d.ts.map +1 -0
- package/dist/src/traces/adapters/browser.js +280 -0
- package/dist/src/traces/adapters/browser.js.map +1 -0
- package/dist/src/traces/adapters/index.d.ts +23 -0
- package/dist/src/traces/adapters/index.d.ts.map +1 -0
- package/dist/src/traces/adapters/index.js +67 -0
- package/dist/src/traces/adapters/index.js.map +1 -0
- package/dist/src/traces/adapters/langchain.d.ts +42 -0
- package/dist/src/traces/adapters/langchain.d.ts.map +1 -0
- package/dist/src/traces/adapters/langchain.js +151 -0
- package/dist/src/traces/adapters/langchain.js.map +1 -0
- package/dist/src/traces/adapters/opentelemetry.d.ts +46 -0
- package/dist/src/traces/adapters/opentelemetry.d.ts.map +1 -0
- package/dist/src/traces/adapters/opentelemetry.js +164 -0
- package/dist/src/traces/adapters/opentelemetry.js.map +1 -0
- package/dist/src/traces/adapters/sentry.d.ts +58 -0
- package/dist/src/traces/adapters/sentry.d.ts.map +1 -0
- package/dist/src/traces/adapters/sentry.js +212 -0
- package/dist/src/traces/adapters/sentry.js.map +1 -0
- package/dist/src/traces/index.d.ts +10 -0
- package/dist/src/traces/index.d.ts.map +1 -0
- package/dist/src/traces/index.js +45 -0
- package/dist/src/traces/index.js.map +1 -0
- package/dist/src/traces/storage.d.ts +78 -0
- package/dist/src/traces/storage.d.ts.map +1 -0
- package/dist/src/traces/storage.js +399 -0
- package/dist/src/traces/storage.js.map +1 -0
- package/dist/src/traces/summarizer.d.ts +83 -0
- package/dist/src/traces/summarizer.d.ts.map +1 -0
- package/dist/src/traces/summarizer.js +247 -0
- package/dist/src/traces/summarizer.js.map +1 -0
- package/dist/src/traces/types.d.ts +365 -0
- package/dist/src/traces/types.d.ts.map +1 -0
- package/dist/src/traces/types.js +14 -0
- package/dist/src/traces/types.js.map +1 -0
- package/dist/src/types.d.ts +495 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/types.js +27 -0
- package/dist/src/types.js.map +1 -0
- package/docs/agent-surface-policy.md +45 -0
- package/docs/memory-setup.md +226 -0
- package/hooks/_arch_scan_bg.py +88 -0
- package/hooks/_plugin_drift_check_bg.py +85 -0
- package/hooks/_session_start_lib.sh +42 -0
- package/hooks/git/pre-push +141 -0
- package/hooks/hooks.json +126 -0
- package/hooks/post-commit +30 -0
- package/hooks/pre-commit +29 -0
- package/hooks/pre-edit-apppulse.sh +6 -0
- package/hooks/pre-edit-architecture.sh +106 -0
- package/hooks/pre-edit-rally-point.sh +92 -0
- package/hooks/session-start-apppulse.sh +6 -0
- package/hooks/session-start-architecture.sh +10 -0
- package/hooks/session-start-git-hooks.sh +12 -0
- package/hooks/session-start-plugin-drift.sh +27 -0
- package/hooks/session-start-rally-point.sh +44 -0
- package/hooks/session-start-retrieval.sh +24 -0
- package/hooks/session-start-worktree-gc.sh +105 -0
- package/hooks/test_apppulse_hooks.sh +6 -0
- package/hooks/test_rally_point_hooks.sh +388 -0
- package/hooks/test_sec008_hooks.sh +66 -0
- package/package.json +111 -0
- package/scripts/README.md +301 -0
- package/scripts/_db_url.py +61 -0
- package/scripts/_paths.py +445 -0
- package/scripts/blm.py +162 -0
- package/scripts/blm_api.py +263 -0
- package/scripts/check_cache_sync.py +490 -0
- package/scripts/embed_backend.py +475 -0
- package/scripts/install_memory.py +556 -0
- package/scripts/lessons_index/__init__.py +77 -0
- package/scripts/lessons_index/__main__.py +135 -0
- package/scripts/lessons_index/ingest.py +288 -0
- package/scripts/lessons_index/query.py +285 -0
- package/scripts/lessons_index/schema.py +114 -0
- package/scripts/memory_context/__init__.py +610 -0
- package/scripts/memory_graph/__init__.py +393 -0
- package/scripts/project_resolver.py +172 -0
- package/scripts/prune_codex_plugin_cache.py +23 -0
- package/scripts/prune_plugin_cache.py +359 -0
- package/scripts/semantic_index/__init__.py +482 -0
- package/scripts/semantic_index/_bench_hybrid.py +175 -0
- package/scripts/semantic_index/backfill.py +263 -0
- package/scripts/semantic_index/hybrid.py +174 -0
- package/scripts/semantic_index/test_backfill.py +292 -0
- package/scripts/semantic_index/test_hybrid.py +541 -0
- package/scripts/sync_navgator_lessons.py +666 -0
- package/scripts/sync_plugin_cache.py +388 -0
- package/skills/agent-rally-point/SKILL.md +165 -0
- package/skills/agent-rally-watcher/SKILL.md +83 -0
- package/skills/api-registry-bridge/SKILL.md +59 -0
- package/skills/architecture/dead/SKILL.md +56 -0
- package/skills/architecture/impact/SKILL.md +88 -0
- package/skills/architecture/review/SKILL.md +227 -0
- package/skills/architecture/rules/SKILL.md +72 -0
- package/skills/architecture/scan/SKILL.md +79 -0
- package/skills/architecture/trace/SKILL.md +65 -0
- package/skills/attribution-standard/SKILL.md +122 -0
- package/skills/authentication/SKILL.md +81 -0
- package/skills/authentication/references/better-auth-magic-link.md +135 -0
- package/skills/authentication/references/better-auth-setup.md +224 -0
- package/skills/authentication/references/google-calendar-sync.md +278 -0
- package/skills/authentication/references/google-cloud-console.md +159 -0
- package/skills/authentication/references/google-geocoding-directions.md +126 -0
- package/skills/authentication/references/google-lessons-example-web-app.md +177 -0
- package/skills/authentication/references/google-maps.md +162 -0
- package/skills/authentication/references/google-oauth-setup.md +343 -0
- package/skills/authentication/references/google-places.md +173 -0
- package/skills/authentication/references/lessons-example-web-app-better-auth.md +126 -0
- package/skills/authentication/references/resend-email.md +227 -0
- package/skills/authentication/references/resend-otp-magic-link.md +153 -0
- package/skills/authentication/references/supabase-auth.md +172 -0
- package/skills/auto-decision-capture/SKILL.md +419 -0
- package/skills/build-loop/SKILL.md +516 -0
- package/skills/build-loop/detect-plugins.mjs +82 -0
- package/skills/build-loop/eval-guide.md +65 -0
- package/skills/build-loop/fallbacks.md +549 -0
- package/skills/build-loop/phases/fact-check.md +42 -0
- package/skills/build-loop/phases/ui-validation.md +267 -0
- package/skills/build-loop/references/apple-native-planning.md +439 -0
- package/skills/build-loop/references/capability-routing.md +181 -0
- package/skills/build-loop/references/codex-subagents.md +98 -0
- package/skills/build-loop/references/coordination.md +161 -0
- package/skills/build-loop/references/correction-aware-capture.md +177 -0
- package/skills/build-loop/references/independent-auditor.md +72 -0
- package/skills/build-loop/references/intent-capability-pack.md +170 -0
- package/skills/build-loop/references/intent-exploration-prompts.md +96 -0
- package/skills/build-loop/references/leadership.md +72 -0
- package/skills/build-loop/references/memory.md +284 -0
- package/skills/build-loop/references/modular-systems-pack.md +96 -0
- package/skills/build-loop/references/output-style.md +129 -0
- package/skills/build-loop/references/pay-it-forward-arch.md +98 -0
- package/skills/build-loop/references/phase-1-assess.md +218 -0
- package/skills/build-loop/references/phase-2-plan.md +77 -0
- package/skills/build-loop/references/phase-3-execute.md +47 -0
- package/skills/build-loop/references/phase-4-review.md +310 -0
- package/skills/build-loop/references/phase-5-iterate.md +71 -0
- package/skills/build-loop/references/phase-6-learn.md +56 -0
- package/skills/build-loop/references/recent-design-structures.md +274 -0
- package/skills/build-loop/references/refactor-history/ASSESSMENT.md +85 -0
- package/skills/build-loop/references/refactor-history/STANDALONE_TEST_RUN.md +149 -0
- package/skills/build-loop/references/refactor-history/scenarios/01-simple-bugfix.md +32 -0
- package/skills/build-loop/references/refactor-history/scenarios/02-ui-build-with-iteration.md +48 -0
- package/skills/build-loop/references/refactor-history/scenarios/03-multi-failure-escalation.md +60 -0
- package/skills/build-loop/references/refactor-history/scenarios/04-ui-build-ibr-absent.md +51 -0
- package/skills/build-loop/references/refactor-history/scenarios/05-refactor-navgator-absent.md +71 -0
- package/skills/build-loop/references/refactor-history/scenarios/06-recurring-bug-debugger-absent.md +52 -0
- package/skills/build-loop/references/refactor-history/trace-comparison.md +202 -0
- package/skills/build-loop/references/self-recursive-dev.md +77 -0
- package/skills/build-loop/references/self-review.md +232 -0
- package/skills/build-loop/references/ui-io-contract.md +116 -0
- package/skills/build-loop/scanners/audit-design-rules.mjs +476 -0
- package/skills/build-loop/scanners/require-visual-evidence.mjs +239 -0
- package/skills/build-loop/templates/backlog-item.md +35 -0
- package/skills/build-loop/templates/codex-worker-prompt.md +89 -0
- package/skills/build-loop/templates/ui-subagent-prompt.md +179 -0
- package/skills/build-loop/templates/ux-fix-plan.md +40 -0
- package/skills/building-with-deepagents/SKILL.md +195 -0
- package/skills/building-with-deepagents/references/anti-patterns.md +141 -0
- package/skills/building-with-deepagents/references/api-quick-reference.md +184 -0
- package/skills/capabilities/SKILL.md +91 -0
- package/skills/debug-loop/SKILL.md +278 -0
- package/skills/debug-loop/references/convergence-rules.md +145 -0
- package/skills/debug-loop/references/swiftui-macos-clunky-ui-debugger.html +823 -0
- package/skills/debugging/assess/SKILL.md +111 -0
- package/skills/debugging/debug-loop/SKILL.md +231 -0
- package/skills/debugging/memory/SKILL.md +147 -0
- package/skills/debugging/store/SKILL.md +153 -0
- package/skills/debugging-memory/SKILL.md +440 -0
- package/skills/debugging-memory/examples/incident-example.json +67 -0
- package/skills/debugging-memory/references/incident-documentation.md +280 -0
- package/skills/debugging-memory/references/ios-notification-alarm-playbook.md +300 -0
- package/skills/debugging-memory/references/pattern-extraction.md +163 -0
- package/skills/debugging-memory/references/subagent-integration.md +312 -0
- package/skills/defenseclaw-bridge/SKILL.md +156 -0
- package/skills/defenseclaw-bridge/references/dc-config-mapping.md +162 -0
- package/skills/defenseclaw-bridge/references/output-format.md +108 -0
- package/skills/handoff/SKILL.md +94 -0
- package/skills/ibr-bridge/SKILL.md +68 -0
- package/skills/knowledge/SKILL.md +127 -0
- package/skills/knowledge/references/recall-integration.md +83 -0
- package/skills/knowledge/templates/madr-minimal.md +56 -0
- package/skills/knowledge-review/SKILL.md +112 -0
- package/skills/logging-tracer/SKILL.md +202 -0
- package/skills/logging-tracer/references/log-analysis.md +128 -0
- package/skills/logging-tracer/references/stack-templates.md +274 -0
- package/skills/logging-tracer-bridge/SKILL.md +70 -0
- package/skills/mcp-builder/SKILL.md +278 -0
- package/skills/mcp-builder/references/mcp-security.md +106 -0
- package/skills/model-tiering/SKILL.md +216 -0
- package/skills/native-ax-driver/SKILL.md +220 -0
- package/skills/native-ax-driver/scripts/layout_fill.py +222 -0
- package/skills/native-ax-driver/scripts/native_driver.py +495 -0
- package/skills/native-ax-driver/swift/bl-ax-driver/Package.swift +20 -0
- package/skills/native-ax-driver/swift/bl-ax-driver/Sources/main.swift +542 -0
- package/skills/optimize/SKILL.md +202 -0
- package/skills/optimize/profiles.md +61 -0
- package/skills/plan-verify/SKILL.md +115 -0
- package/skills/plan-verify/test-fixtures/example-app-v20-findings.json +27 -0
- package/skills/plan-verify/test-fixtures/example-app-v20.md +42 -0
- package/skills/plan-verify/test-fixtures/example-app-v22-findings.json +15 -0
- package/skills/plan-verify/test-fixtures/example-app-v22.md +1608 -0
- package/skills/plan-verify/test-fixtures/unrelated-good-plan-findings.json +15 -0
- package/skills/plan-verify/test-fixtures/unrelated-good-plan.md +55 -0
- package/skills/plugin-builder/SKILL.md +329 -0
- package/skills/plugin-builder/references/authoritative-sources.md +104 -0
- package/skills/plugin-builder/references/build-loop-phase-guidance.md +94 -0
- package/skills/plugin-builder/references/components-guide.md +221 -0
- package/skills/plugin-builder/references/distribution.md +317 -0
- package/skills/plugin-builder/references/dual-host-claude-codex.md +220 -0
- package/skills/plugin-builder/references/hooks-reference.md +210 -0
- package/skills/plugin-builder/references/manifest-schema.md +111 -0
- package/skills/plugin-builder/references/plugin-hygiene-lessons.md +307 -0
- package/skills/plugin-tests/SKILL.md +94 -0
- package/skills/prd-bridge/SKILL.md +135 -0
- package/skills/research/SKILL.md +80 -0
- package/skills/security-methodology/SKILL.md +105 -0
- package/skills/security-methodology/references/cross-source-matrix.md +77 -0
- package/skills/security-methodology/references/mitre-atlas-starter.md +83 -0
- package/skills/security-methodology/references/nist-600-1-mapping.md +119 -0
- package/skills/security-methodology/references/owasp-agentic-top-10.md +157 -0
- package/skills/security-methodology/references/owasp-llm-top-10.md +144 -0
- package/skills/security-methodology/references/owasp-web-top-10.md +65 -0
- package/skills/self-improve/SKILL.md +298 -0
- package/skills/spec-writing/SKILL.md +548 -0
- package/skills/spec-writing/scripts/check_checklist.py +478 -0
- package/skills/sync-skills/SKILL.md +132 -0
- package/skills/telemetry/SKILL.md +66 -0
- package/skills/ui-design/SKILL.md +75 -0
- package/skills/ui-design/references/design-patterns-multi.md +165 -0
- package/skills/ui-design/references/design-preferences-from-owned-apps.md +150 -0
- package/skills/ui-design/references/evidence-capture-policy.md +55 -0
- package/skills/ui-design/references/ui-guidance-sources.md +330 -0
- package/skills/ui-design/references/universal-design-principles.alt.md +182 -0
- package/skills/ui-design/references/universal-design-principles.md +419 -0
- package/templates/memory/MEMORY.md.template +55 -0
- package/templates/memory/constitution.md.template +64 -0
- package/templates/memory/manifest.json +47 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: NNNN
|
|
3
|
+
slug: kebab-case-slug
|
|
4
|
+
title: Full sentence describing the decision
|
|
5
|
+
type: decision
|
|
6
|
+
status: proposed
|
|
7
|
+
confidence: explicit
|
|
8
|
+
date: YYYY-MM-DD
|
|
9
|
+
tags: [primary-tag, secondary-tag]
|
|
10
|
+
primary_tag: primary-tag
|
|
11
|
+
entity: subject-of-decision
|
|
12
|
+
# v2 metadata (added 2026-05-04). All required at write time; defaults are
|
|
13
|
+
# applied by `scripts/write_decision.py` so manual MADR drafts can omit them.
|
|
14
|
+
project: project-name
|
|
15
|
+
tool: claude-code
|
|
16
|
+
model: claude-opus-4-7
|
|
17
|
+
task_category: feature
|
|
18
|
+
author: tyroneross
|
|
19
|
+
source: manual
|
|
20
|
+
related_runs: []
|
|
21
|
+
related_decisions: []
|
|
22
|
+
supersedes: null
|
|
23
|
+
superseded_by: null
|
|
24
|
+
bookmark_snapshot_id: null
|
|
25
|
+
captured_turn_excerpt: null
|
|
26
|
+
last_validated: null
|
|
27
|
+
last_accessed: null
|
|
28
|
+
files_touched: []
|
|
29
|
+
closing_commit: null
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
<!-- SPDX-FileCopyrightText: 2025-2026 Tyrone Ross, Jr <46267523+tyroneross@users.noreply.github.com> | SPDX-License-Identifier: Apache-2.0 -->
|
|
33
|
+
|
|
34
|
+
# {Title}
|
|
35
|
+
|
|
36
|
+
## Context
|
|
37
|
+
|
|
38
|
+
(1–3 sentences. What problem are we solving? What forced this choice now?)
|
|
39
|
+
|
|
40
|
+
## Decision
|
|
41
|
+
|
|
42
|
+
(1 sentence. The choice in active voice: "We will use X.")
|
|
43
|
+
|
|
44
|
+
## Alternatives considered
|
|
45
|
+
|
|
46
|
+
- **Option A** — short description. Pros: …. Cons: …. Why not chosen: ….
|
|
47
|
+
- **Option B** — short description. Pros: …. Cons: …. Why not chosen: ….
|
|
48
|
+
|
|
49
|
+
## Consequences
|
|
50
|
+
|
|
51
|
+
- (1–3 bullets. What follows from this choice? Trade-offs accepted? Future
|
|
52
|
+
work this enables or precludes?)
|
|
53
|
+
|
|
54
|
+
## Notes
|
|
55
|
+
|
|
56
|
+
(Optional. Implementation pointers, related links, supersession context.)
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: knowledge-review
|
|
3
|
+
description: Repo-local episodic memory review surface. Use when the user asks to "review my decisions", "show review queue", "check decision rot", "list open conflicts", "find stale procedures", or runs `/knowledge:review`. Read-only — never auto-resolves.
|
|
4
|
+
user-invocable: false
|
|
5
|
+
when_to_use: |
|
|
6
|
+
- User runs `/knowledge:review` or asks to surface review-needing items
|
|
7
|
+
- User wants to see decisions older than the staleness threshold
|
|
8
|
+
- User wants to see `_review/` queue items awaiting promotion
|
|
9
|
+
- User wants to see open `fact_conflicts` rows
|
|
10
|
+
- User wants to see procedures whose `depends_on` symbols are missing from the codebase
|
|
11
|
+
namespace: .episodic/decisions/_review/, .episodic/decisions/, .procedural/, agent_memory.<schema>.fact_conflicts
|
|
12
|
+
companion_scripts:
|
|
13
|
+
- scripts/knowledge_review.py — aggregates all four sections into a markdown report
|
|
14
|
+
- scripts/detect_decision_rot.py — drives the rot section
|
|
15
|
+
- scripts/procedural_governance.py — drives the stale-procedures section (validate-symbols mode)
|
|
16
|
+
- scripts/consolidate_memory.py — referenced as the next-step action when surface items accumulate
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
<!-- SPDX-FileCopyrightText: 2025-2026 Tyrone Ross, Jr <46267523+tyroneross@users.noreply.github.com> | SPDX-License-Identifier: Apache-2.0 -->
|
|
20
|
+
|
|
21
|
+
# knowledge-review — surface review-needing items
|
|
22
|
+
|
|
23
|
+
`/knowledge:review` is the read-only review surface for the four-memory-types
|
|
24
|
+
framework (Working / Episodic / Semantic / Procedural). It does NOT modify
|
|
25
|
+
any data; it lists what humans need to decide on.
|
|
26
|
+
|
|
27
|
+
The full design lives at
|
|
28
|
+
`~/dev/research/topics/repo-episodic-memory-framework/repo-episodic-memory-framework.md`
|
|
29
|
+
(see §11–§14).
|
|
30
|
+
|
|
31
|
+
## What it surfaces
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
┌────────────────────────────────────────────────────────────────┐
|
|
35
|
+
│ knowledge_review.py — four sections │
|
|
36
|
+
├────────────────────────────────────────────────────────────────┤
|
|
37
|
+
│ 1. Review queue — `.episodic/decisions/_review/` │
|
|
38
|
+
│ Tier-3 captures awaiting promotion │
|
|
39
|
+
│ 2. Decision rot — decisions older than threshold │
|
|
40
|
+
│ (default 90 days) │
|
|
41
|
+
│ 3. Open conflicts — fact_conflicts rows resolved=FALSE │
|
|
42
|
+
│ (skipped when DB unavailable) │
|
|
43
|
+
│ 4. Stale procedures — depends_on symbols missing from code │
|
|
44
|
+
└────────────────────────────────────────────────────────────────┘
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Each item carries a suggested action. The user takes the action via
|
|
48
|
+
existing scripts:
|
|
49
|
+
|
|
50
|
+
| Section | Action | Script |
|
|
51
|
+
|---|---|---|
|
|
52
|
+
| Review queue | promote | `mv .episodic/decisions/_review/<file> .episodic/decisions/` then `python3 scripts/sync_db_from_files.py` |
|
|
53
|
+
| Review queue | dismiss | `rm .episodic/decisions/_review/<file>` |
|
|
54
|
+
| Decision rot | mark-validated | edit frontmatter to add `last_validated: YYYY-MM-DD` |
|
|
55
|
+
| Decision rot | supersede | `python3 scripts/supersede_decision.py --old-id <id> ...` |
|
|
56
|
+
| Decision rot | revoke | `python3 scripts/revoke_decision.py --id <id> --reason ...` |
|
|
57
|
+
| Open conflicts | resolve | `UPDATE` one row in `semantic_facts` to `status='superseded'`; set `fact_conflicts.resolved=TRUE` |
|
|
58
|
+
| Stale procedures | re-verify | edit `depends_on[].last_verified` after confirming symbol still works |
|
|
59
|
+
| Stale procedures | revoke | move `.procedural/<name>/` to `.procedural/_archive/<name>/` |
|
|
60
|
+
|
|
61
|
+
## How to invoke
|
|
62
|
+
|
|
63
|
+
Slash command:
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
/knowledge:review [--rot-threshold-days N] [--no-db]
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Direct script:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
python3 scripts/knowledge_review.py \
|
|
73
|
+
--workdir "$PWD" \
|
|
74
|
+
--rot-threshold-days 90 \
|
|
75
|
+
--symbol-paths scripts,src,app
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Useful flags:
|
|
79
|
+
|
|
80
|
+
- `--rot-threshold-days <N>` — change the staleness threshold (default 90)
|
|
81
|
+
- `--symbol-paths <csv>` — codebase paths to grep for `depends_on` symbols
|
|
82
|
+
- `--no-db` — skip the conflicts section (faster; useful when DB is down)
|
|
83
|
+
- `--schema <name>` — Postgres schema to query (default `build_loop_memory`)
|
|
84
|
+
|
|
85
|
+
## Cross-reference: consolidation
|
|
86
|
+
|
|
87
|
+
When the review queue grows large, run consolidation to merge
|
|
88
|
+
mature candidates into `semantic_facts`:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
# Inspect what would happen
|
|
92
|
+
python3 scripts/consolidate_memory.py --workdir "$PWD" --dry-run
|
|
93
|
+
|
|
94
|
+
# Apply
|
|
95
|
+
python3 scripts/consolidate_memory.py --workdir "$PWD"
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Consolidation reads `.semantic/_candidates.jsonl` (typically populated by
|
|
99
|
+
the auto-capture batch sweep), dedupes against existing facts, and
|
|
100
|
+
records the action in `.semantic/_candidates_history.jsonl`.
|
|
101
|
+
|
|
102
|
+
## Read-only contract
|
|
103
|
+
|
|
104
|
+
This skill never:
|
|
105
|
+
- promotes items from `_review/` (user does the `mv`)
|
|
106
|
+
- mutates `last_validated` (user edits the file)
|
|
107
|
+
- resolves conflicts (user updates the rows)
|
|
108
|
+
- modifies procedure frontmatter (user edits or runs `--rewrite` on validate-symbols)
|
|
109
|
+
|
|
110
|
+
The reason: review/promotion decisions need human judgment about whether
|
|
111
|
+
a captured inference matches the user's intent. Auto-promotion would
|
|
112
|
+
poison the trusted set.
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: logging-tracer
|
|
3
|
+
description: Use when the user asks to "add logging", "add tracing", "improve observability", "OpenTelemetry", "structured logging", or reports silent failures or no runtime visibility. Generates stack-appropriate logging with optional OTel.
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
user-invocable: false
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
<!-- SPDX-FileCopyrightText: 2025-2026 Tyrone Ross, Jr <46267523+tyroneross@users.noreply.github.com> | SPDX-License-Identifier: Apache-2.0 -->
|
|
9
|
+
|
|
10
|
+
# Logging & Tracing Code Generation
|
|
11
|
+
|
|
12
|
+
Generate structured logging and tracing code tailored to the project's stack. Follow a tiered approach: start with zero dependencies, escalate only when the user needs distributed tracing.
|
|
13
|
+
|
|
14
|
+
## Stack Detection
|
|
15
|
+
|
|
16
|
+
Before generating code, detect the project's stack and existing logging:
|
|
17
|
+
|
|
18
|
+
1. Check for `package.json` (Node.js/TypeScript), `requirements.txt`/`pyproject.toml` (Python), `go.mod` (Go), `Cargo.toml` (Rust), `Gemfile` (Ruby)
|
|
19
|
+
2. Check for existing logging frameworks:
|
|
20
|
+
- Node.js: winston, pino, bunyan, console
|
|
21
|
+
- Python: logging, loguru, structlog
|
|
22
|
+
- Go: zap, zerolog, logrus, slog
|
|
23
|
+
3. Check for existing tracing: OpenTelemetry SDK, Sentry SDK, Datadog agent
|
|
24
|
+
4. Detect the application type: API server, CLI tool, web app, worker/queue processor
|
|
25
|
+
|
|
26
|
+
If existing logging exists, extend it rather than replacing it. If uncertain about the stack, ask the user before generating code.
|
|
27
|
+
|
|
28
|
+
## Tiered Code Generation
|
|
29
|
+
|
|
30
|
+
### Tier 1: Zero-Dependency Structured Logging (Default)
|
|
31
|
+
|
|
32
|
+
Generate a single logger module using only built-in language features. Output structured JSON to stderr (not stdout, which may be used for data or protocols).
|
|
33
|
+
|
|
34
|
+
**Key requirements:**
|
|
35
|
+
- Log levels: debug, info, warn, error
|
|
36
|
+
- Configurable minimum level via environment variable
|
|
37
|
+
- Structured JSON output with: timestamp, level, message, and arbitrary context fields
|
|
38
|
+
- Operation name for every log entry
|
|
39
|
+
- Duration tracking for async operations
|
|
40
|
+
|
|
41
|
+
Refer to `references/stack-templates.md` for full implementation templates per language.
|
|
42
|
+
|
|
43
|
+
### Tier 2: File-Based Logging
|
|
44
|
+
|
|
45
|
+
When the user needs persistent logs or the debugger's `read_logs` tool should discover them:
|
|
46
|
+
|
|
47
|
+
- Write logs to `logs/app.jsonl` in the project root (JSONL format, append-only)
|
|
48
|
+
- Use standard field names: `ts` (Unix ms), `level`, `msg`, `op` (operation name)
|
|
49
|
+
- Add log rotation at 10MB with 2 rotated files maximum
|
|
50
|
+
- These locations are auto-discoverable by the debugger's `read_logs` MCP tool
|
|
51
|
+
|
|
52
|
+
### Tier 3: OpenTelemetry + Free Backends
|
|
53
|
+
|
|
54
|
+
When the user explicitly requests distributed tracing or mentions OTel/Jaeger/SigNoz:
|
|
55
|
+
|
|
56
|
+
- Install the OTel SDK for their language
|
|
57
|
+
- Create a tracing initialization module with:
|
|
58
|
+
- Graceful degradation when no collector is running
|
|
59
|
+
- Hot-reload safety (prevent duplicate initialization)
|
|
60
|
+
- Smart sampling: 100% in development, 10% in production (100% for errors/slow operations)
|
|
61
|
+
- Wrap key operations in spans
|
|
62
|
+
- Recommend free backends: Jaeger (local), SigNoz (self-hosted), or Grafana Tempo
|
|
63
|
+
|
|
64
|
+
## Where to Add Logging
|
|
65
|
+
|
|
66
|
+
Guide the user on strategic placement. Log at these points:
|
|
67
|
+
|
|
68
|
+
1. **Function entry/exit** for key operations (API handlers, service methods, data pipelines)
|
|
69
|
+
2. **External calls** — every HTTP request, database query, cache operation, file I/O
|
|
70
|
+
3. **Error handlers** — always log error name, message, stack, and the operation that failed
|
|
71
|
+
4. **State transitions** — authentication changes, workflow steps, queue processing stages
|
|
72
|
+
5. **Decision points** — when code takes a branch based on runtime data (cache hit/miss, feature flag, fallback)
|
|
73
|
+
|
|
74
|
+
Avoid logging:
|
|
75
|
+
- Every iteration of a loop (use summary: "processed 150 items in 230ms")
|
|
76
|
+
- Sensitive data (passwords, tokens, PII) — redact before logging
|
|
77
|
+
- Redundant information already captured by the framework (e.g., Express request logging middleware)
|
|
78
|
+
|
|
79
|
+
## Ephemeral-by-default (mandatory for diagnostic instrumentation)
|
|
80
|
+
|
|
81
|
+
When this skill is invoked **reactively** to repair an evidence gap during a debugging session — not proactively at the user's standing request for permanent observability — the instrumentation **must not land in the final diff unless the user explicitly approves it**. Log/tracer patches that survive into commits alter timing, IO, and snapshot behavior — masking rather than fixing the original failure.
|
|
82
|
+
|
|
83
|
+
Two enforcement mechanisms; choose per invocation. Default to Mechanism A.
|
|
84
|
+
|
|
85
|
+
### Mechanism A — Runtime gate (preferred)
|
|
86
|
+
|
|
87
|
+
Wrap every new diagnostic log statement so it is inert unless `DEBUG_TRACE=1` is set:
|
|
88
|
+
|
|
89
|
+
```typescript
|
|
90
|
+
const __trace = process.env.DEBUG_TRACE === "1";
|
|
91
|
+
function trace(msg: string, meta: Record<string, unknown> = {}) {
|
|
92
|
+
if (!__trace) return;
|
|
93
|
+
const entry = { ts: new Date().toISOString(), level: "trace", msg, ...meta };
|
|
94
|
+
process.stderr.write(JSON.stringify(entry) + "\n");
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
```python
|
|
99
|
+
import os, json, sys, datetime
|
|
100
|
+
_TRACE = os.environ.get("DEBUG_TRACE") == "1"
|
|
101
|
+
def trace(msg, **meta):
|
|
102
|
+
if not _TRACE: return
|
|
103
|
+
entry = {"ts": datetime.datetime.utcnow().isoformat() + "Z", "level": "trace", "msg": msg, **meta}
|
|
104
|
+
print(json.dumps(entry), file=sys.stderr)
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Re-run the failing criterion with `DEBUG_TRACE=1 <test-command>`. Output flows to stderr for `read_logs` MCP to capture. Production paths never execute trace code in normal builds.
|
|
108
|
+
|
|
109
|
+
### Mechanism B — Throwaway patch
|
|
110
|
+
|
|
111
|
+
When the change cannot be wrapped in a runtime gate (e.g. language without env access at the call site, or the instrumentation requires structural changes like adding request IDs or new fields to types), apply the change as a `git stash` patch BEFORE re-running:
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
# After the code changes land
|
|
115
|
+
git stash push -u -m "build-loop:trace/<session-id>"
|
|
116
|
+
# Stash applied in-place
|
|
117
|
+
git stash show stash@{0}
|
|
118
|
+
# Re-run the failing criterion
|
|
119
|
+
<test-command>
|
|
120
|
+
# Diagnostics captured in .build-loop/logs/
|
|
121
|
+
# Revert after the capture completes
|
|
122
|
+
git stash drop stash@{0}
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
The orchestrator tracks the stash entry in `.build-loop/state.json.observability.interventions[].stash_id`. At Review-F the orchestrator MUST verify no stash entries remain with `build-loop:trace/` prefix; if any do, revert them before writing the scorecard.
|
|
126
|
+
|
|
127
|
+
### Keep-in-diff approval (opt-in only)
|
|
128
|
+
|
|
129
|
+
To keep instrumentation in the final diff (e.g. the user wants ongoing observability), the caller must invoke `AskUserQuestion`:
|
|
130
|
+
|
|
131
|
+
```
|
|
132
|
+
Question: "Keep the diagnostic logging added to <files> in the final diff?"
|
|
133
|
+
Options:
|
|
134
|
+
- "Revert — instrumentation was diagnostic only" (default, recommended)
|
|
135
|
+
- "Keep — convert to permanent observability (remove DEBUG_TRACE gate or unstash)"
|
|
136
|
+
- "Keep with gate — leave DEBUG_TRACE wrapping in place"
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
Default answer on user absence: **revert**. No silent retention. If the user picks "keep", remove the env-flag guard (Mechanism A) or apply the stash and drop the reference (Mechanism B).
|
|
140
|
+
|
|
141
|
+
## Code placement rules (diagnostic instrumentation)
|
|
142
|
+
|
|
143
|
+
When adding instrumentation reactively to repair an evidence gap:
|
|
144
|
+
|
|
145
|
+
- Insert at function entry/exit for functions the investigation flagged — not the whole codebase
|
|
146
|
+
- Never silently catch + log (`catch { log(...) }` without rethrow is an anti-pattern that turns errors into lost signal)
|
|
147
|
+
- Include the variable that was `undefined` / `null` / `nil` in the log entry — bare "error in X" is useless
|
|
148
|
+
- Add exactly ONE trace call per function added; no spam
|
|
149
|
+
- All calls go through the `trace()` helper (Mechanism A) or live in a throwaway stash (Mechanism B) — no unguarded log/print/eprintln statements added to the codebase
|
|
150
|
+
|
|
151
|
+
## Re-validate after adding
|
|
152
|
+
|
|
153
|
+
After the instrumentation lands:
|
|
154
|
+
|
|
155
|
+
1. Re-run the failing criterion with `DEBUG_TRACE=1` (Mechanism A) or stash applied (Mechanism B)
|
|
156
|
+
2. If tests now fail WITH informative output → return the log evidence to the caller as fresh context for the next fix attempt
|
|
157
|
+
3. If tests still fail silently → instrumentation did not solve the visibility problem; escalate to user
|
|
158
|
+
4. **Always revert** at session end unless the user explicitly approved keep-in-diff via the prompt above. The orchestrator (or caller) verifies no `build-loop:trace/` stash entries remain and no unguarded trace calls landed.
|
|
159
|
+
|
|
160
|
+
## Extended capability — escalate to standalone supporting plugin
|
|
161
|
+
|
|
162
|
+
If the bundled tier selection / codegen / placement isn't enough (e.g., the project requires a tracer backend or placement intelligence that lives in the standalone supporting plugin only, or you need cross-build log correlation), invoke the bridge:
|
|
163
|
+
|
|
164
|
+
```
|
|
165
|
+
Skill("build-loop:logging-tracer-bridge") with input { symptom, target_files, tier_hint, calledBy: "logging-tracer" }
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
The bridge pre-flights `availablePlugins.codingDebugger`. If standalone Coding Debugger is installed, it delegates to extended observability tooling there. If not installed, returns `{ delegated: false }` and this skill continues with bundled-only Tier 1/2/3 codegen.
|
|
169
|
+
|
|
170
|
+
## Log Analysis Guidance
|
|
171
|
+
|
|
172
|
+
When the user has logs but needs help interpreting them, follow this diagnostic sequence:
|
|
173
|
+
|
|
174
|
+
1. **Start with errors** — filter for error/fatal level, read newest first
|
|
175
|
+
2. **Check timing** — look for operations that took >2s or showed sudden duration spikes
|
|
176
|
+
3. **Look for patterns** — repeated errors, cascading failures, periodic spikes
|
|
177
|
+
4. **Correlate timestamps** — align logs across services/components for the same time window
|
|
178
|
+
5. **Diagnose missing logs** — if expected log entries are absent, the code path wasn't reached or the logger isn't configured
|
|
179
|
+
|
|
180
|
+
Refer to `references/log-analysis.md` for common error signatures and diagnostic checklists.
|
|
181
|
+
|
|
182
|
+
## Integration with Debugger
|
|
183
|
+
|
|
184
|
+
Generated logging code integrates with the debugger's `read_logs` MCP tool when:
|
|
185
|
+
|
|
186
|
+
- Logs are written to discoverable locations (`logs/`, `*.log`, `*.jsonl` in project root)
|
|
187
|
+
- JSONL format uses standard fields (`ts`, `level`, `msg`)
|
|
188
|
+
- Error entries include structured error objects (`error.name`, `error.message`, `error.stack`)
|
|
189
|
+
|
|
190
|
+
After adding logging, tell the user they can read logs using:
|
|
191
|
+
```
|
|
192
|
+
Use the debugger read_logs tool with source "project" to view these logs.
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
## Output Format
|
|
196
|
+
|
|
197
|
+
When generating logging code:
|
|
198
|
+
|
|
199
|
+
1. Generate the logger module first (single file)
|
|
200
|
+
2. Show 2-3 examples of how to use it in existing code
|
|
201
|
+
3. Mention the environment variable for log level configuration
|
|
202
|
+
4. If Tier 2+, note the log file location and rotation behavior
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
<!-- SPDX-FileCopyrightText: 2025-2026 Tyrone Ross, Jr <46267523+tyroneross@users.noreply.github.com> | SPDX-License-Identifier: Apache-2.0 -->
|
|
2
|
+
|
|
3
|
+
# Log Analysis — Common Patterns & Diagnostic Checklists
|
|
4
|
+
|
|
5
|
+
## Error Signature Reference
|
|
6
|
+
|
|
7
|
+
### Connection Errors
|
|
8
|
+
|
|
9
|
+
| Signature | Likely Cause | Action |
|
|
10
|
+
|-----------|-------------|--------|
|
|
11
|
+
| `ECONNREFUSED` | Service not running / wrong port | Check if target service is up, verify host:port |
|
|
12
|
+
| `ETIMEDOUT` | Network unreachable / firewall | Check network connectivity, DNS resolution |
|
|
13
|
+
| `ECONNRESET` | Remote closed connection | Check server logs, look for OOM or crash |
|
|
14
|
+
| `EPIPE` | Writing to closed socket | Handle connection lifecycle, add retry logic |
|
|
15
|
+
| `ENOTFOUND` | DNS resolution failed | Verify hostname, check DNS config |
|
|
16
|
+
|
|
17
|
+
### Database Errors
|
|
18
|
+
|
|
19
|
+
| Signature | Likely Cause | Action |
|
|
20
|
+
|-----------|-------------|--------|
|
|
21
|
+
| `P2002` (Prisma) | Unique constraint violation | Check for duplicate data, review upsert logic |
|
|
22
|
+
| `P2025` (Prisma) | Record not found | Add existence check before update/delete |
|
|
23
|
+
| `connection pool exhausted` | Too many concurrent queries | Increase pool size or add connection timeouts |
|
|
24
|
+
| `deadlock detected` | Concurrent conflicting transactions | Review transaction isolation, add retry logic |
|
|
25
|
+
| `relation does not exist` | Missing migration | Run pending migrations |
|
|
26
|
+
|
|
27
|
+
### HTTP Errors
|
|
28
|
+
|
|
29
|
+
| Code | Pattern | Common Cause |
|
|
30
|
+
|------|---------|-------------|
|
|
31
|
+
| 400 | Repeated from same endpoint | Schema validation failing — check request shape |
|
|
32
|
+
| 401 | After period of success | Token expired — check refresh logic |
|
|
33
|
+
| 403 | Specific routes only | Permission/role check — verify user permissions |
|
|
34
|
+
| 404 | After deployment | Route changed — check routing config |
|
|
35
|
+
| 429 | Burst pattern | Rate limit hit — add backoff/queue |
|
|
36
|
+
| 500 | Correlates with deploy | Regression — check recent changes |
|
|
37
|
+
| 502/503 | Periodic spikes | Upstream health — check dependent services |
|
|
38
|
+
|
|
39
|
+
### Memory & Performance
|
|
40
|
+
|
|
41
|
+
| Pattern | Likely Cause | Action |
|
|
42
|
+
|---------|-------------|--------|
|
|
43
|
+
| Steadily increasing RSS | Memory leak | Profile with --inspect, check for uncleared timers/listeners |
|
|
44
|
+
| Periodic CPU spikes | GC pauses or cron jobs | Check GC stats, review scheduled tasks |
|
|
45
|
+
| Sudden latency jump | Resource exhaustion | Check file descriptors, connections, thread pool |
|
|
46
|
+
| Gradual latency increase | Data growth | Check query plans, add indexes, paginate |
|
|
47
|
+
|
|
48
|
+
## Diagnostic Checklists
|
|
49
|
+
|
|
50
|
+
### "Application is slow"
|
|
51
|
+
|
|
52
|
+
1. Check error logs for timeouts or connection failures
|
|
53
|
+
2. Filter for operations with `dur_ms > 2000`
|
|
54
|
+
3. Group slow operations by type (db, http, cache)
|
|
55
|
+
4. Check if slowness correlates with time of day (traffic) or specific operations
|
|
56
|
+
5. Look for N+1 query patterns (many fast DB queries in sequence)
|
|
57
|
+
6. Check external API response times
|
|
58
|
+
7. Review memory usage trends for GC pressure
|
|
59
|
+
|
|
60
|
+
### "Intermittent failures"
|
|
61
|
+
|
|
62
|
+
1. Filter errors by frequency — find the most common error message
|
|
63
|
+
2. Check if errors correlate with time patterns (cron, traffic spikes, deployments)
|
|
64
|
+
3. Look for resource exhaustion (pool size, rate limits, file descriptors)
|
|
65
|
+
4. Check for race conditions (concurrent requests to same resource)
|
|
66
|
+
5. Verify retry logic — is it making the problem worse?
|
|
67
|
+
6. Check for environmental differences (works in staging, fails in production)
|
|
68
|
+
|
|
69
|
+
### "No logs at expected point"
|
|
70
|
+
|
|
71
|
+
1. Verify the code path is reached — add a log before the expected point
|
|
72
|
+
2. Check log level configuration — is `LOG_LEVEL` set too high?
|
|
73
|
+
3. Verify logger is initialized before first use
|
|
74
|
+
4. Check for swallowed exceptions (empty catch blocks)
|
|
75
|
+
5. If async: verify await chains are complete, no fire-and-forget promises
|
|
76
|
+
6. Check log output destination — stderr vs stdout vs file
|
|
77
|
+
|
|
78
|
+
### "After deployment regression"
|
|
79
|
+
|
|
80
|
+
1. Compare error rates before/after deploy timestamp
|
|
81
|
+
2. Filter for new error messages (not seen before deploy)
|
|
82
|
+
3. Check for environment variable changes
|
|
83
|
+
4. Verify database migrations ran successfully
|
|
84
|
+
5. Check for dependency version changes
|
|
85
|
+
6. Compare request/response shapes if API changed
|
|
86
|
+
7. Look for feature flag changes
|
|
87
|
+
|
|
88
|
+
## Reading JSONL Logs Efficiently
|
|
89
|
+
|
|
90
|
+
### With the debugger
|
|
91
|
+
|
|
92
|
+
```
|
|
93
|
+
Use the debugger read_logs tool:
|
|
94
|
+
- source: "project" to auto-discover project logs
|
|
95
|
+
- source: "debugger" for internal operation logs
|
|
96
|
+
- since: "1h" for last hour
|
|
97
|
+
- level: "error" for errors only
|
|
98
|
+
- keyword: "timeout" to search
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Command-line quick reference
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
# Last 20 errors
|
|
105
|
+
grep '"level":"error"' logs/app.jsonl | tail -20 | jq .
|
|
106
|
+
|
|
107
|
+
# Operations slower than 2 seconds
|
|
108
|
+
jq 'select(.dur_ms > 2000)' logs/app.jsonl
|
|
109
|
+
|
|
110
|
+
# Count errors by operation
|
|
111
|
+
jq -r 'select(.level == "error") | .op' logs/app.jsonl | sort | uniq -c | sort -rn
|
|
112
|
+
|
|
113
|
+
# Errors in last hour (Unix timestamp)
|
|
114
|
+
SINCE=$(($(date +%s) * 1000 - 3600000))
|
|
115
|
+
jq "select(.ts > $SINCE and .level == \"error\")" logs/app.jsonl
|
|
116
|
+
|
|
117
|
+
# Time range
|
|
118
|
+
jq 'select(.ts > 1710000000000 and .ts < 1710003600000)' logs/app.jsonl
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Anti-Patterns
|
|
122
|
+
|
|
123
|
+
1. **Logging sensitive data** — Never log passwords, tokens, credit card numbers, or PII. Redact before logging.
|
|
124
|
+
2. **Console.log in production** — Use structured logging. Console.log has no levels, no timestamps, no structure.
|
|
125
|
+
3. **Logging in tight loops** — Log summaries ("processed 150 items") not per-iteration ("processing item 1", "processing item 2"...).
|
|
126
|
+
4. **Multiple logging systems** — Pick one logger per service. Don't mix console.log, winston, and pino.
|
|
127
|
+
5. **Swallowing errors** — Empty catch blocks hide failures. At minimum, log the error.
|
|
128
|
+
6. **Over-logging success paths** — Log entry/exit at debug level, errors at error level. Don't flood info with every successful operation.
|