oh-my-customcodex 0.1.0
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/LICENSE +21 -0
- package/README.md +327 -0
- package/dist/cli/index.js +32054 -0
- package/dist/index.js +5469 -0
- package/package.json +89 -0
- package/templates/.claude/agents/arch-documenter.md +38 -0
- package/templates/.claude/agents/arch-speckit-agent.md +66 -0
- package/templates/.claude/agents/be-django-expert.md +47 -0
- package/templates/.claude/agents/be-express-expert.md +31 -0
- package/templates/.claude/agents/be-fastapi-expert.md +45 -0
- package/templates/.claude/agents/be-go-backend-expert.md +45 -0
- package/templates/.claude/agents/be-nestjs-expert.md +29 -0
- package/templates/.claude/agents/be-springboot-expert.md +42 -0
- package/templates/.claude/agents/db-alembic-expert.md +73 -0
- package/templates/.claude/agents/db-postgres-expert.md +38 -0
- package/templates/.claude/agents/db-redis-expert.md +38 -0
- package/templates/.claude/agents/db-supabase-expert.md +37 -0
- package/templates/.claude/agents/de-airflow-expert.md +48 -0
- package/templates/.claude/agents/de-dbt-expert.md +36 -0
- package/templates/.claude/agents/de-kafka-expert.md +83 -0
- package/templates/.claude/agents/de-pipeline-expert.md +34 -0
- package/templates/.claude/agents/de-snowflake-expert.md +38 -0
- package/templates/.claude/agents/de-spark-expert.md +38 -0
- package/templates/.claude/agents/fe-design-expert.md +120 -0
- package/templates/.claude/agents/fe-flutter-agent.md +48 -0
- package/templates/.claude/agents/fe-svelte-agent.md +33 -0
- package/templates/.claude/agents/fe-vercel-agent.md +40 -0
- package/templates/.claude/agents/fe-vuejs-agent.md +34 -0
- package/templates/.claude/agents/infra-aws-expert.md +49 -0
- package/templates/.claude/agents/infra-docker-expert.md +49 -0
- package/templates/.claude/agents/lang-golang-expert.md +46 -0
- package/templates/.claude/agents/lang-java21-expert.md +42 -0
- package/templates/.claude/agents/lang-kotlin-expert.md +45 -0
- package/templates/.claude/agents/lang-python-expert.md +45 -0
- package/templates/.claude/agents/lang-rust-expert.md +45 -0
- package/templates/.claude/agents/lang-typescript-expert.md +45 -0
- package/templates/.claude/agents/mgr-claude-code-bible.md +62 -0
- package/templates/.claude/agents/mgr-creator.md +57 -0
- package/templates/.claude/agents/mgr-gitnerd.md +50 -0
- package/templates/.claude/agents/mgr-sauron.md +163 -0
- package/templates/.claude/agents/mgr-supplier.md +39 -0
- package/templates/.claude/agents/mgr-updater.md +40 -0
- package/templates/.claude/agents/qa-engineer.md +36 -0
- package/templates/.claude/agents/qa-planner.md +78 -0
- package/templates/.claude/agents/qa-writer.md +32 -0
- package/templates/.claude/agents/sec-codeql-expert.md +56 -0
- package/templates/.claude/agents/slack-cli-expert.md +98 -0
- package/templates/.claude/agents/souls/lang-golang-expert.soul.md +21 -0
- package/templates/.claude/agents/sys-memory-keeper.md +123 -0
- package/templates/.claude/agents/sys-naggy.md +76 -0
- package/templates/.claude/agents/tool-bun-expert.md +26 -0
- package/templates/.claude/agents/tool-npm-expert.md +31 -0
- package/templates/.claude/agents/tool-optimizer.md +37 -0
- package/templates/.claude/agents/wiki-curator.md +72 -0
- package/templates/.claude/config/required-plugins.json +30 -0
- package/templates/.claude/contexts/dev.md +20 -0
- package/templates/.claude/contexts/ecomode.md +110 -0
- package/templates/.claude/contexts/index.yaml +41 -0
- package/templates/.claude/contexts/research.md +28 -0
- package/templates/.claude/contexts/review.md +23 -0
- package/templates/.claude/hooks/hooks.json +533 -0
- package/templates/.claude/hooks/scripts/adaptive-harness-scan.sh +45 -0
- package/templates/.claude/hooks/scripts/agent-start-recorder.sh +40 -0
- package/templates/.claude/hooks/scripts/agent-teams-advisor.sh +76 -0
- package/templates/.claude/hooks/scripts/audit-log.sh +64 -0
- package/templates/.claude/hooks/scripts/auto-continue-guard.sh +33 -0
- package/templates/.claude/hooks/scripts/content-hash-validator.sh +75 -0
- package/templates/.claude/hooks/scripts/context-budget-advisor.sh +107 -0
- package/templates/.claude/hooks/scripts/cost-cap-advisor.sh +71 -0
- package/templates/.claude/hooks/scripts/cwd-change-detector.sh +36 -0
- package/templates/.claude/hooks/scripts/eval-core-batch-save.sh +46 -0
- package/templates/.claude/hooks/scripts/feedback-collector.sh +92 -0
- package/templates/.claude/hooks/scripts/file-change-validator.sh +26 -0
- package/templates/.claude/hooks/scripts/git-delegation-guard.sh +57 -0
- package/templates/.claude/hooks/scripts/model-escalation-advisor.sh +106 -0
- package/templates/.claude/hooks/scripts/omcodex-auto-update.sh +4 -0
- package/templates/.claude/hooks/scripts/omcustom-auto-update.sh +177 -0
- package/templates/.claude/hooks/scripts/rtk-intercept.sh +77 -0
- package/templates/.claude/hooks/scripts/rule-deletion-guard.sh +60 -0
- package/templates/.claude/hooks/scripts/schema-validator.sh +106 -0
- package/templates/.claude/hooks/scripts/secret-filter.sh +100 -0
- package/templates/.claude/hooks/scripts/session-autofix-prompt.sh +34 -0
- package/templates/.claude/hooks/scripts/session-autofix.sh +146 -0
- package/templates/.claude/hooks/scripts/session-env-check.sh +254 -0
- package/templates/.claude/hooks/scripts/skill-extractor-analyzer.sh +49 -0
- package/templates/.claude/hooks/scripts/stage-blocker.sh +16 -0
- package/templates/.claude/hooks/scripts/stale-todo-scanner.sh +91 -0
- package/templates/.claude/hooks/scripts/stall-detection-advisor.sh +112 -0
- package/templates/.claude/hooks/scripts/stop-console-audit.sh +46 -0
- package/templates/.claude/hooks/scripts/stuck-detector.sh +199 -0
- package/templates/.claude/hooks/scripts/task-outcome-recorder.sh +119 -0
- package/templates/.claude/hooks/scripts/task-state-precompact.sh +58 -0
- package/templates/.claude/hooks/scripts/user-prompt-preprocessor.sh +32 -0
- package/templates/.claude/hooks/skill-count-reminder.sh +34 -0
- package/templates/.claude/install-hooks.sh +100 -0
- package/templates/.claude/ontology/agents.yaml +546 -0
- package/templates/.claude/ontology/graphs/agent-skill.json +102 -0
- package/templates/.claude/ontology/graphs/full-graph.json +629 -0
- package/templates/.claude/ontology/graphs/routing.json +112 -0
- package/templates/.claude/ontology/graphs/skill-rule.json +78 -0
- package/templates/.claude/ontology/rules.yaml +251 -0
- package/templates/.claude/ontology/schema.yaml +144 -0
- package/templates/.claude/ontology/skills.yaml +575 -0
- package/templates/.claude/rules/MAY-optimization.md +42 -0
- package/templates/.claude/rules/MUST-agent-design.md +340 -0
- package/templates/.claude/rules/MUST-agent-identification.md +77 -0
- package/templates/.claude/rules/MUST-agent-teams.md +293 -0
- package/templates/.claude/rules/MUST-completion-verification.md +112 -0
- package/templates/.claude/rules/MUST-continuous-improvement.md +69 -0
- package/templates/.claude/rules/MUST-enforcement-policy.md +50 -0
- package/templates/.claude/rules/MUST-intent-transparency.md +74 -0
- package/templates/.claude/rules/MUST-language-policy.md +28 -0
- package/templates/.claude/rules/MUST-orchestrator-coordination.md +399 -0
- package/templates/.claude/rules/MUST-parallel-execution.md +184 -0
- package/templates/.claude/rules/MUST-permissions.md +32 -0
- package/templates/.claude/rules/MUST-safety.md +23 -0
- package/templates/.claude/rules/MUST-sync-verification.md +145 -0
- package/templates/.claude/rules/MUST-tool-identification.md +97 -0
- package/templates/.claude/rules/SHOULD-ecomode.md +123 -0
- package/templates/.claude/rules/SHOULD-error-handling.md +33 -0
- package/templates/.claude/rules/SHOULD-hud-statusline.md +51 -0
- package/templates/.claude/rules/SHOULD-interaction.md +77 -0
- package/templates/.claude/rules/SHOULD-memory-integration.md +371 -0
- package/templates/.claude/rules/SHOULD-ontology-rag-routing.md +49 -0
- package/templates/.claude/rules/SHOULD-wiki-sync.md +73 -0
- package/templates/.claude/rules/index.yaml +141 -0
- package/templates/.claude/schemas/tool-inputs.json +62 -0
- package/templates/.claude/skills/action-validator/SKILL.md +89 -0
- package/templates/.claude/skills/adaptive-harness/SKILL.md +335 -0
- package/templates/.claude/skills/adversarial-review/SKILL.md +80 -0
- package/templates/.claude/skills/agora/SKILL.md +194 -0
- package/templates/.claude/skills/airflow-best-practices/SKILL.md +94 -0
- package/templates/.claude/skills/alembic-best-practices/SKILL.md +295 -0
- package/templates/.claude/skills/ambiguity-gate/SKILL.md +94 -0
- package/templates/.claude/skills/analysis/SKILL.md +223 -0
- package/templates/.claude/skills/audit-agents/SKILL.md +118 -0
- package/templates/.claude/skills/aws-best-practices/SKILL.md +281 -0
- package/templates/.claude/skills/claude-code-bible/SKILL.md +93 -0
- package/templates/.claude/skills/claude-code-bible/scripts/fetch-docs.js +244 -0
- package/templates/.claude/skills/claude-native/SKILL.md +215 -0
- package/templates/.claude/skills/codex-exec/SKILL.md +206 -0
- package/templates/.claude/skills/codex-exec/scripts/codex-wrapper.cjs +430 -0
- package/templates/.claude/skills/create-agent/SKILL.md +94 -0
- package/templates/.claude/skills/cve-triage/SKILL.md +91 -0
- package/templates/.claude/skills/dag-orchestration/SKILL.md +201 -0
- package/templates/.claude/skills/dbt-best-practices/SKILL.md +55 -0
- package/templates/.claude/skills/de-lead-routing/SKILL.md +230 -0
- package/templates/.claude/skills/deep-plan/SKILL.md +344 -0
- package/templates/.claude/skills/deep-verify/SKILL.md +111 -0
- package/templates/.claude/skills/dev-lead-routing/SKILL.md +161 -0
- package/templates/.claude/skills/dev-refactor/SKILL.md +234 -0
- package/templates/.claude/skills/dev-review/SKILL.md +172 -0
- package/templates/.claude/skills/django-best-practices/SKILL.md +334 -0
- package/templates/.claude/skills/docker-best-practices/SKILL.md +276 -0
- package/templates/.claude/skills/evaluator-optimizer/SKILL.md +421 -0
- package/templates/.claude/skills/fastapi-best-practices/SKILL.md +271 -0
- package/templates/.claude/skills/fix-refs/SKILL.md +109 -0
- package/templates/.claude/skills/flutter-best-practices/SKILL.md +325 -0
- package/templates/.claude/skills/gemini-exec/SKILL.md +215 -0
- package/templates/.claude/skills/gemini-exec/scripts/gemini-wrapper.cjs +485 -0
- package/templates/.claude/skills/go-backend-best-practices/SKILL.md +135 -0
- package/templates/.claude/skills/go-best-practices/SKILL.md +204 -0
- package/templates/.claude/skills/hada-scout/SKILL.md +92 -0
- package/templates/.claude/skills/harness-eval/SKILL.md +95 -0
- package/templates/.claude/skills/harness-synthesizer/SKILL.md +145 -0
- package/templates/.claude/skills/help/SKILL.md +127 -0
- package/templates/.claude/skills/idea/SKILL.md +88 -0
- package/templates/.claude/skills/impeccable-design/SKILL.md +173 -0
- package/templates/.claude/skills/intent-detection/SKILL.md +293 -0
- package/templates/.claude/skills/intent-detection/patterns/agent-triggers.yaml +438 -0
- package/templates/.claude/skills/java21-best-practices/SKILL.md +190 -0
- package/templates/.claude/skills/jinja2-prompts/SKILL.md +86 -0
- package/templates/.claude/skills/kafka-best-practices/SKILL.md +53 -0
- package/templates/.claude/skills/kotlin-best-practices/SKILL.md +257 -0
- package/templates/.claude/skills/lists/SKILL.md +80 -0
- package/templates/.claude/skills/memory-management/SKILL.md +196 -0
- package/templates/.claude/skills/memory-recall/SKILL.md +172 -0
- package/templates/.claude/skills/memory-save/SKILL.md +128 -0
- package/templates/.claude/skills/model-escalation/SKILL.md +62 -0
- package/templates/.claude/skills/monitoring-setup/SKILL.md +215 -0
- package/templates/.claude/skills/multi-model-verification/SKILL.md +130 -0
- package/templates/.claude/skills/npm-audit/SKILL.md +74 -0
- package/templates/.claude/skills/npm-publish/SKILL.md +65 -0
- package/templates/.claude/skills/npm-version/SKILL.md +104 -0
- package/templates/.claude/skills/omcodex-auto-improve/SKILL.md +136 -0
- package/templates/.claude/skills/omcodex-feedback/SKILL.md +205 -0
- package/templates/.claude/skills/omcodex-improve-report/SKILL.md +65 -0
- package/templates/.claude/skills/omcodex-loop/SKILL.md +45 -0
- package/templates/.claude/skills/omcodex-release-notes/SKILL.md +117 -0
- package/templates/.claude/skills/omcodex-takeover/SKILL.md +115 -0
- package/templates/.claude/skills/omcodex-web/SKILL.md +95 -0
- package/templates/.claude/skills/optimize-analyze/SKILL.md +57 -0
- package/templates/.claude/skills/optimize-bundle/SKILL.md +69 -0
- package/templates/.claude/skills/optimize-report/SKILL.md +76 -0
- package/templates/.claude/skills/peer-messaging/SKILL.md +59 -0
- package/templates/.claude/skills/pipeline/SKILL.md +103 -0
- package/templates/.claude/skills/pipeline-architecture-patterns/SKILL.md +84 -0
- package/templates/.claude/skills/pipeline-guards/SKILL.md +173 -0
- package/templates/.claude/skills/post-release-followup/SKILL.md +134 -0
- package/templates/.claude/skills/postgres-best-practices/SKILL.md +67 -0
- package/templates/.claude/skills/pr-auto-improve/SKILL.md +129 -0
- package/templates/.claude/skills/professor-triage/SKILL.md +321 -0
- package/templates/.claude/skills/python-best-practices/SKILL.md +223 -0
- package/templates/.claude/skills/qa-lead-routing/SKILL.md +104 -0
- package/templates/.claude/skills/react-best-practices/SKILL.md +102 -0
- package/templates/.claude/skills/reasoning-sandwich/SKILL.md +64 -0
- package/templates/.claude/skills/redis-best-practices/SKILL.md +84 -0
- package/templates/.claude/skills/release-plan/SKILL.md +207 -0
- package/templates/.claude/skills/research/SKILL.md +493 -0
- package/templates/.claude/skills/result-aggregation/SKILL.md +165 -0
- package/templates/.claude/skills/rtk-exec/SKILL.md +199 -0
- package/templates/.claude/skills/rtk-exec/scripts/rtk-wrapper.cjs +377 -0
- package/templates/.claude/skills/rust-best-practices/SKILL.md +268 -0
- package/templates/.claude/skills/sauron-watch/SKILL.md +239 -0
- package/templates/.claude/skills/scout/SKILL.md +250 -0
- package/templates/.claude/skills/sdd/SKILL.md +24 -0
- package/templates/.claude/skills/sdd-dev/SKILL.md +257 -0
- package/templates/.claude/skills/sdd-development/SKILL.md +24 -0
- package/templates/.claude/skills/secretary-routing/SKILL.md +132 -0
- package/templates/.claude/skills/skill-extractor/SKILL.md +155 -0
- package/templates/.claude/skills/skills-sh-search/SKILL.md +210 -0
- package/templates/.claude/skills/snowflake-best-practices/SKILL.md +66 -0
- package/templates/.claude/skills/spark-best-practices/SKILL.md +53 -0
- package/templates/.claude/skills/springboot-best-practices/SKILL.md +74 -0
- package/templates/.claude/skills/springboot-best-practices/examples/config-properties-example.java +22 -0
- package/templates/.claude/skills/springboot-best-practices/examples/controller-example.java +28 -0
- package/templates/.claude/skills/springboot-best-practices/examples/controller-test-example.java +33 -0
- package/templates/.claude/skills/springboot-best-practices/examples/entity-example.java +22 -0
- package/templates/.claude/skills/springboot-best-practices/examples/exception-handler-example.java +30 -0
- package/templates/.claude/skills/springboot-best-practices/examples/repository-example.java +17 -0
- package/templates/.claude/skills/springboot-best-practices/examples/repository-test-example.java +23 -0
- package/templates/.claude/skills/springboot-best-practices/examples/security-config-example.java +27 -0
- package/templates/.claude/skills/springboot-best-practices/examples/service-example.java +33 -0
- package/templates/.claude/skills/status/SKILL.md +155 -0
- package/templates/.claude/skills/structured-dev-cycle/SKILL.md +200 -0
- package/templates/.claude/skills/stuck-recovery/SKILL.md +80 -0
- package/templates/.claude/skills/supabase-postgres-best-practices/SKILL.md +100 -0
- package/templates/.claude/skills/systematic-debugging/SKILL.md +288 -0
- package/templates/.claude/skills/systematic-debugging/condition-based-waiting-example.ts +278 -0
- package/templates/.claude/skills/systematic-debugging/condition-based-waiting.md +240 -0
- package/templates/.claude/skills/systematic-debugging/defense-in-depth.md +252 -0
- package/templates/.claude/skills/systematic-debugging/find-polluter.sh +147 -0
- package/templates/.claude/skills/systematic-debugging/root-cause-tracing.md +87 -0
- package/templates/.claude/skills/task-decomposition/SKILL.md +197 -0
- package/templates/.claude/skills/typescript-best-practices/SKILL.md +322 -0
- package/templates/.claude/skills/update-docs/SKILL.md +142 -0
- package/templates/.claude/skills/update-external/SKILL.md +169 -0
- package/templates/.claude/skills/vercel-deploy/SKILL.md +75 -0
- package/templates/.claude/skills/web-design-guidelines/SKILL.md +119 -0
- package/templates/.claude/skills/wiki/SKILL.md +426 -0
- package/templates/.claude/skills/wiki-rag/SKILL.md +154 -0
- package/templates/.claude/skills/worker-reviewer-pipeline/SKILL.md +165 -0
- package/templates/.claude/skills/writing-clearly-and-concisely/SKILL.md +66 -0
- package/templates/.claude/statusline.sh +380 -0
- package/templates/.claude/uninstall-hooks.sh +52 -0
- package/templates/.github/workflows/wiki-sync.yml +132 -0
- package/templates/AGENTS.md.en +255 -0
- package/templates/AGENTS.md.ko +255 -0
- package/templates/CLAUDE.md +263 -0
- package/templates/CLAUDE.md.en +256 -0
- package/templates/CLAUDE.md.ko +256 -0
- package/templates/deprecated-files.json +10 -0
- package/templates/guides/agents-md-quality/README.md +110 -0
- package/templates/guides/airflow/README.md +47 -0
- package/templates/guides/alembic/README.md +438 -0
- package/templates/guides/aws/common-patterns.md +169 -0
- package/templates/guides/aws/index.yaml +26 -0
- package/templates/guides/aws/well-architected.md +143 -0
- package/templates/guides/cc-token-saver/README.md +97 -0
- package/templates/guides/claude-code/01-overview.md +42 -0
- package/templates/guides/claude-code/03-tools.md +107 -0
- package/templates/guides/claude-code/04-agent-skills.md +90 -0
- package/templates/guides/claude-code/05-agent-sdk.md +129 -0
- package/templates/guides/claude-code/06-mcp.md +165 -0
- package/templates/guides/claude-code/07-prompt-engineering.md +100 -0
- package/templates/guides/claude-code/08-testing.md +56 -0
- package/templates/guides/claude-code/09-guardrails.md +78 -0
- package/templates/guides/claude-code/10-monitoring.md +87 -0
- package/templates/guides/claude-code/11-sub-agents.md +159 -0
- package/templates/guides/claude-code/12-workflow-patterns.md +182 -0
- package/templates/guides/claude-code/13-cli-flags.md +151 -0
- package/templates/guides/claude-code/index.yaml +61 -0
- package/templates/guides/dbt/README.md +32 -0
- package/templates/guides/django-best-practices/README.md +476 -0
- package/templates/guides/docker/compose-best-practices.md +284 -0
- package/templates/guides/docker/dockerfile-best-practices.md +262 -0
- package/templates/guides/docker/index.yaml +26 -0
- package/templates/guides/drizzle-orm/README.md +69 -0
- package/templates/guides/elements-of-style/elements-of-style.html +2609 -0
- package/templates/guides/fastapi/best-practices.md +232 -0
- package/templates/guides/fastapi/index.yaml +21 -0
- package/templates/guides/flutter/architecture.md +141 -0
- package/templates/guides/flutter/fundamentals.md +119 -0
- package/templates/guides/flutter/index.yaml +44 -0
- package/templates/guides/flutter/performance.md +119 -0
- package/templates/guides/flutter/security.md +120 -0
- package/templates/guides/flutter/state-management.md +144 -0
- package/templates/guides/flutter/testing.md +155 -0
- package/templates/guides/git-worktree-workflow/README.md +138 -0
- package/templates/guides/go-backend/index.yaml +26 -0
- package/templates/guides/go-backend/project-layout.md +243 -0
- package/templates/guides/go-backend/uber-style.md +212 -0
- package/templates/guides/golang/concurrency.md +282 -0
- package/templates/guides/golang/effective-go.md +309 -0
- package/templates/guides/golang/error-handling.md +250 -0
- package/templates/guides/golang/index.yaml +27 -0
- package/templates/guides/hook-data-flow/README.md +135 -0
- package/templates/guides/iceberg/README.md +49 -0
- package/templates/guides/impeccable-design/color-and-contrast.md +278 -0
- package/templates/guides/impeccable-design/index.yaml +12 -0
- package/templates/guides/impeccable-design/motion-design.md +390 -0
- package/templates/guides/impeccable-design/typography.md +386 -0
- package/templates/guides/impeccable-design/ux-writing.md +400 -0
- package/templates/guides/index.yaml +265 -0
- package/templates/guides/java21/index.yaml +29 -0
- package/templates/guides/java21/java-style-guide.md +248 -0
- package/templates/guides/java21/modern-java21.md +303 -0
- package/templates/guides/kafka/README.md +32 -0
- package/templates/guides/kotlin/coding-conventions.md +247 -0
- package/templates/guides/kotlin/idioms.md +234 -0
- package/templates/guides/kotlin/index.yaml +26 -0
- package/templates/guides/multi-model-routing/README.md +101 -0
- package/templates/guides/multi-provider-exec/README.md +83 -0
- package/templates/guides/postgres/README.md +58 -0
- package/templates/guides/python/index.yaml +26 -0
- package/templates/guides/python/pep8-style-guide.md +202 -0
- package/templates/guides/python/zen-of-python.md +79 -0
- package/templates/guides/redis/README.md +50 -0
- package/templates/guides/rust/error-handling.md +262 -0
- package/templates/guides/rust/index.yaml +26 -0
- package/templates/guides/rust/ownership.md +180 -0
- package/templates/guides/skill-bundle-design/README.md +106 -0
- package/templates/guides/slack-cli/README.md +145 -0
- package/templates/guides/snowflake/README.md +32 -0
- package/templates/guides/spark/README.md +32 -0
- package/templates/guides/springboot/best-practices.md +361 -0
- package/templates/guides/springboot/index.yaml +22 -0
- package/templates/guides/supabase-postgres/README.md +32 -0
- package/templates/guides/supabase-postgres/index.yaml +19 -0
- package/templates/guides/typescript/advanced-types.md +225 -0
- package/templates/guides/typescript/index.yaml +26 -0
- package/templates/guides/typescript/type-system.md +219 -0
- package/templates/guides/web-design/accessibility.md +66 -0
- package/templates/guides/web-design/index.yaml +20 -0
- package/templates/guides/web-design/performance.md +102 -0
- package/templates/guides/web-scraping/README.md +926 -0
- package/templates/guides/web-scraping/index.yaml +19 -0
- package/templates/guides/worktree-lifecycle/README.md +104 -0
- package/templates/index.yaml +18 -0
- package/templates/manifest.json +49 -0
- package/templates/workflows/auto-dev.yaml +46 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
# Dependency check: exit silently if jq not available
|
|
5
|
+
command -v jq >/dev/null 2>&1 || exit 0
|
|
6
|
+
|
|
7
|
+
# Agent Teams Advisor Hook
|
|
8
|
+
# Trigger: PreToolUse, tool == "Task" || tool == "Agent"
|
|
9
|
+
# Purpose: Track Agent/Task tool usage count per session and warn when Agent Teams may be more appropriate
|
|
10
|
+
# Protocol: stdin JSON -> process -> stdout pass-through, exit 0 always (advisory only)
|
|
11
|
+
|
|
12
|
+
input=$(cat)
|
|
13
|
+
|
|
14
|
+
# Skip if Agent Teams is not available
|
|
15
|
+
ENV_STATUS="/tmp/.codex-env-status-${PPID}"
|
|
16
|
+
if [ -f "$ENV_STATUS" ]; then
|
|
17
|
+
teams_status=$(grep "agent_teams=" "$ENV_STATUS" 2>/dev/null | cut -d= -f2 || echo "unknown")
|
|
18
|
+
if [ "$teams_status" != "enabled" ]; then
|
|
19
|
+
echo "$input"
|
|
20
|
+
exit 0
|
|
21
|
+
fi
|
|
22
|
+
fi
|
|
23
|
+
|
|
24
|
+
# Batch context detection: check for workflow or release-plan state
|
|
25
|
+
BATCH_ISSUES=0
|
|
26
|
+
# Use wildcard to match any workflow name: /tmp/.codex-workflow-*-${PPID}.json
|
|
27
|
+
WORKFLOW_FILE=$(ls /tmp/.codex-workflow-*-"${PPID}".json 2>/dev/null | head -1 || true)
|
|
28
|
+
if [ -n "$WORKFLOW_FILE" ] && [ -f "$WORKFLOW_FILE" ]; then
|
|
29
|
+
BATCH_ISSUES=$(jq -r '.issue_count // 0' "$WORKFLOW_FILE" 2>/dev/null || echo 0)
|
|
30
|
+
fi
|
|
31
|
+
|
|
32
|
+
# Also check release-plan context (existence only — if file exists, treat as batch)
|
|
33
|
+
RELEASE_PLAN="/tmp/.codex-release-plan-${PPID}"
|
|
34
|
+
if [ -f "$RELEASE_PLAN" ]; then
|
|
35
|
+
if [ "$BATCH_ISSUES" -lt 3 ]; then
|
|
36
|
+
BATCH_ISSUES=3
|
|
37
|
+
fi
|
|
38
|
+
fi
|
|
39
|
+
|
|
40
|
+
# Extract task info from input
|
|
41
|
+
agent_type=$(echo "$input" | jq -r '.tool_input.subagent_type // "unknown"')
|
|
42
|
+
prompt_preview=$(echo "$input" | jq -r '.tool_input.description // ""' | head -c 60)
|
|
43
|
+
|
|
44
|
+
# Session-scoped counter using parent PID as session identifier
|
|
45
|
+
COUNTER_FILE="/tmp/.codex-task-count-${PPID}"
|
|
46
|
+
|
|
47
|
+
# Read and increment counter
|
|
48
|
+
if [ -f "$COUNTER_FILE" ]; then
|
|
49
|
+
COUNT=$(cat "$COUNTER_FILE")
|
|
50
|
+
COUNT=$((COUNT + 1))
|
|
51
|
+
else
|
|
52
|
+
COUNT=1
|
|
53
|
+
fi
|
|
54
|
+
echo "$COUNT" > "$COUNTER_FILE"
|
|
55
|
+
|
|
56
|
+
# Warn when batch context detected (even on first call) or from 2nd call onward
|
|
57
|
+
if [ "$BATCH_ISSUES" -ge 3 ] && [ "$COUNT" -eq 1 ]; then
|
|
58
|
+
echo "" >&2
|
|
59
|
+
echo "--- [R018 Advisor] Batch context detected (${BATCH_ISSUES} issues) ---" >&2
|
|
60
|
+
echo " RECOMMENDATION: Use Agent Teams (TeamCreate) for this batch." >&2
|
|
61
|
+
echo " Current: Agent(${agent_type}) -- ${prompt_preview}" >&2
|
|
62
|
+
echo "-----------------------------------------------------------" >&2
|
|
63
|
+
elif [ "$COUNT" -ge 2 ]; then
|
|
64
|
+
echo "" >&2
|
|
65
|
+
echo "--- [R018 Advisor] Agent/Task tool call #${COUNT} in this session ---" >&2
|
|
66
|
+
echo " WARNING: Multiple Task calls detected. Consider Agent Teams if:" >&2
|
|
67
|
+
echo " * 3+ agents needed for this work" >&2
|
|
68
|
+
echo " * Review -> fix -> re-review cycle exists" >&2
|
|
69
|
+
echo " * Agents need shared state or coordination" >&2
|
|
70
|
+
echo " Current: Agent(${agent_type}) -- ${prompt_preview}" >&2
|
|
71
|
+
echo "-----------------------------------------------------------" >&2
|
|
72
|
+
fi
|
|
73
|
+
|
|
74
|
+
# Always pass through -- advisory only, never blocks
|
|
75
|
+
echo "$input"
|
|
76
|
+
exit 0
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Audit Log Hook — Append-only JSONL persistence
|
|
3
|
+
# Trigger: PostToolUse on Edit, Write, Bash, Agent
|
|
4
|
+
# Purpose: Persistent audit trail for security and compliance
|
|
5
|
+
# Protocol: stdin JSON -> log entry -> stdout pass-through
|
|
6
|
+
# Always exits 0 (advisory only)
|
|
7
|
+
|
|
8
|
+
set -euo pipefail
|
|
9
|
+
HOOK_START=$(date +%s%N 2>/dev/null || echo 0)
|
|
10
|
+
|
|
11
|
+
# Dependency check: exit silently if jq not available
|
|
12
|
+
command -v jq >/dev/null 2>&1 || exit 0
|
|
13
|
+
|
|
14
|
+
input=$(cat)
|
|
15
|
+
|
|
16
|
+
# Extract fields from hook input
|
|
17
|
+
tool_name=$(echo "$input" | jq -r '.tool_name // "unknown"')
|
|
18
|
+
file_path=$(echo "$input" | jq -r '.tool_input.file_path // .tool_input.command // ""' | head -c 200)
|
|
19
|
+
agent_type=$(echo "$input" | jq -r '.agent_type // "unknown"')
|
|
20
|
+
model=$(echo "$input" | jq -r '.model // "unknown"')
|
|
21
|
+
is_error=$(echo "$input" | jq -r '.tool_output.is_error // false')
|
|
22
|
+
timestamp=$(date -u +%Y-%m-%dT%H:%M:%SZ)
|
|
23
|
+
|
|
24
|
+
# Determine outcome
|
|
25
|
+
if [ "$is_error" = "true" ]; then
|
|
26
|
+
outcome="error"
|
|
27
|
+
else
|
|
28
|
+
outcome="success"
|
|
29
|
+
fi
|
|
30
|
+
|
|
31
|
+
# Audit log location
|
|
32
|
+
AUDIT_LOG="${HOME}/.codex/audit.jsonl"
|
|
33
|
+
|
|
34
|
+
# Ensure directory exists
|
|
35
|
+
mkdir -p "$(dirname "$AUDIT_LOG")"
|
|
36
|
+
|
|
37
|
+
# Write audit entry (append-only JSONL)
|
|
38
|
+
jq -cn \
|
|
39
|
+
--arg ts "$timestamp" \
|
|
40
|
+
--arg tool "$tool_name" \
|
|
41
|
+
--arg path "$file_path" \
|
|
42
|
+
--arg agent "$agent_type" \
|
|
43
|
+
--arg model "$model" \
|
|
44
|
+
--arg outcome "$outcome" \
|
|
45
|
+
--arg ppid "${PPID}" \
|
|
46
|
+
'{timestamp: $ts, tool: $tool, path: $path, agent_type: $agent, model: $model, outcome: $outcome, session_ppid: $ppid}' \
|
|
47
|
+
>> "$AUDIT_LOG" 2>/dev/null || true
|
|
48
|
+
|
|
49
|
+
# Daily rotation check (rotate if > 10MB)
|
|
50
|
+
if [ -f "$AUDIT_LOG" ]; then
|
|
51
|
+
file_size=$(stat -f%z "$AUDIT_LOG" 2>/dev/null || stat -c%s "$AUDIT_LOG" 2>/dev/null || echo "0")
|
|
52
|
+
if [ "$file_size" -gt 10485760 ]; then
|
|
53
|
+
mv "$AUDIT_LOG" "${AUDIT_LOG}.$(date -u +%Y%m%d%H%M%S)" 2>/dev/null || true
|
|
54
|
+
fi
|
|
55
|
+
fi
|
|
56
|
+
|
|
57
|
+
# Pass through
|
|
58
|
+
echo "$input"
|
|
59
|
+
HOOK_END=$(date +%s%N 2>/dev/null || echo 0)
|
|
60
|
+
if [ "$HOOK_START" != "0" ] && [ "$HOOK_END" != "0" ]; then
|
|
61
|
+
HOOK_MS=$(( (HOOK_END - HOOK_START) / 1000000 ))
|
|
62
|
+
echo "[Hook Perf] $(basename "$0"): ${HOOK_MS}ms" >> "/tmp/.codex-hook-perf-${PPID}.log"
|
|
63
|
+
fi
|
|
64
|
+
exit 0
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
# Auto-Continue Guard
|
|
5
|
+
# Trigger: SubagentStop
|
|
6
|
+
# Purpose: Count consecutive subagent completions and warn when auto-continue limit reached
|
|
7
|
+
# Protocol: stdin JSON -> count check -> stdout pass-through, exit 0 always (R021)
|
|
8
|
+
|
|
9
|
+
input=$(cat)
|
|
10
|
+
|
|
11
|
+
count_file="/tmp/.codex-loop-count-${PPID}"
|
|
12
|
+
|
|
13
|
+
# Reset counter if stale (>60s since last update)
|
|
14
|
+
if [ -f "$count_file" ]; then
|
|
15
|
+
last_mod=$(stat -c%Y "$count_file" 2>/dev/null || stat -f%m "$count_file" 2>/dev/null || echo 0)
|
|
16
|
+
now=$(date +%s)
|
|
17
|
+
if [ $((now - last_mod)) -gt 60 ]; then
|
|
18
|
+
echo 0 > "$count_file"
|
|
19
|
+
fi
|
|
20
|
+
fi
|
|
21
|
+
|
|
22
|
+
# Increment counter
|
|
23
|
+
count=$(cat "$count_file" 2>/dev/null || echo 0)
|
|
24
|
+
count=$((count + 1))
|
|
25
|
+
echo "$count" > "$count_file"
|
|
26
|
+
|
|
27
|
+
# Warn if limit reached
|
|
28
|
+
if [ "$count" -ge 4 ]; then
|
|
29
|
+
echo '[AutoContinue] SAFETY: auto-continue limit (3) reached. Pausing.' >&2
|
|
30
|
+
fi
|
|
31
|
+
|
|
32
|
+
echo "$input"
|
|
33
|
+
exit 0
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Content-Hash Validator — Detect stale file state for Edit operations
|
|
3
|
+
# Trigger: PostToolUse on Read (stores hashes), PreToolUse on Edit (validates)
|
|
4
|
+
# Purpose: Advisory warning when file content changed between Read and Edit
|
|
5
|
+
# Protocol: stdin JSON -> validate -> stdout pass-through
|
|
6
|
+
# Always exits 0 (advisory only, never blocks)
|
|
7
|
+
|
|
8
|
+
set -euo pipefail
|
|
9
|
+
|
|
10
|
+
# Dependency check: exit silently if jq not available
|
|
11
|
+
command -v jq >/dev/null 2>&1 || exit 0
|
|
12
|
+
|
|
13
|
+
input=$(cat)
|
|
14
|
+
|
|
15
|
+
# Hash store (PPID-scoped, session-only)
|
|
16
|
+
HASH_STORE="/tmp/.codex-content-hashes-${PPID}"
|
|
17
|
+
|
|
18
|
+
tool_name=$(echo "$input" | jq -r '.tool_name // "unknown"')
|
|
19
|
+
|
|
20
|
+
case "$tool_name" in
|
|
21
|
+
"Read")
|
|
22
|
+
# Store content hash for the file that was just read
|
|
23
|
+
file_path=$(echo "$input" | jq -r '.tool_input.file_path // ""')
|
|
24
|
+
|
|
25
|
+
if [ -n "$file_path" ] && [ -f "$file_path" ]; then
|
|
26
|
+
content_hash=$(md5 -q "$file_path" 2>/dev/null || md5sum "$file_path" 2>/dev/null | cut -d' ' -f1 || echo "unknown")
|
|
27
|
+
timestamp=$(date -u +%Y-%m-%dT%H:%M:%SZ)
|
|
28
|
+
|
|
29
|
+
# Store hash entry (overwrite previous for same file)
|
|
30
|
+
if [ -f "$HASH_STORE" ]; then
|
|
31
|
+
# Remove old entry for this file
|
|
32
|
+
grep -v "\"path\":\"${file_path}\"" "$HASH_STORE" > "${HASH_STORE}.tmp" 2>/dev/null || true
|
|
33
|
+
mv "${HASH_STORE}.tmp" "$HASH_STORE" 2>/dev/null || true
|
|
34
|
+
fi
|
|
35
|
+
|
|
36
|
+
jq -cn \
|
|
37
|
+
--arg path "$file_path" \
|
|
38
|
+
--arg hash "$content_hash" \
|
|
39
|
+
--arg ts "$timestamp" \
|
|
40
|
+
'{path: $path, hash: $hash, stored_at: $ts}' >> "$HASH_STORE" 2>/dev/null || true
|
|
41
|
+
fi
|
|
42
|
+
;;
|
|
43
|
+
|
|
44
|
+
"Edit")
|
|
45
|
+
# Validate that file hasn't changed since last Read
|
|
46
|
+
file_path=$(echo "$input" | jq -r '.tool_input.file_path // ""')
|
|
47
|
+
|
|
48
|
+
if [ -n "$file_path" ] && [ -f "$HASH_STORE" ] && [ -f "$file_path" ]; then
|
|
49
|
+
stored_hash=$(grep "\"path\":\"${file_path}\"" "$HASH_STORE" 2>/dev/null | tail -1 | jq -r '.hash // ""' 2>/dev/null || echo "")
|
|
50
|
+
|
|
51
|
+
if [ -n "$stored_hash" ] && [ "$stored_hash" != "unknown" ]; then
|
|
52
|
+
current_hash=$(md5 -q "$file_path" 2>/dev/null || md5sum "$file_path" 2>/dev/null | cut -d' ' -f1 || echo "unknown")
|
|
53
|
+
|
|
54
|
+
if [ "$current_hash" != "unknown" ] && [ "$stored_hash" != "$current_hash" ]; then
|
|
55
|
+
echo "[Content-Hash] WARNING: $(basename "$file_path") may have changed since last Read" >&2
|
|
56
|
+
echo "[Content-Hash] Stored hash: ${stored_hash:0:8}... Current: ${current_hash:0:8}..." >&2
|
|
57
|
+
echo "[Content-Hash] Advisory: re-read the file before editing if unsure" >&2
|
|
58
|
+
fi
|
|
59
|
+
fi
|
|
60
|
+
fi
|
|
61
|
+
;;
|
|
62
|
+
esac
|
|
63
|
+
|
|
64
|
+
# Ring buffer: keep last 200 entries
|
|
65
|
+
if [ -f "$HASH_STORE" ]; then
|
|
66
|
+
line_count=$(wc -l < "$HASH_STORE" 2>/dev/null || echo "0")
|
|
67
|
+
if [ "$line_count" -gt 200 ]; then
|
|
68
|
+
tail -200 "$HASH_STORE" > "${HASH_STORE}.tmp"
|
|
69
|
+
mv "${HASH_STORE}.tmp" "$HASH_STORE"
|
|
70
|
+
fi
|
|
71
|
+
fi
|
|
72
|
+
|
|
73
|
+
# Always pass through
|
|
74
|
+
echo "$input"
|
|
75
|
+
exit 0
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
HOOK_START=$(date +%s%N 2>/dev/null || echo 0)
|
|
4
|
+
|
|
5
|
+
# Dependency check: exit silently if jq not available
|
|
6
|
+
command -v jq >/dev/null 2>&1 || exit 0
|
|
7
|
+
|
|
8
|
+
# Context Budget Advisor Hook
|
|
9
|
+
# Trigger: PostToolUse (Edit/Write/Agent/Task/Read/Glob/Grep/Bash)
|
|
10
|
+
# Purpose: Monitor context usage and advise ecomode activation based on task type
|
|
11
|
+
# Protocol: stdin JSON -> stdout pass-through, exit 0 always
|
|
12
|
+
|
|
13
|
+
input=$(cat)
|
|
14
|
+
|
|
15
|
+
# Read context info from status file if available
|
|
16
|
+
STATUS_FILE="/tmp/.codex-env-status-${PPID}"
|
|
17
|
+
BUDGET_FILE="/tmp/.codex-context-budget-${PPID}"
|
|
18
|
+
|
|
19
|
+
# Initialize budget tracking file
|
|
20
|
+
if [ ! -f "$BUDGET_FILE" ]; then
|
|
21
|
+
echo "task_type=general" > "$BUDGET_FILE"
|
|
22
|
+
echo "tool_count=0" >> "$BUDGET_FILE"
|
|
23
|
+
echo "write_count=0" >> "$BUDGET_FILE"
|
|
24
|
+
echo "read_count=0" >> "$BUDGET_FILE"
|
|
25
|
+
echo "agent_count=0" >> "$BUDGET_FILE"
|
|
26
|
+
fi
|
|
27
|
+
|
|
28
|
+
# Read current counts
|
|
29
|
+
source "$BUDGET_FILE" 2>/dev/null || true
|
|
30
|
+
tool_count=${tool_count:-0}
|
|
31
|
+
write_count=${write_count:-0}
|
|
32
|
+
read_count=${read_count:-0}
|
|
33
|
+
agent_count=${agent_count:-0}
|
|
34
|
+
|
|
35
|
+
# Determine tool type from input
|
|
36
|
+
TOOL=$(echo "$input" | jq -r '.tool_name // ""' 2>/dev/null || echo "")
|
|
37
|
+
tool_count=$((tool_count + 1))
|
|
38
|
+
|
|
39
|
+
case "$TOOL" in
|
|
40
|
+
Write|Edit)
|
|
41
|
+
write_count=$((write_count + 1))
|
|
42
|
+
;;
|
|
43
|
+
Read|Glob|Grep)
|
|
44
|
+
read_count=$((read_count + 1))
|
|
45
|
+
;;
|
|
46
|
+
Task|Agent)
|
|
47
|
+
agent_count=$((agent_count + 1))
|
|
48
|
+
;;
|
|
49
|
+
esac
|
|
50
|
+
|
|
51
|
+
# Infer task type based on tool usage pattern
|
|
52
|
+
if [ "$agent_count" -ge 4 ]; then
|
|
53
|
+
task_type="research"
|
|
54
|
+
elif [ "$write_count" -gt "$read_count" ] && [ "$write_count" -ge 5 ]; then
|
|
55
|
+
task_type="implementation"
|
|
56
|
+
elif [ "$read_count" -gt "$write_count" ] && [ "$read_count" -ge 10 ]; then
|
|
57
|
+
task_type="review"
|
|
58
|
+
else
|
|
59
|
+
task_type="general"
|
|
60
|
+
fi
|
|
61
|
+
|
|
62
|
+
# Update budget file
|
|
63
|
+
cat > "$BUDGET_FILE" << EOF
|
|
64
|
+
task_type=${task_type}
|
|
65
|
+
tool_count=${tool_count}
|
|
66
|
+
write_count=${write_count}
|
|
67
|
+
read_count=${read_count}
|
|
68
|
+
agent_count=${agent_count}
|
|
69
|
+
EOF
|
|
70
|
+
|
|
71
|
+
# Determine threshold for current task type
|
|
72
|
+
case "$task_type" in
|
|
73
|
+
research) THRESHOLD=40 ;;
|
|
74
|
+
implementation) THRESHOLD=50 ;;
|
|
75
|
+
review) THRESHOLD=60 ;;
|
|
76
|
+
management) THRESHOLD=70 ;;
|
|
77
|
+
*) THRESHOLD=80 ;;
|
|
78
|
+
esac
|
|
79
|
+
|
|
80
|
+
# Emit advisory at milestones (every 25 tool calls)
|
|
81
|
+
if [ "$tool_count" -gt 0 ] && [ $((tool_count % 25)) -eq 0 ]; then
|
|
82
|
+
echo "[Context Budget] Task: ${task_type} | Threshold: ${THRESHOLD}% | Tools used: ${tool_count}" >&2
|
|
83
|
+
if [ "$tool_count" -ge 75 ]; then
|
|
84
|
+
echo "[Context Budget] ⚠ High tool usage — consider /compact or ecomode" >&2
|
|
85
|
+
fi
|
|
86
|
+
fi
|
|
87
|
+
|
|
88
|
+
# R010 compliance heartbeat (every 50 tool calls)
|
|
89
|
+
if [ "$tool_count" -gt 0 ] && [ $((tool_count % 50)) -eq 0 ]; then
|
|
90
|
+
echo "[Compliance] R007: Agent ID required | R008: Tool ID required | R010: Delegate writes" >&2
|
|
91
|
+
VIOLATION_FILE="/tmp/.codex-r010-violations-${PPID}"
|
|
92
|
+
if [ -f "$VIOLATION_FILE" ]; then
|
|
93
|
+
v_count=$(wc -l < "$VIOLATION_FILE" | tr -d ' ')
|
|
94
|
+
if [ "$v_count" -gt 0 ]; then
|
|
95
|
+
echo "[Compliance] R010 violations this session: ${v_count}" >&2
|
|
96
|
+
fi
|
|
97
|
+
fi
|
|
98
|
+
fi
|
|
99
|
+
|
|
100
|
+
# Pass through
|
|
101
|
+
echo "$input"
|
|
102
|
+
HOOK_END=$(date +%s%N 2>/dev/null || echo 0)
|
|
103
|
+
if [ "$HOOK_START" != "0" ] && [ "$HOOK_END" != "0" ]; then
|
|
104
|
+
HOOK_MS=$(( (HOOK_END - HOOK_START) / 1000000 ))
|
|
105
|
+
echo "[Hook Perf] $(basename "$0"): ${HOOK_MS}ms" >> "/tmp/.codex-hook-perf-${PPID}.log"
|
|
106
|
+
fi
|
|
107
|
+
exit 0
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# cost-cap-advisor.sh — Advisory hook for session cost monitoring
|
|
3
|
+
# Trigger: PostToolUse (Agent/Task)
|
|
4
|
+
# Purpose: Warn when session cost approaches configurable cap
|
|
5
|
+
# Protocol: stdin JSON -> stdout pass-through, exit 0 always (advisory only, R010)
|
|
6
|
+
|
|
7
|
+
input=$(cat)
|
|
8
|
+
|
|
9
|
+
# Cost bridge file written by statusline.sh
|
|
10
|
+
COST_FILE="/tmp/.codex-cost-${PPID}"
|
|
11
|
+
ADVISORY_FILE="/tmp/.codex-cost-advisory-${PPID}"
|
|
12
|
+
|
|
13
|
+
# Configurable cap (default $5.00, override via CLAUDE_COST_CAP env var)
|
|
14
|
+
COST_CAP="${CLAUDE_COST_CAP:-5.00}"
|
|
15
|
+
|
|
16
|
+
# Check if cost data is available
|
|
17
|
+
if [ ! -f "$COST_FILE" ]; then
|
|
18
|
+
echo "$input"
|
|
19
|
+
exit 0
|
|
20
|
+
fi
|
|
21
|
+
|
|
22
|
+
# TSV: cost_usd, ctx_pct, timestamp, rl_5h_pct, rl_7d_pct, rl_5h_resets, rl_7d_resets
|
|
23
|
+
IFS=$'\t' read -r cost_usd ctx_pct timestamp _rl_5h _rl_7d _rl_5h_resets _rl_7d_resets < "$COST_FILE" 2>/dev/null || {
|
|
24
|
+
echo "$input"
|
|
25
|
+
exit 0
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
# Validate cost_usd is a number
|
|
29
|
+
if ! printf '%f' "$cost_usd" >/dev/null 2>&1; then
|
|
30
|
+
echo "$input"
|
|
31
|
+
exit 0
|
|
32
|
+
fi
|
|
33
|
+
|
|
34
|
+
# Calculate percentage of cap used
|
|
35
|
+
# Use bc for float arithmetic
|
|
36
|
+
cost_pct=$(echo "scale=0; $cost_usd * 100 / $COST_CAP" | bc 2>/dev/null || echo "0")
|
|
37
|
+
|
|
38
|
+
# Staleness check — skip if data is older than 60 seconds
|
|
39
|
+
now=$(date +%s)
|
|
40
|
+
age=$((now - ${timestamp:-0}))
|
|
41
|
+
if [ "$age" -gt 60 ]; then
|
|
42
|
+
echo "$input"
|
|
43
|
+
exit 0
|
|
44
|
+
fi
|
|
45
|
+
|
|
46
|
+
# Read last advisory level to avoid repeating the same warning
|
|
47
|
+
last_level=""
|
|
48
|
+
if [ -f "$ADVISORY_FILE" ]; then
|
|
49
|
+
last_level=$(cat "$ADVISORY_FILE" 2>/dev/null || echo "")
|
|
50
|
+
fi
|
|
51
|
+
|
|
52
|
+
# Determine advisory level and emit warning (only once per level)
|
|
53
|
+
if [ "$cost_pct" -ge 100 ] && [ "$last_level" != "100" ]; then
|
|
54
|
+
echo "[Cost Cap] Session cost \$${cost_usd} has reached cap \$${COST_CAP} (${cost_pct}%)" >&2
|
|
55
|
+
echo "[Cost Cap] Consider wrapping up or increasing CLAUDE_COST_CAP" >&2
|
|
56
|
+
echo "100" > "$ADVISORY_FILE"
|
|
57
|
+
elif [ "$cost_pct" -ge 90 ] && [ "$last_level" != "90" ] && [ "$last_level" != "100" ]; then
|
|
58
|
+
echo "[Cost Cap] Session cost \$${cost_usd} at 90% of cap \$${COST_CAP}" >&2
|
|
59
|
+
echo "[Cost Cap] Ecomode recommended — consider /compact" >&2
|
|
60
|
+
echo "90" > "$ADVISORY_FILE"
|
|
61
|
+
elif [ "$cost_pct" -ge 75 ] && [ "$last_level" != "75" ] && [ "$last_level" != "90" ] && [ "$last_level" != "100" ]; then
|
|
62
|
+
echo "[Cost Cap] Session cost \$${cost_usd} at 75% of cap \$${COST_CAP}" >&2
|
|
63
|
+
echo "75" > "$ADVISORY_FILE"
|
|
64
|
+
elif [ "$cost_pct" -ge 50 ] && [ -z "$last_level" ]; then
|
|
65
|
+
echo "[Cost Cap] Session cost \$${cost_usd} at 50% of cap \$${COST_CAP}" >&2
|
|
66
|
+
echo "50" > "$ADVISORY_FILE"
|
|
67
|
+
fi
|
|
68
|
+
|
|
69
|
+
# Pass through — advisory only
|
|
70
|
+
echo "$input"
|
|
71
|
+
exit 0
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# CwdChanged hook — detect project type on directory change
|
|
3
|
+
# Advisory only — provides context hints when cwd changes
|
|
4
|
+
|
|
5
|
+
input=$(cat)
|
|
6
|
+
new_cwd=$(echo "$input" | jq -r '.new_cwd // ""' 2>/dev/null)
|
|
7
|
+
|
|
8
|
+
if [ -z "$new_cwd" ] || [ ! -d "$new_cwd" ]; then
|
|
9
|
+
echo "$input"
|
|
10
|
+
exit 0
|
|
11
|
+
fi
|
|
12
|
+
|
|
13
|
+
hints=""
|
|
14
|
+
|
|
15
|
+
# Detect project type indicators
|
|
16
|
+
if [ -f "$new_cwd/package.json" ]; then
|
|
17
|
+
hints="${hints}[Hook] Node.js project detected\n"
|
|
18
|
+
fi
|
|
19
|
+
if [ -f "$new_cwd/go.mod" ]; then
|
|
20
|
+
hints="${hints}[Hook] Go project detected\n"
|
|
21
|
+
fi
|
|
22
|
+
if [ -f "$new_cwd/Cargo.toml" ]; then
|
|
23
|
+
hints="${hints}[Hook] Rust project detected\n"
|
|
24
|
+
fi
|
|
25
|
+
if [ -f "$new_cwd/pyproject.toml" ] || [ -f "$new_cwd/requirements.txt" ]; then
|
|
26
|
+
hints="${hints}[Hook] Python project detected\n"
|
|
27
|
+
fi
|
|
28
|
+
if [ -f "$new_cwd/AGENTS.md" ]; then
|
|
29
|
+
hints="${hints}[Hook] oh-my-customcodex project detected\n"
|
|
30
|
+
fi
|
|
31
|
+
|
|
32
|
+
if [ -n "$hints" ]; then
|
|
33
|
+
printf "%b" "$hints" >&2
|
|
34
|
+
fi
|
|
35
|
+
|
|
36
|
+
echo "$input"
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
# Eval-Core Batch Save on Session End (Advisory Only)
|
|
5
|
+
# Trigger: Stop hook
|
|
6
|
+
# Purpose: Auto-collect eval metrics on session end via eval-core CLI
|
|
7
|
+
# Protocol: stdin JSON -> process -> stdout pass-through, exit 0 always
|
|
8
|
+
#
|
|
9
|
+
# This hook is advisory-only and never blocks session termination.
|
|
10
|
+
# If eval-core is unavailable or collection fails, the session continues normally.
|
|
11
|
+
|
|
12
|
+
input=$(cat)
|
|
13
|
+
PPID_FILE="/tmp/.codex-task-outcomes-${PPID}"
|
|
14
|
+
|
|
15
|
+
# Only attempt collection if outcome file exists
|
|
16
|
+
if [ ! -f "$PPID_FILE" ]; then
|
|
17
|
+
echo "$input"
|
|
18
|
+
exit 0
|
|
19
|
+
fi
|
|
20
|
+
|
|
21
|
+
# Discover eval-core CLI using multiple strategies
|
|
22
|
+
EVAL_CORE=""
|
|
23
|
+
|
|
24
|
+
# Strategy 1: Global CLI installation
|
|
25
|
+
if command -v eval-core >/dev/null 2>&1; then
|
|
26
|
+
EVAL_CORE="eval-core"
|
|
27
|
+
fi
|
|
28
|
+
|
|
29
|
+
# Strategy 2: Workspace package (oh-my-customcode development)
|
|
30
|
+
if [ -z "$EVAL_CORE" ]; then
|
|
31
|
+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
32
|
+
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
|
33
|
+
WORKSPACE_CLI="$PROJECT_ROOT/packages/eval-core/src/cli/index.ts"
|
|
34
|
+
if [ -f "$WORKSPACE_CLI" ] && command -v bun >/dev/null 2>&1; then
|
|
35
|
+
EVAL_CORE="bun run $WORKSPACE_CLI"
|
|
36
|
+
fi
|
|
37
|
+
fi
|
|
38
|
+
|
|
39
|
+
if [ -n "$EVAL_CORE" ]; then
|
|
40
|
+
echo "[Hook] Collecting eval metrics via eval-core..." >&2
|
|
41
|
+
$EVAL_CORE collect --ppid "$PPID" 2>/dev/null || true
|
|
42
|
+
fi
|
|
43
|
+
|
|
44
|
+
# Always pass through input and exit 0 (advisory only)
|
|
45
|
+
echo "$input"
|
|
46
|
+
exit 0
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# feedback-collector.sh — Auto-extract failure patterns from session outcomes
|
|
3
|
+
# Advisory-only: always exits 0, never blocks session end
|
|
4
|
+
|
|
5
|
+
set -euo pipefail
|
|
6
|
+
|
|
7
|
+
# Pass through stdin (Stop hook protocol)
|
|
8
|
+
input=$(cat)
|
|
9
|
+
|
|
10
|
+
# Dependencies check
|
|
11
|
+
command -v jq >/dev/null 2>&1 || { echo "$input"; exit 0; }
|
|
12
|
+
command -v sqlite3 >/dev/null 2>&1 || { echo "$input"; exit 0; }
|
|
13
|
+
|
|
14
|
+
# PID scoping
|
|
15
|
+
OUTCOMES_FILE="/tmp/.codex-task-outcomes-${PPID}"
|
|
16
|
+
[ -f "$OUTCOMES_FILE" ] || { echo "$input"; exit 0; }
|
|
17
|
+
|
|
18
|
+
# DB path
|
|
19
|
+
DB_PATH="${HOME}/.config/oh-my-customcode/eval-core.sqlite"
|
|
20
|
+
[ -f "$DB_PATH" ] || { echo "$input"; exit 0; }
|
|
21
|
+
|
|
22
|
+
# Log file for error diagnostics
|
|
23
|
+
LOG_FILE="/tmp/.codex-feedback-collector-${PPID}.log"
|
|
24
|
+
|
|
25
|
+
# SQL injection safety: escape single quotes
|
|
26
|
+
_sql_escape() { printf '%s' "${1//\'/\'\'}"; }
|
|
27
|
+
|
|
28
|
+
# Count failures per agent type
|
|
29
|
+
declare -A FAILURE_COUNTS
|
|
30
|
+
declare -A TOTAL_COUNTS
|
|
31
|
+
|
|
32
|
+
while IFS= read -r line; do
|
|
33
|
+
agent_type=$(echo "$line" | jq -r '.agent_type // empty' 2>/dev/null) || continue
|
|
34
|
+
outcome=$(echo "$line" | jq -r '.outcome // empty' 2>/dev/null) || continue
|
|
35
|
+
[ -z "$agent_type" ] && continue
|
|
36
|
+
|
|
37
|
+
TOTAL_COUNTS[$agent_type]=$(( ${TOTAL_COUNTS[$agent_type]:-0} + 1 ))
|
|
38
|
+
if [ "$outcome" = "failure" ]; then
|
|
39
|
+
FAILURE_COUNTS[$agent_type]=$(( ${FAILURE_COUNTS[$agent_type]:-0} + 1 ))
|
|
40
|
+
fi
|
|
41
|
+
done < "$OUTCOMES_FILE"
|
|
42
|
+
|
|
43
|
+
# Detect repeated failure agents (3+ failures)
|
|
44
|
+
TIMESTAMP=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
|
|
45
|
+
INSERTED=0
|
|
46
|
+
|
|
47
|
+
for agent_type in "${!FAILURE_COUNTS[@]}"; do
|
|
48
|
+
count=${FAILURE_COUNTS[$agent_type]}
|
|
49
|
+
total=${TOTAL_COUNTS[$agent_type]:-0}
|
|
50
|
+
[ "$count" -lt 3 ] && continue
|
|
51
|
+
|
|
52
|
+
# Determine confidence
|
|
53
|
+
if [ "$count" -ge 5 ]; then
|
|
54
|
+
confidence="high"
|
|
55
|
+
elif [ "$count" -ge 3 ]; then
|
|
56
|
+
confidence="medium"
|
|
57
|
+
else
|
|
58
|
+
confidence="low"
|
|
59
|
+
fi
|
|
60
|
+
|
|
61
|
+
# Determine action type
|
|
62
|
+
if [ "$count" -ge 5 ]; then
|
|
63
|
+
action_type="escalate"
|
|
64
|
+
else
|
|
65
|
+
action_type="augment"
|
|
66
|
+
fi
|
|
67
|
+
|
|
68
|
+
failure_rate=$(awk "BEGIN {printf \"%.2f\", $count/$total}")
|
|
69
|
+
description="Agent '${agent_type}' failed ${count}/${total} times (${failure_rate} failure rate) in session"
|
|
70
|
+
|
|
71
|
+
escaped_agent_type=$(_sql_escape "$agent_type")
|
|
72
|
+
escaped_action_type=$(_sql_escape "$action_type")
|
|
73
|
+
escaped_description=$(_sql_escape "$description")
|
|
74
|
+
escaped_confidence=$(_sql_escape "$confidence")
|
|
75
|
+
escaped_timestamp=$(_sql_escape "$TIMESTAMP")
|
|
76
|
+
|
|
77
|
+
sqlite3 "$DB_PATH" "INSERT INTO improvement_actions (target_type, target_name, action_type, description, confidence, feedback_source, status, created_at) VALUES ('agent', '${escaped_agent_type}', '${escaped_action_type}', '${escaped_description}', '${escaped_confidence}', 'outcome_derived', 'proposed', '${escaped_timestamp}');" \
|
|
78
|
+
2>>"$LOG_FILE" || {
|
|
79
|
+
echo "[feedback-collector] INSERT failed for ${agent_type}" >> "$LOG_FILE"
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
INSERTED=$((INSERTED + 1))
|
|
83
|
+
done
|
|
84
|
+
|
|
85
|
+
if [ "$INSERTED" -gt 0 ]; then
|
|
86
|
+
echo "[feedback-collector] Extracted ${INSERTED} failure pattern(s) from session outcomes" >&2
|
|
87
|
+
fi
|
|
88
|
+
|
|
89
|
+
# CRITICAL: Always pass through input and exit 0
|
|
90
|
+
# This hook MUST NEVER block session termination
|
|
91
|
+
echo "$input"
|
|
92
|
+
exit 0
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# FileChanged hook — detect external file modifications
|
|
3
|
+
# Advisory warning when files are modified outside Claude Code
|
|
4
|
+
|
|
5
|
+
input=$(cat)
|
|
6
|
+
file_path=$(echo "$input" | jq -r '.file_path // ""' 2>/dev/null)
|
|
7
|
+
change_type=$(echo "$input" | jq -r '.change_type // "modified"' 2>/dev/null)
|
|
8
|
+
|
|
9
|
+
if [ -z "$file_path" ]; then
|
|
10
|
+
echo "$input"
|
|
11
|
+
exit 0
|
|
12
|
+
fi
|
|
13
|
+
|
|
14
|
+
echo "[Hook] External file change detected: ${change_type} ${file_path}" >&2
|
|
15
|
+
|
|
16
|
+
# Warn about important files
|
|
17
|
+
case "$file_path" in
|
|
18
|
+
*/AGENTS.md|*/hooks.json|*/settings*.json)
|
|
19
|
+
echo "[Hook] WARNING: Configuration file changed externally — re-read recommended" >&2
|
|
20
|
+
;;
|
|
21
|
+
*.lock|*lockfile*)
|
|
22
|
+
echo "[Hook] Lock file changed — dependency state may have shifted" >&2
|
|
23
|
+
;;
|
|
24
|
+
esac
|
|
25
|
+
|
|
26
|
+
echo "$input"
|