@takuma-hirai/hirai-method 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/.claude/.stale-harness-state/last-check +0 -0
- package/.claude/CommonRules.md +121 -0
- package/.claude/agents/01-core-development/api-designer.md +237 -0
- package/.claude/agents/01-core-development/backend-developer.md +222 -0
- package/.claude/agents/01-core-development/design-bridge.md +127 -0
- package/.claude/agents/01-core-development/electron-pro.md +240 -0
- package/.claude/agents/01-core-development/frontend-developer.md +133 -0
- package/.claude/agents/01-core-development/fullstack-developer.md +235 -0
- package/.claude/agents/01-core-development/graphql-architect.md +238 -0
- package/.claude/agents/01-core-development/microservices-architect.md +239 -0
- package/.claude/agents/01-core-development/mobile-developer.md +283 -0
- package/.claude/agents/01-core-development/ui-designer.md +174 -0
- package/.claude/agents/01-core-development/websocket-engineer.md +150 -0
- package/.claude/agents/03-infrastructure/azure-infra-engineer.md +53 -0
- package/.claude/agents/03-infrastructure/cloud-architect.md +277 -0
- package/.claude/agents/03-infrastructure/database-administrator.md +287 -0
- package/.claude/agents/03-infrastructure/deployment-engineer.md +287 -0
- package/.claude/agents/03-infrastructure/devops-engineer.md +287 -0
- package/.claude/agents/03-infrastructure/devops-incident-responder.md +287 -0
- package/.claude/agents/03-infrastructure/docker-expert.md +278 -0
- package/.claude/agents/03-infrastructure/incident-responder.md +287 -0
- package/.claude/agents/03-infrastructure/kubernetes-specialist.md +287 -0
- package/.claude/agents/03-infrastructure/network-engineer.md +287 -0
- package/.claude/agents/03-infrastructure/platform-engineer.md +287 -0
- package/.claude/agents/03-infrastructure/security-engineer.md +277 -0
- package/.claude/agents/03-infrastructure/sre-engineer.md +287 -0
- package/.claude/agents/03-infrastructure/terraform-engineer.md +287 -0
- package/.claude/agents/03-infrastructure/terragrunt-expert.md +307 -0
- package/.claude/agents/03-infrastructure/windows-infra-admin.md +52 -0
- package/.claude/agents/04-quality-security/accessibility-tester.md +277 -0
- package/.claude/agents/04-quality-security/ad-security-reviewer.md +56 -0
- package/.claude/agents/04-quality-security/ai-writing-auditor.md +77 -0
- package/.claude/agents/04-quality-security/architect-reviewer.md +287 -0
- package/.claude/agents/04-quality-security/chaos-engineer.md +277 -0
- package/.claude/agents/04-quality-security/code-reviewer.md +287 -0
- package/.claude/agents/04-quality-security/compliance-auditor.md +277 -0
- package/.claude/agents/04-quality-security/debugger.md +287 -0
- package/.claude/agents/04-quality-security/error-detective.md +287 -0
- package/.claude/agents/04-quality-security/penetration-tester.md +287 -0
- package/.claude/agents/04-quality-security/performance-engineer.md +287 -0
- package/.claude/agents/04-quality-security/powershell-security-hardening.md +54 -0
- package/.claude/agents/04-quality-security/qa-expert.md +287 -0
- package/.claude/agents/04-quality-security/security-auditor.md +287 -0
- package/.claude/agents/04-quality-security/test-automator.md +287 -0
- package/.claude/agents/04-quality-security/ui-ux-tester.md +234 -0
- package/.claude/agents/06-developer-experience/build-engineer.md +286 -0
- package/.claude/agents/06-developer-experience/cli-developer.md +286 -0
- package/.claude/agents/06-developer-experience/dependency-manager.md +286 -0
- package/.claude/agents/06-developer-experience/documentation-engineer.md +276 -0
- package/.claude/agents/06-developer-experience/dx-optimizer.md +286 -0
- package/.claude/agents/06-developer-experience/git-workflow-manager.md +286 -0
- package/.claude/agents/06-developer-experience/legacy-modernizer.md +286 -0
- package/.claude/agents/06-developer-experience/mcp-developer.md +275 -0
- package/.claude/agents/06-developer-experience/powershell-module-architect.md +58 -0
- package/.claude/agents/06-developer-experience/powershell-ui-architect.md +135 -0
- package/.claude/agents/06-developer-experience/readme-generator.md +238 -0
- package/.claude/agents/06-developer-experience/refactoring-specialist.md +286 -0
- package/.claude/agents/06-developer-experience/slack-expert.md +232 -0
- package/.claude/agents/06-developer-experience/tooling-engineer.md +286 -0
- package/.claude/agents/09-meta-orchestration/agent-installer.md +97 -0
- package/.claude/agents/09-meta-orchestration/agent-organizer.md +287 -0
- package/.claude/agents/09-meta-orchestration/codebase-orchestrator.md +249 -0
- package/.claude/agents/09-meta-orchestration/context-manager.md +287 -0
- package/.claude/agents/09-meta-orchestration/error-coordinator.md +287 -0
- package/.claude/agents/09-meta-orchestration/it-ops-orchestrator.md +60 -0
- package/.claude/agents/09-meta-orchestration/knowledge-synthesizer.md +287 -0
- package/.claude/agents/09-meta-orchestration/multi-agent-coordinator.md +287 -0
- package/.claude/agents/09-meta-orchestration/performance-monitor.md +287 -0
- package/.claude/agents/09-meta-orchestration/task-distributor.md +287 -0
- package/.claude/agents/09-meta-orchestration/workflow-orchestrator.md +287 -0
- package/.claude/agents/10-research-analysis/competitive-analyst.md +287 -0
- package/.claude/agents/10-research-analysis/data-researcher.md +287 -0
- package/.claude/agents/10-research-analysis/market-researcher.md +287 -0
- package/.claude/agents/10-research-analysis/project-idea-validator.md +269 -0
- package/.claude/agents/10-research-analysis/research-analyst.md +287 -0
- package/.claude/agents/10-research-analysis/scientific-literature-researcher.md +151 -0
- package/.claude/agents/10-research-analysis/search-specialist.md +287 -0
- package/.claude/agents/10-research-analysis/trend-analyst.md +287 -0
- package/.claude/archive/README.md +47 -0
- package/.claude/archive/agents/02-language-specialists/angular-architect.md +287 -0
- package/.claude/archive/agents/02-language-specialists/cpp-pro.md +277 -0
- package/.claude/archive/agents/02-language-specialists/csharp-developer.md +287 -0
- package/.claude/archive/agents/02-language-specialists/django-developer.md +287 -0
- package/.claude/archive/agents/02-language-specialists/dotnet-core-expert.md +287 -0
- package/.claude/archive/agents/02-language-specialists/dotnet-framework-4.8-expert.md +306 -0
- package/.claude/archive/agents/02-language-specialists/elixir-expert.md +311 -0
- package/.claude/archive/agents/02-language-specialists/expo-react-native-expert.md +268 -0
- package/.claude/archive/agents/02-language-specialists/fastapi-developer.md +287 -0
- package/.claude/archive/agents/02-language-specialists/flutter-expert.md +287 -0
- package/.claude/archive/agents/02-language-specialists/golang-pro.md +277 -0
- package/.claude/archive/agents/02-language-specialists/java-architect.md +287 -0
- package/.claude/archive/agents/02-language-specialists/javascript-pro.md +277 -0
- package/.claude/archive/agents/02-language-specialists/kotlin-specialist.md +287 -0
- package/.claude/archive/agents/02-language-specialists/laravel-specialist.md +287 -0
- package/.claude/archive/agents/02-language-specialists/nextjs-developer.md +287 -0
- package/.claude/archive/agents/02-language-specialists/node-specialist.md +124 -0
- package/.claude/archive/agents/02-language-specialists/php-pro.md +287 -0
- package/.claude/archive/agents/02-language-specialists/powershell-5.1-expert.md +59 -0
- package/.claude/archive/agents/02-language-specialists/powershell-7-expert.md +57 -0
- package/.claude/archive/agents/02-language-specialists/python-pro.md +277 -0
- package/.claude/archive/agents/02-language-specialists/rails-expert.md +358 -0
- package/.claude/archive/agents/02-language-specialists/react-specialist.md +287 -0
- package/.claude/archive/agents/02-language-specialists/rust-engineer.md +287 -0
- package/.claude/archive/agents/02-language-specialists/spring-boot-engineer.md +287 -0
- package/.claude/archive/agents/02-language-specialists/sql-pro.md +287 -0
- package/.claude/archive/agents/02-language-specialists/swift-expert.md +287 -0
- package/.claude/archive/agents/02-language-specialists/symfony-specialist.md +354 -0
- package/.claude/archive/agents/02-language-specialists/typescript-pro.md +277 -0
- package/.claude/archive/agents/02-language-specialists/vue-expert.md +287 -0
- package/.claude/archive/agents/05-data-ai/ai-engineer.md +287 -0
- package/.claude/archive/agents/05-data-ai/data-analyst.md +277 -0
- package/.claude/archive/agents/05-data-ai/data-engineer.md +287 -0
- package/.claude/archive/agents/05-data-ai/data-scientist.md +287 -0
- package/.claude/archive/agents/05-data-ai/database-optimizer.md +287 -0
- package/.claude/archive/agents/05-data-ai/llm-architect.md +287 -0
- package/.claude/archive/agents/05-data-ai/machine-learning-engineer.md +277 -0
- package/.claude/archive/agents/05-data-ai/ml-engineer.md +287 -0
- package/.claude/archive/agents/05-data-ai/mlops-engineer.md +287 -0
- package/.claude/archive/agents/05-data-ai/nlp-engineer.md +287 -0
- package/.claude/archive/agents/05-data-ai/postgres-pro.md +287 -0
- package/.claude/archive/agents/05-data-ai/prompt-engineer.md +287 -0
- package/.claude/archive/agents/05-data-ai/reinforcement-learning-engineer.md +277 -0
- package/.claude/archive/agents/07-specialized-domains/api-documenter.md +277 -0
- package/.claude/archive/agents/07-specialized-domains/blockchain-developer.md +287 -0
- package/.claude/archive/agents/07-specialized-domains/embedded-systems.md +287 -0
- package/.claude/archive/agents/07-specialized-domains/fintech-engineer.md +287 -0
- package/.claude/archive/agents/07-specialized-domains/game-developer.md +287 -0
- package/.claude/archive/agents/07-specialized-domains/healthcare-admin.md +199 -0
- package/.claude/archive/agents/07-specialized-domains/iot-engineer.md +287 -0
- package/.claude/archive/agents/07-specialized-domains/m365-admin.md +48 -0
- package/.claude/archive/agents/07-specialized-domains/mobile-app-developer.md +287 -0
- package/.claude/archive/agents/07-specialized-domains/payment-integration.md +287 -0
- package/.claude/archive/agents/07-specialized-domains/quant-analyst.md +287 -0
- package/.claude/archive/agents/07-specialized-domains/risk-manager.md +287 -0
- package/.claude/archive/agents/07-specialized-domains/seo-specialist.md +184 -0
- package/.claude/archive/agents/08-business-product/business-analyst.md +287 -0
- package/.claude/archive/agents/08-business-product/content-marketer.md +287 -0
- package/.claude/archive/agents/08-business-product/customer-success-manager.md +287 -0
- package/.claude/archive/agents/08-business-product/legal-advisor.md +287 -0
- package/.claude/archive/agents/08-business-product/license-engineer.md +295 -0
- package/.claude/archive/agents/08-business-product/product-manager.md +287 -0
- package/.claude/archive/agents/08-business-product/project-manager.md +287 -0
- package/.claude/archive/agents/08-business-product/sales-engineer.md +287 -0
- package/.claude/archive/agents/08-business-product/scrum-master.md +287 -0
- package/.claude/archive/agents/08-business-product/technical-writer.md +287 -0
- package/.claude/archive/agents/08-business-product/ux-researcher.md +287 -0
- package/.claude/archive/agents/08-business-product/wordpress-master.md +316 -0
- package/.claude/archive/skills/competitive-ads-extractor/SKILL.md +293 -0
- package/.claude/archive/skills/developer-growth-analysis/SKILL.md +322 -0
- package/.claude/archive/skills/document-docx/LICENSE.txt +30 -0
- package/.claude/archive/skills/document-docx/SKILL.md +197 -0
- package/.claude/archive/skills/document-docx/docx-js.md +350 -0
- package/.claude/archive/skills/document-docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +1499 -0
- package/.claude/archive/skills/document-docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +146 -0
- package/.claude/archive/skills/document-docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +1085 -0
- package/.claude/archive/skills/document-docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +11 -0
- package/.claude/archive/skills/document-docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-main.xsd +3081 -0
- package/.claude/archive/skills/document-docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +23 -0
- package/.claude/archive/skills/document-docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +185 -0
- package/.claude/archive/skills/document-docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +287 -0
- package/.claude/archive/skills/document-docx/ooxml/schemas/ISO-IEC29500-4_2016/pml.xsd +1676 -0
- package/.claude/archive/skills/document-docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +28 -0
- package/.claude/archive/skills/document-docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +144 -0
- package/.claude/archive/skills/document-docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +174 -0
- package/.claude/archive/skills/document-docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +25 -0
- package/.claude/archive/skills/document-docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +18 -0
- package/.claude/archive/skills/document-docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +59 -0
- package/.claude/archive/skills/document-docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +56 -0
- package/.claude/archive/skills/document-docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +195 -0
- package/.claude/archive/skills/document-docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-math.xsd +582 -0
- package/.claude/archive/skills/document-docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +25 -0
- package/.claude/archive/skills/document-docx/ooxml/schemas/ISO-IEC29500-4_2016/sml.xsd +4439 -0
- package/.claude/archive/skills/document-docx/ooxml/schemas/ISO-IEC29500-4_2016/vml-main.xsd +570 -0
- package/.claude/archive/skills/document-docx/ooxml/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +509 -0
- package/.claude/archive/skills/document-docx/ooxml/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +12 -0
- package/.claude/archive/skills/document-docx/ooxml/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +108 -0
- package/.claude/archive/skills/document-docx/ooxml/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +96 -0
- package/.claude/archive/skills/document-docx/ooxml/schemas/ISO-IEC29500-4_2016/wml.xsd +3646 -0
- package/.claude/archive/skills/document-docx/ooxml/schemas/ISO-IEC29500-4_2016/xml.xsd +116 -0
- package/.claude/archive/skills/document-docx/ooxml/schemas/ecma/fouth-edition/opc-contentTypes.xsd +42 -0
- package/.claude/archive/skills/document-docx/ooxml/schemas/ecma/fouth-edition/opc-coreProperties.xsd +50 -0
- package/.claude/archive/skills/document-docx/ooxml/schemas/ecma/fouth-edition/opc-digSig.xsd +49 -0
- package/.claude/archive/skills/document-docx/ooxml/schemas/ecma/fouth-edition/opc-relationships.xsd +33 -0
- package/.claude/archive/skills/document-docx/ooxml/schemas/mce/mc.xsd +75 -0
- package/.claude/archive/skills/document-docx/ooxml/schemas/microsoft/wml-2010.xsd +560 -0
- package/.claude/archive/skills/document-docx/ooxml/schemas/microsoft/wml-2012.xsd +67 -0
- package/.claude/archive/skills/document-docx/ooxml/schemas/microsoft/wml-2018.xsd +14 -0
- package/.claude/archive/skills/document-docx/ooxml/schemas/microsoft/wml-cex-2018.xsd +20 -0
- package/.claude/archive/skills/document-docx/ooxml/schemas/microsoft/wml-cid-2016.xsd +13 -0
- package/.claude/archive/skills/document-docx/ooxml/schemas/microsoft/wml-sdtdatahash-2020.xsd +4 -0
- package/.claude/archive/skills/document-docx/ooxml/schemas/microsoft/wml-symex-2015.xsd +8 -0
- package/.claude/archive/skills/document-docx/ooxml/scripts/pack.py +159 -0
- package/.claude/archive/skills/document-docx/ooxml/scripts/unpack.py +29 -0
- package/.claude/archive/skills/document-docx/ooxml/scripts/validate.py +69 -0
- package/.claude/archive/skills/document-docx/ooxml/scripts/validation/__init__.py +15 -0
- package/.claude/archive/skills/document-docx/ooxml/scripts/validation/base.py +951 -0
- package/.claude/archive/skills/document-docx/ooxml/scripts/validation/docx.py +274 -0
- package/.claude/archive/skills/document-docx/ooxml/scripts/validation/pptx.py +315 -0
- package/.claude/archive/skills/document-docx/ooxml/scripts/validation/redlining.py +279 -0
- package/.claude/archive/skills/document-docx/ooxml.md +610 -0
- package/.claude/archive/skills/document-docx/scripts/__init__.py +1 -0
- package/.claude/archive/skills/document-docx/scripts/document.py +1276 -0
- package/.claude/archive/skills/document-docx/scripts/templates/comments.xml +3 -0
- package/.claude/archive/skills/document-docx/scripts/templates/commentsExtended.xml +3 -0
- package/.claude/archive/skills/document-docx/scripts/templates/commentsExtensible.xml +3 -0
- package/.claude/archive/skills/document-docx/scripts/templates/commentsIds.xml +3 -0
- package/.claude/archive/skills/document-docx/scripts/templates/people.xml +3 -0
- package/.claude/archive/skills/document-docx/scripts/utilities.py +374 -0
- package/.claude/archive/skills/document-pdf/LICENSE.txt +30 -0
- package/.claude/archive/skills/document-pdf/SKILL.md +294 -0
- package/.claude/archive/skills/document-pdf/forms.md +205 -0
- package/.claude/archive/skills/document-pdf/reference.md +612 -0
- package/.claude/archive/skills/document-pdf/scripts/check_bounding_boxes.py +70 -0
- package/.claude/archive/skills/document-pdf/scripts/check_bounding_boxes_test.py +226 -0
- package/.claude/archive/skills/document-pdf/scripts/check_fillable_fields.py +12 -0
- package/.claude/archive/skills/document-pdf/scripts/convert_pdf_to_images.py +35 -0
- package/.claude/archive/skills/document-pdf/scripts/create_validation_image.py +41 -0
- package/.claude/archive/skills/document-pdf/scripts/extract_form_field_info.py +152 -0
- package/.claude/archive/skills/document-pdf/scripts/fill_fillable_fields.py +114 -0
- package/.claude/archive/skills/document-pdf/scripts/fill_pdf_form_with_annotations.py +108 -0
- package/.claude/archive/skills/document-pptx/LICENSE.txt +30 -0
- package/.claude/archive/skills/document-pptx/SKILL.md +484 -0
- package/.claude/archive/skills/document-pptx/html2pptx.md +625 -0
- package/.claude/archive/skills/document-pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +1499 -0
- package/.claude/archive/skills/document-pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +146 -0
- package/.claude/archive/skills/document-pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +1085 -0
- package/.claude/archive/skills/document-pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +11 -0
- package/.claude/archive/skills/document-pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-main.xsd +3081 -0
- package/.claude/archive/skills/document-pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +23 -0
- package/.claude/archive/skills/document-pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +185 -0
- package/.claude/archive/skills/document-pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +287 -0
- package/.claude/archive/skills/document-pptx/ooxml/schemas/ISO-IEC29500-4_2016/pml.xsd +1676 -0
- package/.claude/archive/skills/document-pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +28 -0
- package/.claude/archive/skills/document-pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +144 -0
- package/.claude/archive/skills/document-pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +174 -0
- package/.claude/archive/skills/document-pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +25 -0
- package/.claude/archive/skills/document-pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +18 -0
- package/.claude/archive/skills/document-pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +59 -0
- package/.claude/archive/skills/document-pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +56 -0
- package/.claude/archive/skills/document-pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +195 -0
- package/.claude/archive/skills/document-pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-math.xsd +582 -0
- package/.claude/archive/skills/document-pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +25 -0
- package/.claude/archive/skills/document-pptx/ooxml/schemas/ISO-IEC29500-4_2016/sml.xsd +4439 -0
- package/.claude/archive/skills/document-pptx/ooxml/schemas/ISO-IEC29500-4_2016/vml-main.xsd +570 -0
- package/.claude/archive/skills/document-pptx/ooxml/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +509 -0
- package/.claude/archive/skills/document-pptx/ooxml/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +12 -0
- package/.claude/archive/skills/document-pptx/ooxml/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +108 -0
- package/.claude/archive/skills/document-pptx/ooxml/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +96 -0
- package/.claude/archive/skills/document-pptx/ooxml/schemas/ISO-IEC29500-4_2016/wml.xsd +3646 -0
- package/.claude/archive/skills/document-pptx/ooxml/schemas/ISO-IEC29500-4_2016/xml.xsd +116 -0
- package/.claude/archive/skills/document-pptx/ooxml/schemas/ecma/fouth-edition/opc-contentTypes.xsd +42 -0
- package/.claude/archive/skills/document-pptx/ooxml/schemas/ecma/fouth-edition/opc-coreProperties.xsd +50 -0
- package/.claude/archive/skills/document-pptx/ooxml/schemas/ecma/fouth-edition/opc-digSig.xsd +49 -0
- package/.claude/archive/skills/document-pptx/ooxml/schemas/ecma/fouth-edition/opc-relationships.xsd +33 -0
- package/.claude/archive/skills/document-pptx/ooxml/schemas/mce/mc.xsd +75 -0
- package/.claude/archive/skills/document-pptx/ooxml/schemas/microsoft/wml-2010.xsd +560 -0
- package/.claude/archive/skills/document-pptx/ooxml/schemas/microsoft/wml-2012.xsd +67 -0
- package/.claude/archive/skills/document-pptx/ooxml/schemas/microsoft/wml-2018.xsd +14 -0
- package/.claude/archive/skills/document-pptx/ooxml/schemas/microsoft/wml-cex-2018.xsd +20 -0
- package/.claude/archive/skills/document-pptx/ooxml/schemas/microsoft/wml-cid-2016.xsd +13 -0
- package/.claude/archive/skills/document-pptx/ooxml/schemas/microsoft/wml-sdtdatahash-2020.xsd +4 -0
- package/.claude/archive/skills/document-pptx/ooxml/schemas/microsoft/wml-symex-2015.xsd +8 -0
- package/.claude/archive/skills/document-pptx/ooxml/scripts/pack.py +159 -0
- package/.claude/archive/skills/document-pptx/ooxml/scripts/unpack.py +29 -0
- package/.claude/archive/skills/document-pptx/ooxml/scripts/validate.py +69 -0
- package/.claude/archive/skills/document-pptx/ooxml/scripts/validation/__init__.py +15 -0
- package/.claude/archive/skills/document-pptx/ooxml/scripts/validation/base.py +951 -0
- package/.claude/archive/skills/document-pptx/ooxml/scripts/validation/docx.py +274 -0
- package/.claude/archive/skills/document-pptx/ooxml/scripts/validation/pptx.py +315 -0
- package/.claude/archive/skills/document-pptx/ooxml/scripts/validation/redlining.py +279 -0
- package/.claude/archive/skills/document-pptx/ooxml.md +427 -0
- package/.claude/archive/skills/document-pptx/scripts/html2pptx.js +979 -0
- package/.claude/archive/skills/document-pptx/scripts/inventory.py +1020 -0
- package/.claude/archive/skills/document-pptx/scripts/rearrange.py +231 -0
- package/.claude/archive/skills/document-pptx/scripts/replace.py +385 -0
- package/.claude/archive/skills/document-pptx/scripts/thumbnail.py +450 -0
- package/.claude/archive/skills/document-xlsx/LICENSE.txt +30 -0
- package/.claude/archive/skills/document-xlsx/SKILL.md +289 -0
- package/.claude/archive/skills/document-xlsx/recalc.py +178 -0
- package/.claude/archive/skills/image-enhancer/SKILL.md +99 -0
- package/.claude/archive/skills/meeting-insights-analyzer/SKILL.md +327 -0
- package/.claude/archive/skills/slack-gif-creator/LICENSE.txt +202 -0
- package/.claude/archive/skills/slack-gif-creator/SKILL.md +646 -0
- package/.claude/archive/skills/slack-gif-creator/core/color_palettes.py +302 -0
- package/.claude/archive/skills/slack-gif-creator/core/easing.py +230 -0
- package/.claude/archive/skills/slack-gif-creator/core/frame_composer.py +469 -0
- package/.claude/archive/skills/slack-gif-creator/core/gif_builder.py +246 -0
- package/.claude/archive/skills/slack-gif-creator/core/typography.py +357 -0
- package/.claude/archive/skills/slack-gif-creator/core/validators.py +264 -0
- package/.claude/archive/skills/slack-gif-creator/core/visual_effects.py +494 -0
- package/.claude/archive/skills/slack-gif-creator/requirements.txt +4 -0
- package/.claude/archive/skills/slack-gif-creator/templates/bounce.py +106 -0
- package/.claude/archive/skills/slack-gif-creator/templates/explode.py +331 -0
- package/.claude/archive/skills/slack-gif-creator/templates/fade.py +329 -0
- package/.claude/archive/skills/slack-gif-creator/templates/flip.py +291 -0
- package/.claude/archive/skills/slack-gif-creator/templates/kaleidoscope.py +211 -0
- package/.claude/archive/skills/slack-gif-creator/templates/morph.py +329 -0
- package/.claude/archive/skills/slack-gif-creator/templates/move.py +293 -0
- package/.claude/archive/skills/slack-gif-creator/templates/pulse.py +268 -0
- package/.claude/archive/skills/slack-gif-creator/templates/shake.py +127 -0
- package/.claude/archive/skills/slack-gif-creator/templates/slide.py +291 -0
- package/.claude/archive/skills/slack-gif-creator/templates/spin.py +269 -0
- package/.claude/archive/skills/slack-gif-creator/templates/wiggle.py +300 -0
- package/.claude/archive/skills/slack-gif-creator/templates/zoom.py +312 -0
- package/.claude/archive/skills/twitter-algorithm-optimizer/SKILL.md +327 -0
- package/.claude/archive/skills/video-downloader/SKILL.md +99 -0
- package/.claude/archive/skills/video-downloader/scripts/download_video.py +145 -0
- package/.claude/bash-whitelist-requests/2026-05-28-grep-find-rg.md +68 -0
- package/.claude/bash-whitelist-requests/2026-06-01-readonly-filters.md +76 -0
- package/.claude/bash-whitelist.txt +124 -0
- package/.claude/commands/agent-introspect.md +89 -0
- package/.claude/commands/apply-rules.md +363 -0
- package/.claude/commands/approve-design.md +219 -0
- package/.claude/commands/approve-org-money.md +267 -0
- package/.claude/commands/build.md +234 -0
- package/.claude/commands/commit.md +97 -0
- package/.claude/commands/context-fetch.md +113 -0
- package/.claude/commands/create-tool.md +496 -0
- package/.claude/commands/design-review.md +138 -0
- package/.claude/commands/design.md +807 -0
- package/.claude/commands/discharge-byproduct.md +208 -0
- package/.claude/commands/doc-review.md +165 -0
- package/.claude/commands/document-pair.md +76 -0
- package/.claude/commands/error-triage.md +435 -0
- package/.claude/commands/eval.md +70 -0
- package/.claude/commands/evolve.md +49 -0
- package/.claude/commands/finish-task.md +105 -0
- package/.claude/commands/gan-build.md +91 -0
- package/.claude/commands/gan-design.md +82 -0
- package/.claude/commands/gate-bypass.md +77 -0
- package/.claude/commands/gate-clear.md +45 -0
- package/.claude/commands/gate-status.md +46 -0
- package/.claude/commands/harness-audit.md +151 -0
- package/.claude/commands/hearing.md +138 -0
- package/.claude/commands/impact-check.md +486 -0
- package/.claude/commands/init-tasks.md +49 -0
- package/.claude/commands/instinct-export.md +47 -0
- package/.claude/commands/instinct-import.md +41 -0
- package/.claude/commands/instinct-status.md +43 -0
- package/.claude/commands/investigate.md +547 -0
- package/.claude/commands/learn.md +55 -0
- package/.claude/commands/lint-rules.md +400 -0
- package/.claude/commands/mode.md +58 -0
- package/.claude/commands/modify-feature.md +209 -0
- package/.claude/commands/module-review.md +149 -0
- package/.claude/commands/move-section.md +67 -0
- package/.claude/commands/new-draft.md +67 -0
- package/.claude/commands/new-feature.md +286 -0
- package/.claude/commands/new-task.md +156 -0
- package/.claude/commands/notification.md +107 -0
- package/.claude/commands/pm-start.md +119 -0
- package/.claude/commands/projects.md +32 -0
- package/.claude/commands/promote.md +43 -0
- package/.claude/commands/rasis-report.md +1323 -0
- package/.claude/commands/release-note.md +130 -0
- package/.claude/commands/reply-watch.md +149 -0
- package/.claude/commands/requirement.md +352 -0
- package/.claude/commands/resume-state.md +187 -0
- package/.claude/commands/reviewpr.md +118 -0
- package/.claude/commands/save-state.md +100 -0
- package/.claude/commands/sentry-pr.md +157 -0
- package/.claude/commands/start-task.md +87 -0
- package/.claude/commands/system-review.md +147 -0
- package/.claude/commands/task-bypass.md +70 -0
- package/.claude/commands/task-estimate.md +100 -0
- package/.claude/commands/template-apply.md +89 -0
- package/.claude/commands/test-design.md +116 -0
- package/.claude/commands/transfer-mismatch.md +317 -0
- package/.claude/commands/verify.md +51 -0
- package/.claude/evals/grader-loop-mode-autonomy.sh +165 -0
- package/.claude/evals/grader-system-reminder-attention.sh +99 -0
- package/.claude/evals/loop-mode-autonomy.md +121 -0
- package/.claude/evals/loop-mode-autonomy.results.template.md +133 -0
- package/.claude/evals/system-reminder-attention.md +123 -0
- package/.claude/evals/system-reminder-attention.results.template.md +93 -0
- package/.claude/evals/system-reminder-attention.runner.md +353 -0
- package/.claude/harness-config.local.yml +48 -0
- package/.claude/harness-config.yml +534 -0
- package/.claude/hooks/agent-marker-clear.sh +43 -0
- package/.claude/hooks/agent-marker-set.sh +40 -0
- package/.claude/hooks/agent-router-suggest.sh +123 -0
- package/.claude/hooks/autonomous-action-guard.sh +242 -0
- package/.claude/hooks/byproduct-discharge-guard.sh +128 -0
- package/.claude/hooks/check-md-mermaid.sh +144 -0
- package/.claude/hooks/check-required-env.sh +95 -0
- package/.claude/hooks/check-serena-mcp.sh +123 -0
- package/.claude/hooks/confidence-gate.sh +139 -0
- package/.claude/hooks/context-budget.sh +233 -0
- package/.claude/hooks/delegation-guard.sh +99 -0
- package/.claude/hooks/dispatcher-manifest.tsv +38 -0
- package/.claude/hooks/draft-flow-guard.sh +304 -0
- package/.claude/hooks/failure-loop-detect.sh +139 -0
- package/.claude/hooks/gateguard.sh +209 -0
- package/.claude/hooks/improvement-proposal.sh +112 -0
- package/.claude/hooks/init-tasks-on-start.sh +34 -0
- package/.claude/hooks/lib/bypass-logger.sh +82 -0
- package/.claude/hooks/lib/confidence-gate/bypass.sh +48 -0
- package/.claude/hooks/lib/confidence-gate/extract.sh +99 -0
- package/.claude/hooks/lib/confidence-gate/major-agent-filter.sh +59 -0
- package/.claude/hooks/lib/confidence-gate/messages.sh +53 -0
- package/.claude/hooks/lib/config-loader.sh +784 -0
- package/.claude/hooks/lib/delegation-guard/bash-whitelist.sh +323 -0
- package/.claude/hooks/lib/delegation-guard/git-deny.sh +188 -0
- package/.claude/hooks/lib/delegation-guard/protected-paths.sh +105 -0
- package/.claude/hooks/lib/delegation-guard/subagent-detect.sh +40 -0
- package/.claude/hooks/lib/dispatcher-core.sh +454 -0
- package/.claude/hooks/lib/improvement-proposal/aggregate.py +466 -0
- package/.claude/hooks/lib/improvement-proposal/cache.sh +78 -0
- package/.claude/hooks/lib/mode-loader.sh +80 -0
- package/.claude/hooks/lib/next-actions-parser.sh +153 -0
- package/.claude/hooks/lib/project-root.sh +60 -0
- package/.claude/hooks/list-md-plan-first-reminder.sh +143 -0
- package/.claude/hooks/loop-auto-progress-reminder.sh +108 -0
- package/.claude/hooks/loop-confirmation-detector.sh +241 -0
- package/.claude/hooks/mode-asana-prompt.sh +61 -0
- package/.claude/hooks/mode-enforce.sh +57 -0
- package/.claude/hooks/mode-session-start.sh +93 -0
- package/.claude/hooks/next-actions-surface.sh +136 -0
- package/.claude/hooks/notification-dispatcher.sh +9 -0
- package/.claude/hooks/notify.sh +27 -0
- package/.claude/hooks/parallel-subagent-reminder.sh +469 -0
- package/.claude/hooks/post-tool-use-dispatcher.sh +9 -0
- package/.claude/hooks/pre-tool-use-dispatcher.sh +9 -0
- package/.claude/hooks/reviewer-count-guard.sh +313 -0
- package/.claude/hooks/session-help-surface.sh +192 -0
- package/.claude/hooks/session-start-dispatcher.sh +9 -0
- package/.claude/hooks/session-start-wrapper.sh +156 -0
- package/.claude/hooks/stale-harness-detect.sh +422 -0
- package/.claude/hooks/stop-dispatcher.sh +9 -0
- package/.claude/hooks/stop.sh +25 -0
- package/.claude/hooks/subagent-stop-dispatcher.sh +9 -0
- package/.claude/hooks/task-rule-guard.sh +317 -0
- package/.claude/hooks/tests/run-tests.sh +23 -0
- package/.claude/hooks/tests/test-agent-marker-warn.sh +86 -0
- package/.claude/hooks/tests/test-check-required-env.sh +138 -0
- package/.claude/hooks/tests/test-confidence-gate.sh +170 -0
- package/.claude/hooks/tests/test-config-env-override.sh +220 -0
- package/.claude/hooks/tests/test-gate-disable.sh +118 -0
- package/.claude/hooks/tests/test-improvement-proposal.sh +284 -0
- package/.claude/hooks/tool-call-slip-detector.sh +188 -0
- package/.claude/hooks/user-prompt-submit-dispatcher.sh +9 -0
- package/.claude/hooks/why-x5-reminder.sh +45 -0
- package/.claude/hooks/why-x5-violation-detect.sh +152 -0
- package/.claude/hooks/workflow-guard.sh +263 -0
- package/.claude/mode.yml +28 -0
- package/.claude/project-rules/development-process.md +8 -0
- package/.claude/project-rules/git-workflow.md +8 -0
- package/.claude/project-rules/modes.md +8 -0
- package/.claude/project-rules/self-improvement.md +8 -0
- package/.claude/project-rules/task-management.md +8 -0
- package/.claude/project-rules/why-x5-output.md +8 -0
- package/.claude/project-rules/workflow.md +8 -0
- package/.claude/rules/development-process.md +293 -0
- package/.claude/rules/git-workflow.md +71 -0
- package/.claude/rules/modes.md +189 -0
- package/.claude/rules/self-improvement.md +76 -0
- package/.claude/rules/task-management.md +261 -0
- package/.claude/rules/why-x5-output.md +97 -0
- package/.claude/rules/workflow.md +157 -0
- package/.claude/rules-details/README.md +67 -0
- package/.claude/rules-details/development-process/confidence-gate.md +22 -0
- package/.claude/rules-details/development-process/cross-repo-write.md +35 -0
- package/.claude/rules-details/development-process/delegation-requirements.md +158 -0
- package/.claude/rules-details/development-process/harness-sync.md +21 -0
- package/.claude/rules-details/development-process/origin.md +13 -0
- package/.claude/rules-details/development-process/parallelization-origin.md +22 -0
- package/.claude/rules-details/development-process/research-reuse.md +22 -0
- package/.claude/rules-details/development-process/staging-strategy.md +47 -0
- package/.claude/rules-details/modes/artifacts.md +34 -0
- package/.claude/rules-details/modes/compliance-items.md +120 -0
- package/.claude/rules-details/modes/five-layer-enforcement.md +46 -0
- package/.claude/rules-details/modes/mode-hooks.md +51 -0
- package/.claude/rules-details/modes/origin.md +17 -0
- package/.claude/rules-details/self-improvement/l4-mechanics.md +36 -0
- package/.claude/rules-details/self-improvement/origin.md +8 -0
- package/.claude/rules-details/self-improvement/related-skills.md +35 -0
- package/.claude/rules-details/self-improvement/when-to-use-layers.md +39 -0
- package/.claude/rules-details/task-management/hook-enforcement.md +25 -0
- package/.claude/rules-details/task-management/mandatory-reading.md +20 -0
- package/.claude/rules-details/task-management/origin.md +12 -0
- package/.claude/rules-details/task-management/parking-lot.md +26 -0
- package/.claude/rules-details/task-management/plan-first.md +44 -0
- package/.claude/rules-details/task-management/six-articles.md +68 -0
- package/.claude/rules-details/task-management/task-migration.md +16 -0
- package/.claude/rules-details/task-management/ui-detection.md +11 -0
- package/.claude/rules-details/why-x5-output/examples.md +41 -0
- package/.claude/rules-details/why-x5-output/feedback-memory.md +14 -0
- package/.claude/rules-details/why-x5-output/origin.md +10 -0
- package/.claude/rules-details/why-x5-output/v1-v10-history.md +19 -0
- package/.claude/rules-details/workflow/10-stage.md +43 -0
- package/.claude/rules-details/workflow/14-stage.md +52 -0
- package/.claude/rules-details/workflow/byproduct-discharge.md +39 -0
- package/.claude/rules-details/workflow/draft-flow-guard.md +31 -0
- package/.claude/rules-details/workflow/fan-out.md +70 -0
- package/.claude/rules-details/workflow/mece-20.md +36 -0
- package/.claude/rules-details/workflow/origin.md +14 -0
- package/.claude/rules-details/workflow/refactoring.md +48 -0
- package/.claude/rules-details/workflow/related-skills.md +22 -0
- package/.claude/rules-details/workflow/reviewer-prompt.md +100 -0
- package/.claude/rules-details/workflow/session-persistence.md +46 -0
- package/.claude/rules-details/workflow/workflow-guard.md +36 -0
- package/.claude/scripts/__pycache__/harness-audit.cpython-313.pyc +0 -0
- package/.claude/scripts/agent-stocktake.py +421 -0
- package/.claude/scripts/check-md-mermaid.mjs +138 -0
- package/.claude/scripts/generate-settings.sh +0 -0
- package/.claude/scripts/harness-audit.py +1547 -0
- package/.claude/scripts/hc-config.sh +2265 -0
- package/.claude/scripts/init-tasks.sh +117 -0
- package/.claude/scripts/lib/enforcement-matrix-parse.sh +81 -0
- package/.claude/scripts/lib/hc-config-metadata.sh +190 -0
- package/.claude/scripts/lib/hc-config-web-server.js +1528 -0
- package/.claude/scripts/lib/hc-config-web-ui/app.js +1054 -0
- package/.claude/scripts/lib/hc-config-web-ui/index.html +130 -0
- package/.claude/scripts/lib/hc-config-web-ui/style.css +522 -0
- package/.claude/scripts/new-task-helper.sh +432 -0
- package/.claude/scripts/observe-repair.sh +437 -0
- package/.claude/scripts/observe-rotate.sh +311 -0
- package/.claude/scripts/statusline.sh +239 -0
- package/.claude/settings.generated.preview.json +211 -0
- package/.claude/settings.json +215 -0
- package/.claude/settings.local.example.json +20 -0
- package/.claude/settings.local.json +36 -0
- package/.claude/skills/agent-introspection-debugging/SKILL.md +123 -0
- package/.claude/skills/agent-router/README.md +137 -0
- package/.claude/skills/agent-router/SKILL.md +74 -0
- package/.claude/skills/agent-router/dispatch-table.yml +352 -0
- package/.claude/skills/agent-router/router.py +1086 -0
- package/.claude/skills/agent-router/samples/representative_prompts.txt +24 -0
- package/.claude/skills/agent-router/tests/__init__.py +0 -0
- package/.claude/skills/agent-router/tests/test_router.py +762 -0
- package/.claude/skills/artifacts-builder/LICENSE.txt +202 -0
- package/.claude/skills/artifacts-builder/SKILL.md +74 -0
- package/.claude/skills/artifacts-builder/scripts/bundle-artifact.sh +54 -0
- package/.claude/skills/artifacts-builder/scripts/init-artifact.sh +322 -0
- package/.claude/skills/artifacts-builder/scripts/shadcn-components.tar.gz +0 -0
- package/.claude/skills/brand-guidelines/LICENSE.txt +202 -0
- package/.claude/skills/brand-guidelines/SKILL.md +73 -0
- package/.claude/skills/canvas-design/LICENSE.txt +202 -0
- package/.claude/skills/canvas-design/SKILL.md +130 -0
- package/.claude/skills/canvas-design/canvas-fonts/ArsenalSC-OFL.txt +93 -0
- package/.claude/skills/canvas-design/canvas-fonts/ArsenalSC-Regular.ttf +0 -0
- package/.claude/skills/canvas-design/canvas-fonts/BigShoulders-Bold.ttf +0 -0
- package/.claude/skills/canvas-design/canvas-fonts/BigShoulders-OFL.txt +93 -0
- package/.claude/skills/canvas-design/canvas-fonts/BigShoulders-Regular.ttf +0 -0
- package/.claude/skills/canvas-design/canvas-fonts/Boldonse-OFL.txt +93 -0
- package/.claude/skills/canvas-design/canvas-fonts/Boldonse-Regular.ttf +0 -0
- package/.claude/skills/canvas-design/canvas-fonts/BricolageGrotesque-Bold.ttf +0 -0
- package/.claude/skills/canvas-design/canvas-fonts/BricolageGrotesque-OFL.txt +93 -0
- package/.claude/skills/canvas-design/canvas-fonts/BricolageGrotesque-Regular.ttf +0 -0
- package/.claude/skills/canvas-design/canvas-fonts/CrimsonPro-Bold.ttf +0 -0
- package/.claude/skills/canvas-design/canvas-fonts/CrimsonPro-Italic.ttf +0 -0
- package/.claude/skills/canvas-design/canvas-fonts/CrimsonPro-OFL.txt +93 -0
- package/.claude/skills/canvas-design/canvas-fonts/CrimsonPro-Regular.ttf +0 -0
- package/.claude/skills/canvas-design/canvas-fonts/DMMono-OFL.txt +93 -0
- package/.claude/skills/canvas-design/canvas-fonts/DMMono-Regular.ttf +0 -0
- package/.claude/skills/canvas-design/canvas-fonts/EricaOne-OFL.txt +94 -0
- package/.claude/skills/canvas-design/canvas-fonts/EricaOne-Regular.ttf +0 -0
- package/.claude/skills/canvas-design/canvas-fonts/GeistMono-Bold.ttf +0 -0
- package/.claude/skills/canvas-design/canvas-fonts/GeistMono-OFL.txt +93 -0
- package/.claude/skills/canvas-design/canvas-fonts/GeistMono-Regular.ttf +0 -0
- package/.claude/skills/canvas-design/canvas-fonts/Gloock-OFL.txt +93 -0
- package/.claude/skills/canvas-design/canvas-fonts/Gloock-Regular.ttf +0 -0
- package/.claude/skills/canvas-design/canvas-fonts/IBMPlexMono-Bold.ttf +0 -0
- package/.claude/skills/canvas-design/canvas-fonts/IBMPlexMono-OFL.txt +93 -0
- package/.claude/skills/canvas-design/canvas-fonts/IBMPlexMono-Regular.ttf +0 -0
- package/.claude/skills/canvas-design/canvas-fonts/IBMPlexSerif-Bold.ttf +0 -0
- package/.claude/skills/canvas-design/canvas-fonts/IBMPlexSerif-BoldItalic.ttf +0 -0
- package/.claude/skills/canvas-design/canvas-fonts/IBMPlexSerif-Italic.ttf +0 -0
- package/.claude/skills/canvas-design/canvas-fonts/IBMPlexSerif-Regular.ttf +0 -0
- package/.claude/skills/canvas-design/canvas-fonts/InstrumentSans-Bold.ttf +0 -0
- package/.claude/skills/canvas-design/canvas-fonts/InstrumentSans-BoldItalic.ttf +0 -0
- package/.claude/skills/canvas-design/canvas-fonts/InstrumentSans-Italic.ttf +0 -0
- package/.claude/skills/canvas-design/canvas-fonts/InstrumentSans-OFL.txt +93 -0
- package/.claude/skills/canvas-design/canvas-fonts/InstrumentSans-Regular.ttf +0 -0
- package/.claude/skills/canvas-design/canvas-fonts/InstrumentSerif-Italic.ttf +0 -0
- package/.claude/skills/canvas-design/canvas-fonts/InstrumentSerif-Regular.ttf +0 -0
- package/.claude/skills/canvas-design/canvas-fonts/Italiana-OFL.txt +93 -0
- package/.claude/skills/canvas-design/canvas-fonts/Italiana-Regular.ttf +0 -0
- package/.claude/skills/canvas-design/canvas-fonts/JetBrainsMono-Bold.ttf +0 -0
- package/.claude/skills/canvas-design/canvas-fonts/JetBrainsMono-OFL.txt +93 -0
- package/.claude/skills/canvas-design/canvas-fonts/JetBrainsMono-Regular.ttf +0 -0
- package/.claude/skills/canvas-design/canvas-fonts/Jura-Light.ttf +0 -0
- package/.claude/skills/canvas-design/canvas-fonts/Jura-Medium.ttf +0 -0
- package/.claude/skills/canvas-design/canvas-fonts/Jura-OFL.txt +93 -0
- package/.claude/skills/canvas-design/canvas-fonts/LibreBaskerville-OFL.txt +93 -0
- package/.claude/skills/canvas-design/canvas-fonts/LibreBaskerville-Regular.ttf +0 -0
- package/.claude/skills/canvas-design/canvas-fonts/Lora-Bold.ttf +0 -0
- package/.claude/skills/canvas-design/canvas-fonts/Lora-BoldItalic.ttf +0 -0
- package/.claude/skills/canvas-design/canvas-fonts/Lora-Italic.ttf +0 -0
- package/.claude/skills/canvas-design/canvas-fonts/Lora-OFL.txt +93 -0
- package/.claude/skills/canvas-design/canvas-fonts/Lora-Regular.ttf +0 -0
- package/.claude/skills/canvas-design/canvas-fonts/NationalPark-Bold.ttf +0 -0
- package/.claude/skills/canvas-design/canvas-fonts/NationalPark-OFL.txt +93 -0
- package/.claude/skills/canvas-design/canvas-fonts/NationalPark-Regular.ttf +0 -0
- package/.claude/skills/canvas-design/canvas-fonts/NothingYouCouldDo-OFL.txt +93 -0
- package/.claude/skills/canvas-design/canvas-fonts/NothingYouCouldDo-Regular.ttf +0 -0
- package/.claude/skills/canvas-design/canvas-fonts/Outfit-Bold.ttf +0 -0
- package/.claude/skills/canvas-design/canvas-fonts/Outfit-OFL.txt +93 -0
- package/.claude/skills/canvas-design/canvas-fonts/Outfit-Regular.ttf +0 -0
- package/.claude/skills/canvas-design/canvas-fonts/PixelifySans-Medium.ttf +0 -0
- package/.claude/skills/canvas-design/canvas-fonts/PixelifySans-OFL.txt +93 -0
- package/.claude/skills/canvas-design/canvas-fonts/PoiretOne-OFL.txt +93 -0
- package/.claude/skills/canvas-design/canvas-fonts/PoiretOne-Regular.ttf +0 -0
- package/.claude/skills/canvas-design/canvas-fonts/RedHatMono-Bold.ttf +0 -0
- package/.claude/skills/canvas-design/canvas-fonts/RedHatMono-OFL.txt +93 -0
- package/.claude/skills/canvas-design/canvas-fonts/RedHatMono-Regular.ttf +0 -0
- package/.claude/skills/canvas-design/canvas-fonts/Silkscreen-OFL.txt +93 -0
- package/.claude/skills/canvas-design/canvas-fonts/Silkscreen-Regular.ttf +0 -0
- package/.claude/skills/canvas-design/canvas-fonts/SmoochSans-Medium.ttf +0 -0
- package/.claude/skills/canvas-design/canvas-fonts/SmoochSans-OFL.txt +93 -0
- package/.claude/skills/canvas-design/canvas-fonts/Tektur-Medium.ttf +0 -0
- package/.claude/skills/canvas-design/canvas-fonts/Tektur-OFL.txt +93 -0
- package/.claude/skills/canvas-design/canvas-fonts/Tektur-Regular.ttf +0 -0
- package/.claude/skills/canvas-design/canvas-fonts/WorkSans-Bold.ttf +0 -0
- package/.claude/skills/canvas-design/canvas-fonts/WorkSans-BoldItalic.ttf +0 -0
- package/.claude/skills/canvas-design/canvas-fonts/WorkSans-Italic.ttf +0 -0
- package/.claude/skills/canvas-design/canvas-fonts/WorkSans-OFL.txt +93 -0
- package/.claude/skills/canvas-design/canvas-fonts/WorkSans-Regular.ttf +0 -0
- package/.claude/skills/canvas-design/canvas-fonts/YoungSerif-OFL.txt +93 -0
- package/.claude/skills/canvas-design/canvas-fonts/YoungSerif-Regular.ttf +0 -0
- package/.claude/skills/changelog-generator/SKILL.md +104 -0
- package/.claude/skills/check-md-mermaid/SKILL.md +62 -0
- package/.claude/skills/connect/SKILL.md +156 -0
- package/.claude/skills/connect-apps/SKILL.md +80 -0
- package/.claude/skills/content-research-writer/SKILL.md +538 -0
- package/.claude/skills/continuous-agent-loop/SKILL.md +187 -0
- package/.claude/skills/continuous-learning-v2/SKILL.md +238 -0
- package/.claude/skills/continuous-learning-v2/config.json +35 -0
- package/.claude/skills/continuous-learning-v2/hooks/observe.sh +333 -0
- package/.claude/skills/continuous-learning-v2/instinct-cli.py +406 -0
- package/.claude/skills/domain-name-brainstormer/SKILL.md +212 -0
- package/.claude/skills/eval-harness/SKILL.md +100 -0
- package/.claude/skills/eval-harness/swe-bench/README.md +80 -0
- package/.claude/skills/eval-harness/swe-bench/config.yml +29 -0
- package/.claude/skills/eval-harness/swe-bench/docker/Dockerfile +25 -0
- package/.claude/skills/eval-harness/swe-bench/docker/docker-compose.yml +18 -0
- package/.claude/skills/eval-harness/swe-bench/results/dry-run-2026-05-04.json +137 -0
- package/.claude/skills/eval-harness/swe-bench/results/dry-run-comparison-2026-05-04.md +112 -0
- package/.claude/skills/eval-harness/swe-bench/results/dry-run-improved-2026-05-04.json +165 -0
- package/.claude/skills/eval-harness/swe-bench/results/raw/astropy__astropy-12907.patch +12 -0
- package/.claude/skills/eval-harness/swe-bench/results/raw/astropy__astropy-12907.txt +322 -0
- package/.claude/skills/eval-harness/swe-bench/results/raw/astropy__astropy-12907.whole-file.txt +322 -0
- package/.claude/skills/eval-harness/swe-bench/runner.py +845 -0
- package/.claude/skills/eval-harness/swe-bench/scoring.py +298 -0
- package/.claude/skills/eval-harness/swe-bench/tasks/fetch_tasks.py +81 -0
- package/.claude/skills/eval-harness/swe-bench/tasks/lite-50.json +702 -0
- package/.claude/skills/file-organizer/SKILL.md +433 -0
- package/.claude/skills/gan-style-harness/SKILL.md +111 -0
- package/.claude/skills/gateguard/.gateguard.yml +47 -0
- package/.claude/skills/gateguard/SKILL.md +99 -0
- package/.claude/skills/internal-comms/LICENSE.txt +202 -0
- package/.claude/skills/internal-comms/SKILL.md +32 -0
- package/.claude/skills/internal-comms/examples/3p-updates.md +47 -0
- package/.claude/skills/internal-comms/examples/company-newsletter.md +65 -0
- package/.claude/skills/internal-comms/examples/faq-answers.md +30 -0
- package/.claude/skills/internal-comms/examples/general-comms.md +16 -0
- package/.claude/skills/invoice-organizer/SKILL.md +446 -0
- package/.claude/skills/karpathy-guidelines/SKILL.md +67 -0
- package/.claude/skills/langsmith-fetch/SKILL.md +485 -0
- package/.claude/skills/lead-research-assistant/SKILL.md +199 -0
- package/.claude/skills/mcp-builder/LICENSE.txt +202 -0
- package/.claude/skills/mcp-builder/SKILL.md +328 -0
- package/.claude/skills/mcp-builder/reference/evaluation.md +602 -0
- package/.claude/skills/mcp-builder/reference/mcp_best_practices.md +915 -0
- package/.claude/skills/mcp-builder/reference/node_mcp_server.md +916 -0
- package/.claude/skills/mcp-builder/reference/python_mcp_server.md +752 -0
- package/.claude/skills/mcp-builder/scripts/connections.py +151 -0
- package/.claude/skills/mcp-builder/scripts/evaluation.py +373 -0
- package/.claude/skills/mcp-builder/scripts/example_evaluation.xml +22 -0
- package/.claude/skills/mcp-builder/scripts/requirements.txt +2 -0
- package/.claude/skills/raffle-winner-picker/SKILL.md +159 -0
- package/.claude/skills/repo-map/README.md +125 -0
- package/.claude/skills/repo-map/SKILL.md +128 -0
- package/.claude/skills/repo-map/examples/sample-output.md +1194 -0
- package/.claude/skills/repo-map/repo-map.py +715 -0
- package/.claude/skills/salesforce-e2e-testing/SKILL.md +116 -0
- package/.claude/skills/salesforce-e2e-testing/catalog-template.md +161 -0
- package/.claude/skills/salesforce-e2e-testing/methodology.md +179 -0
- package/.claude/skills/salesforce-e2e-testing/observation-rules.md +280 -0
- package/.claude/skills/salesforce-e2e-testing/pattern-taxonomy.md +392 -0
- package/.claude/skills/salesforce-e2e-testing/procedure-template.md +376 -0
- package/.claude/skills/skill-creator/LICENSE.txt +202 -0
- package/.claude/skills/skill-creator/SKILL.md +209 -0
- package/.claude/skills/skill-creator/scripts/init_skill.py +303 -0
- package/.claude/skills/skill-creator/scripts/package_skill.py +110 -0
- package/.claude/skills/skill-creator/scripts/quick_validate.py +65 -0
- package/.claude/skills/skill-share/SKILL.md +80 -0
- package/.claude/skills/tailored-resume-generator/SKILL.md +345 -0
- package/.claude/skills/template-skill/SKILL.md +6 -0
- package/.claude/skills/theme-factory/LICENSE.txt +202 -0
- package/.claude/skills/theme-factory/SKILL.md +59 -0
- package/.claude/skills/theme-factory/theme-showcase.pdf +0 -0
- package/.claude/skills/theme-factory/themes/arctic-frost.md +19 -0
- package/.claude/skills/theme-factory/themes/botanical-garden.md +19 -0
- package/.claude/skills/theme-factory/themes/desert-rose.md +19 -0
- package/.claude/skills/theme-factory/themes/forest-canopy.md +19 -0
- package/.claude/skills/theme-factory/themes/golden-hour.md +19 -0
- package/.claude/skills/theme-factory/themes/midnight-galaxy.md +19 -0
- package/.claude/skills/theme-factory/themes/modern-minimalist.md +19 -0
- package/.claude/skills/theme-factory/themes/ocean-depths.md +19 -0
- package/.claude/skills/theme-factory/themes/sunset-boulevard.md +19 -0
- package/.claude/skills/theme-factory/themes/tech-innovation.md +19 -0
- package/.claude/skills/verification-loop/SKILL.md +129 -0
- package/.claude/skills/webapp-testing/LICENSE.txt +202 -0
- package/.claude/skills/webapp-testing/SKILL.md +96 -0
- package/.claude/skills/webapp-testing/examples/console_logging.py +35 -0
- package/.claude/skills/webapp-testing/examples/element_discovery.py +40 -0
- package/.claude/skills/webapp-testing/examples/static_html_automation.py +33 -0
- package/.claude/skills/webapp-testing/scripts/with_server.py +106 -0
- package/.claude/templates/docs/draft/_DRAFT_TEMPLATE.md +162 -0
- package/.claude/templates/docs/draft/_TEST_DESIGN_TEMPLATE.md +76 -0
- package/.claude/templates/docs/tasks/_TASK_TEMPLATE.md +276 -0
- package/.claude/templates/docs/tasks/list.md +80 -0
- package/.claude/templates/docs/tasks/parking-lot.md +82 -0
- package/.claude/templates/settings.user-level.json.template +306 -0
- package/.claude/tests/SMOKE-CLASSIFICATION.md +199 -0
- package/.claude/tests/action-space-count-smoke.sh +130 -0
- package/.claude/tests/agent-router-suggest-wiring-smoke.sh +188 -0
- package/.claude/tests/audit-followups-smoke.sh +158 -0
- package/.claude/tests/autonomous-action-guard-relaxation-smoke.sh +479 -0
- package/.claude/tests/autonomous-action-guard-smoke.sh +187 -0
- package/.claude/tests/check-serena-mcp-smoke.sh +156 -0
- package/.claude/tests/common-rules-import-smoke.sh +209 -0
- package/.claude/tests/confidence-gate-smoke.sh +220 -0
- package/.claude/tests/config-feature-toggles-smoke.sh +389 -0
- package/.claude/tests/context-budget-smoke.sh +222 -0
- package/.claude/tests/custom-pm-commands-smoke.sh +93 -0
- package/.claude/tests/delegation-guard-code-smoke.sh +244 -0
- package/.claude/tests/delegation-guard-deny-layers-smoke.sh +356 -0
- package/.claude/tests/delegation-guard-readonly-filter-smoke.sh +205 -0
- package/.claude/tests/delegation-guard-search-whitelist-smoke.sh +152 -0
- package/.claude/tests/delegation-guard-segment-smoke.sh +109 -0
- package/.claude/tests/dispatcher-blocker-invariance-smoke.sh +700 -0
- package/.claude/tests/dispatcher-core-smoke.sh +452 -0
- package/.claude/tests/dispatcher-merge-matrix-smoke.sh +825 -0
- package/.claude/tests/dispatcher-success-stdout-smoke.sh +290 -0
- package/.claude/tests/draft-flow-guard-approved-dir-smoke.sh +234 -0
- package/.claude/tests/draft-flow-guard-smoke.sh +194 -0
- package/.claude/tests/dual-mode-portability-smoke.sh +131 -0
- package/.claude/tests/effective-hook-matrix-smoke.sh +261 -0
- package/.claude/tests/enforcement-mismatch-smoke.sh +263 -0
- package/.claude/tests/fixtures/cascade-sample.jsonl +9 -0
- package/.claude/tests/fixtures/next-actions/case-clean.md +14 -0
- package/.claude/tests/fixtures/next-actions/case-with-red.md +16 -0
- package/.claude/tests/fixtures/next-actions/case-with-yellow-only.md +14 -0
- package/.claude/tests/fixtures/normal-broken-scatter.jsonl +5 -0
- package/.claude/tests/fixtures/task-71/blocker-baseline.tsv +24 -0
- package/.claude/tests/fixtures/task-71/settings-inventory.tsv +37 -0
- package/.claude/tests/fixtures/transcript-50pct.jsonl +2 -0
- package/.claude/tests/fixtures/transcript-60pct.jsonl +2 -0
- package/.claude/tests/fixtures/transcript-80pct.jsonl +2 -0
- package/.claude/tests/fixtures/transcript-95pct.jsonl +2 -0
- package/.claude/tests/fixtures/workflow-guard/case-2-mid.json +21 -0
- package/.claude/tests/fixtures/workflow-guard/case-3-blocked.json +33 -0
- package/.claude/tests/fixtures/workflow-guard/case-4-clean.json +27 -0
- package/.claude/tests/fixtures/workflow-guard/case-8-modify.json +23 -0
- package/.claude/tests/fixtures/workflow-guard/inputs/case-1.json +1 -0
- package/.claude/tests/fixtures/workflow-guard/inputs/case-2.json +1 -0
- package/.claude/tests/fixtures/workflow-guard/inputs/case-3.json +1 -0
- package/.claude/tests/fixtures/workflow-guard/inputs/case-4.json +1 -0
- package/.claude/tests/fixtures/workflow-guard/inputs/case-5.json +1 -0
- package/.claude/tests/fixtures/workflow-guard/inputs/case-6.json +1 -0
- package/.claude/tests/fixtures/workflow-guard/inputs/case-7.json +1 -0
- package/.claude/tests/fixtures/workflow-guard/inputs/case-8.json +1 -0
- package/.claude/tests/gateguard-smoke.sh +213 -0
- package/.claude/tests/git-deny-mainline-policy-smoke.sh +222 -0
- package/.claude/tests/harness-audit-c-batch-smoke.sh +270 -0
- package/.claude/tests/harness-audit-compare-smoke.sh +186 -0
- package/.claude/tests/harness-audit-pipeline-health-smoke.sh +326 -0
- package/.claude/tests/harness-config-local-smoke.sh +232 -0
- package/.claude/tests/hc-config-git-policy-smoke.sh +241 -0
- package/.claude/tests/hc-config-key-parity-smoke.sh +149 -0
- package/.claude/tests/hc-config-migration-smoke.sh +251 -0
- package/.claude/tests/hc-config-script-smoke.sh +1106 -0
- package/.claude/tests/hc-config-tui-smoke.sh +801 -0
- package/.claude/tests/hc-config-web-ui-smoke.sh +3224 -0
- package/.claude/tests/hook-cwd-robustness-smoke.sh +206 -0
- package/.claude/tests/hook-frequency-tweaks-smoke.sh +312 -0
- package/.claude/tests/improvement-proposal-cache-smoke.sh +238 -0
- package/.claude/tests/install-sh-overwrite-all-smoke.sh +274 -0
- package/.claude/tests/install-sh-regen-settings-smoke.sh +301 -0
- package/.claude/tests/install-sh-sync-drift-smoke.sh +285 -0
- package/.claude/tests/layer-b-context-isolation-smoke.sh +392 -0
- package/.claude/tests/list-md-plan-first-reminder-smoke.sh +313 -0
- package/.claude/tests/loop-auto-progress-smoke.sh +372 -0
- package/.claude/tests/loop-confirmation-detector-smoke.sh +674 -0
- package/.claude/tests/new-task-batch-update-smoke.sh +664 -0
- package/.claude/tests/next-actions-hooks-smoke.sh +283 -0
- package/.claude/tests/npx-cli-smoke.sh +696 -0
- package/.claude/tests/observe-flock-smoke.sh +223 -0
- package/.claude/tests/observe-jq-parse-smoke.sh +250 -0
- package/.claude/tests/observe-repair-smoke.sh +475 -0
- package/.claude/tests/observe-rotate-smoke.sh +428 -0
- package/.claude/tests/observe-subagent-stop-smoke.sh +476 -0
- package/.claude/tests/parallel-subagent-reminder-smoke.sh +918 -0
- package/.claude/tests/project-root-smoke.sh +140 -0
- package/.claude/tests/project-rules-protection-smoke.sh +199 -0
- package/.claude/tests/review-required-min-count-smoke.sh +286 -0
- package/.claude/tests/reviewer-count-guard-smoke.sh +490 -0
- package/.claude/tests/rule-architecture-smoke.sh +418 -0
- package/.claude/tests/rule-change-draft-flow-guard-smoke.sh +343 -0
- package/.claude/tests/run-all-smokes.sh +340 -0
- package/.claude/tests/session-help-surface-smoke.sh +224 -0
- package/.claude/tests/session-start-parallel-smoke.sh +165 -0
- package/.claude/tests/sessionstart-budget-smoke.sh +185 -0
- package/.claude/tests/sessionstart-footprint-smoke.sh +258 -0
- package/.claude/tests/settings-dispatcher-baseline-smoke.sh +709 -0
- package/.claude/tests/settings-generation-feature-pruning-smoke.sh +196 -0
- package/.claude/tests/stale-harness-detect-smoke.sh +974 -0
- package/.claude/tests/statusline-smoke.sh +180 -0
- package/.claude/tests/task-rule-guard-smoke.sh +656 -0
- package/.claude/tests/tool-call-slip-detector-smoke.sh +101 -0
- package/.claude/tests/wave-precheck-template-smoke.sh +159 -0
- package/.claude/tests/why-x5-violation-detect-smoke.sh +157 -0
- package/.claude/tests/workflow-guard-smoke.sh +266 -0
- package/CLAUDE.md +75 -0
- package/LICENSE +21 -0
- package/README.md +790 -0
- package/bin/cli.js +395 -0
- package/docs/INVENTORY.md +163 -0
- package/install.sh +769 -0
- package/package.json +25 -0
|
@@ -0,0 +1,1547 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""harness-audit.py — Claude Code ハーネスの健全性を実測値で出力。
|
|
3
|
+
|
|
4
|
+
Read-only 集計。観察ログ・GateGuard state・TaskGuard state・failure-window から
|
|
5
|
+
完成率 / リトライ率 / ブロック頻度 / failure-loop 件数 / hook timeout 件数を抽出。
|
|
6
|
+
|
|
7
|
+
Usage:
|
|
8
|
+
python3 .claude/scripts/harness-audit.py # default: human-readable
|
|
9
|
+
python3 .claude/scripts/harness-audit.py --json # machine-readable
|
|
10
|
+
python3 .claude/scripts/harness-audit.py --window=N # 直近 N 件のみ集計(default 100)
|
|
11
|
+
python3 .claude/scripts/harness-audit.py --compare /path/to/other-repo
|
|
12
|
+
# 他リポの .claude/ と structural diff (task-25 B3)
|
|
13
|
+
|
|
14
|
+
外部依存なし(標準ライブラリのみ)。
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
from __future__ import annotations
|
|
18
|
+
|
|
19
|
+
import argparse
|
|
20
|
+
import hashlib
|
|
21
|
+
import json
|
|
22
|
+
import os
|
|
23
|
+
import re
|
|
24
|
+
import subprocess
|
|
25
|
+
import sys
|
|
26
|
+
from collections import Counter, defaultdict
|
|
27
|
+
from datetime import datetime, timedelta, timezone
|
|
28
|
+
from pathlib import Path
|
|
29
|
+
|
|
30
|
+
ROOT = Path.cwd()
|
|
31
|
+
|
|
32
|
+
# === harness-config.yml: 軽量パーサ ===
|
|
33
|
+
# bash 側 config-loader.sh と同等の subset (フラット key:value / [a,b,c] / コメント) を読む。
|
|
34
|
+
# 不在 / 該当 key 欠如時はハードコード fallback (旧来挙動と同一)。
|
|
35
|
+
DEFAULTS: dict[str, str] = {
|
|
36
|
+
"gateguard_state_dir": ".claude/.gateguard-state",
|
|
37
|
+
"taskguard_state_dir": ".claude/.taskguard-state",
|
|
38
|
+
"failure_window_dir": ".claude/.failure-window",
|
|
39
|
+
"confidence_state_dir": ".claude/.confidence-gate-state",
|
|
40
|
+
"homunculus_root": str(Path.home() / ".claude" / "homunculus"),
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
# === task-32: observation pipeline 健全性指標 ===
|
|
44
|
+
# cascade fail 検出の閾値: N 連続 JSONDecodeError で cascade_suspected: True
|
|
45
|
+
# env `HC_CASCADE_THRESHOLD` で override 可、default 5
|
|
46
|
+
_CASCADE_THRESHOLD_DEFAULT = 5
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def _cascade_threshold() -> int:
|
|
50
|
+
"""Resolve cascade fail 検出閾値 from env `HC_CASCADE_THRESHOLD` with safe fallback.
|
|
51
|
+
|
|
52
|
+
Parsing 規約 (default `_CASCADE_THRESHOLD_DEFAULT` = 5):
|
|
53
|
+
- env 未設定 → default
|
|
54
|
+
- 正整数 (`"3"`, `"10"`) → そのまま採用
|
|
55
|
+
- 非正整数 (`"0"`, `"-1"`) → default fallback (threshold は >=1 必須)
|
|
56
|
+
- 非数値 (`"abc"`) → `int()` が `ValueError` → default fallback
|
|
57
|
+
- float 文字列 (`"3.5"`) → `int("3.5")` は `ValueError` で default fallback
|
|
58
|
+
(Python の `int()` は `"3.5"` を直接 parse できない、`float()` 経由を意図的に行わない)
|
|
59
|
+
- `None` を str に変換した形 → `TypeError` 防御で fallback
|
|
60
|
+
"""
|
|
61
|
+
raw = os.environ.get("HC_CASCADE_THRESHOLD")
|
|
62
|
+
if raw is None:
|
|
63
|
+
return _CASCADE_THRESHOLD_DEFAULT
|
|
64
|
+
try:
|
|
65
|
+
v = int(raw)
|
|
66
|
+
return v if v > 0 else _CASCADE_THRESHOLD_DEFAULT
|
|
67
|
+
except (TypeError, ValueError):
|
|
68
|
+
return _CASCADE_THRESHOLD_DEFAULT
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def _expand_tilde(value: str) -> str:
|
|
72
|
+
if value == "~":
|
|
73
|
+
return str(Path.home())
|
|
74
|
+
if value.startswith("~/"):
|
|
75
|
+
return str(Path.home() / value[2:])
|
|
76
|
+
return value
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
def _load_harness_config(path: Path) -> dict[str, str]:
|
|
80
|
+
"""フラット YAML から scalar key を抽出。配列 / ネストは無視。"""
|
|
81
|
+
cfg: dict[str, str] = {}
|
|
82
|
+
if not path.exists():
|
|
83
|
+
return cfg
|
|
84
|
+
try:
|
|
85
|
+
for raw in path.read_text(encoding="utf-8").splitlines():
|
|
86
|
+
line = raw.rstrip("\r")
|
|
87
|
+
stripped = line.lstrip()
|
|
88
|
+
# コメント / 空行
|
|
89
|
+
if not stripped or stripped.startswith("#"):
|
|
90
|
+
continue
|
|
91
|
+
# ネスト行 (先頭インデントあり) は subset 対象外
|
|
92
|
+
if line != stripped:
|
|
93
|
+
continue
|
|
94
|
+
if ":" not in stripped:
|
|
95
|
+
continue
|
|
96
|
+
key, _, value = stripped.partition(":")
|
|
97
|
+
value = value.strip()
|
|
98
|
+
# 配列構文 [..] は audit が消費する key には現状不要 → スキップ
|
|
99
|
+
if value.startswith("["):
|
|
100
|
+
continue
|
|
101
|
+
# 外側 quote strip
|
|
102
|
+
if len(value) >= 2 and value[0] == value[-1] and value[0] in ("'", '"'):
|
|
103
|
+
value = value[1:-1]
|
|
104
|
+
cfg[key.strip().lower()] = _expand_tilde(value)
|
|
105
|
+
except OSError:
|
|
106
|
+
return {}
|
|
107
|
+
return cfg
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
_CFG_PATH = ROOT / ".claude" / "harness-config.yml"
|
|
111
|
+
_CFG = _load_harness_config(_CFG_PATH)
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
def _cfg(key: str) -> str:
|
|
115
|
+
return _CFG.get(key, DEFAULTS[key])
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
HOMUNCULUS = Path(_cfg("homunculus_root"))
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
def _normalize_remote_url(url: str) -> str:
|
|
122
|
+
"""observe.sh と同じ正規化: ssh→https + 末尾 .git strip。
|
|
123
|
+
|
|
124
|
+
observe.sh 内では `sed -E 's|^git@([^:]+):|https://\\1/|; s|\\.git$||'` 相当。
|
|
125
|
+
両者の hash を一致させないと harness-audit.py が observations.jsonl を
|
|
126
|
+
project-scoped で発見できず global fallback すら空になる。
|
|
127
|
+
"""
|
|
128
|
+
s = url.strip()
|
|
129
|
+
# git@host:owner/repo → https://host/owner/repo
|
|
130
|
+
m = re.match(r"^git@([^:]+):(.*)$", s)
|
|
131
|
+
if m:
|
|
132
|
+
s = f"https://{m.group(1)}/{m.group(2)}"
|
|
133
|
+
# 末尾 .git を strip
|
|
134
|
+
if s.endswith(".git"):
|
|
135
|
+
s = s[:-4]
|
|
136
|
+
return s
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
def project_hash() -> str | None:
|
|
140
|
+
"""git remote URL から project hash を導出(observe.sh と同じロジック)。"""
|
|
141
|
+
try:
|
|
142
|
+
out = subprocess.check_output(
|
|
143
|
+
["git", "remote", "get-url", "origin"],
|
|
144
|
+
stderr=subprocess.DEVNULL,
|
|
145
|
+
text=True,
|
|
146
|
+
).strip()
|
|
147
|
+
if not out:
|
|
148
|
+
return None
|
|
149
|
+
canon = _normalize_remote_url(out)
|
|
150
|
+
return hashlib.sha256(canon.encode()).hexdigest()[:12]
|
|
151
|
+
except Exception:
|
|
152
|
+
return None
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
def find_observations() -> Path | None:
|
|
156
|
+
"""observations.jsonl の場所を探す(project-scoped → global fallback)。"""
|
|
157
|
+
ph = project_hash()
|
|
158
|
+
if ph:
|
|
159
|
+
p = HOMUNCULUS / "projects" / ph / "observations.jsonl"
|
|
160
|
+
if p.exists():
|
|
161
|
+
return p
|
|
162
|
+
g = HOMUNCULUS / "observations.jsonl"
|
|
163
|
+
if g.exists():
|
|
164
|
+
return g
|
|
165
|
+
return None
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
def _read_tail_chunk(path: Path, n: int) -> bytes:
|
|
169
|
+
"""末尾 N 行を含むのに十分な chunk を読み込む (近似 heuristic)。
|
|
170
|
+
|
|
171
|
+
n*4096 と 65536 の大きい方を上限 chunk として末尾を seek。
|
|
172
|
+
file が chunk より小さければ全 byte を返す。OSError / IOError は呼び出し側へ伝播。
|
|
173
|
+
"""
|
|
174
|
+
with path.open("rb") as f:
|
|
175
|
+
f.seek(0, os.SEEK_END)
|
|
176
|
+
size = f.tell()
|
|
177
|
+
chunk = min(size, max(n * 4096, 65536))
|
|
178
|
+
f.seek(size - chunk)
|
|
179
|
+
return f.read()
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
def tail_jsonl(path: Path, n: int) -> dict:
|
|
183
|
+
"""末尾 N 行 JSON parse + observation pipeline 健全性指標 (task-32)。
|
|
184
|
+
|
|
185
|
+
返り値 key:
|
|
186
|
+
- records: list[dict]
|
|
187
|
+
- skipped_lines: int (JSONDecodeError 件数)
|
|
188
|
+
- total_lines: int (空行除外後の line count)
|
|
189
|
+
- cascade_suspected: bool (連続 JSONDecodeError が cascade threshold 以上)
|
|
190
|
+
- max_consecutive_skips: int (window 内の最長連続 skip 数)
|
|
191
|
+
|
|
192
|
+
iter4 PY-9 fix: 旧 `_EMPTY_TAIL_RESULT` const は inline literal return に置換 (shallow
|
|
193
|
+
copy mutable share 防止)。`dict(const)` は内部の `records: []` mutable list が share される
|
|
194
|
+
バグを生み、別 invocation が前回の result を mutate する事故を起こすため。
|
|
195
|
+
"""
|
|
196
|
+
threshold = _cascade_threshold()
|
|
197
|
+
if not path.exists():
|
|
198
|
+
return {"records": [], "skipped_lines": 0, "total_lines": 0,
|
|
199
|
+
"cascade_suspected": False, "max_consecutive_skips": 0}
|
|
200
|
+
try:
|
|
201
|
+
raw_bytes = _read_tail_chunk(path, n)
|
|
202
|
+
except (OSError, MemoryError):
|
|
203
|
+
return {"records": [], "skipped_lines": 0, "total_lines": 0,
|
|
204
|
+
"cascade_suspected": False, "max_consecutive_skips": 0}
|
|
205
|
+
data = raw_bytes.decode("utf-8", errors="replace")
|
|
206
|
+
out: list[dict] = []
|
|
207
|
+
skipped = total = consecutive_skips = max_consecutive = 0
|
|
208
|
+
cascade = False
|
|
209
|
+
for line in data.splitlines()[-n:]:
|
|
210
|
+
line = line.strip()
|
|
211
|
+
if not line:
|
|
212
|
+
continue
|
|
213
|
+
total += 1
|
|
214
|
+
try:
|
|
215
|
+
out.append(json.loads(line))
|
|
216
|
+
consecutive_skips = 0
|
|
217
|
+
except json.JSONDecodeError:
|
|
218
|
+
skipped += 1
|
|
219
|
+
consecutive_skips += 1
|
|
220
|
+
if consecutive_skips > max_consecutive:
|
|
221
|
+
max_consecutive = consecutive_skips
|
|
222
|
+
if consecutive_skips >= threshold:
|
|
223
|
+
cascade = True
|
|
224
|
+
return {
|
|
225
|
+
"records": out,
|
|
226
|
+
"skipped_lines": skipped,
|
|
227
|
+
"total_lines": total,
|
|
228
|
+
"cascade_suspected": cascade,
|
|
229
|
+
"max_consecutive_skips": max_consecutive,
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
def _classify_raw_field(raw_val: object) -> str:
|
|
234
|
+
"""observation record の `raw` field を schema 種別に分類 (task-32)。
|
|
235
|
+
|
|
236
|
+
返り値: `"object"` (dict) / `"string"` (str) / `"other"` (それ以外、list / None / 数値等)。
|
|
237
|
+
task-27 W1 (`c25f3ee`) で観察 schema は raw=object に統一済、本判定は実測継続のため。
|
|
238
|
+
"""
|
|
239
|
+
if isinstance(raw_val, dict):
|
|
240
|
+
return "object"
|
|
241
|
+
if isinstance(raw_val, str):
|
|
242
|
+
return "string"
|
|
243
|
+
return "other"
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
def summarize_observations(records: list[dict]) -> dict:
|
|
247
|
+
"""observations から指標を抽出 (task-32: raw object rate も併記、schema 統一の実測継続)。
|
|
248
|
+
|
|
249
|
+
raw_object_rate semantics: `raw_present_count: 0` のとき `raw_object_rate: 0.0` は
|
|
250
|
+
rate 計算不能 (no data) を意味する。`raw_present_count > 0` のときは
|
|
251
|
+
`raw_object_count / raw_present_count` (object 比率) を 3 桁丸めで返す。
|
|
252
|
+
|
|
253
|
+
iter4 PY-9 / PY-4 fix: 旧 `_EMPTY_SUMMARY` const は inline literal return に置換 + `tool_errors: {}`
|
|
254
|
+
を schema に追加。`dict(const)` は内部 dict (`tools: {}` / `tool_errors: {}`) が shallow share
|
|
255
|
+
されるバグを生むため、empty 時も inline literal で完全独立の dict を返す。
|
|
256
|
+
"""
|
|
257
|
+
if not records:
|
|
258
|
+
return {
|
|
259
|
+
"total": 0,
|
|
260
|
+
"tools": {},
|
|
261
|
+
"tool_errors": {},
|
|
262
|
+
"errors": 0,
|
|
263
|
+
"error_rate": 0.0,
|
|
264
|
+
"timeouts": 0,
|
|
265
|
+
"first_ts": None,
|
|
266
|
+
"last_ts": None,
|
|
267
|
+
"raw_object_count": 0,
|
|
268
|
+
"raw_string_count": 0,
|
|
269
|
+
"raw_other_count": 0,
|
|
270
|
+
"raw_present_count": 0,
|
|
271
|
+
"raw_object_rate": 0.0,
|
|
272
|
+
}
|
|
273
|
+
total = len(records)
|
|
274
|
+
tool_counts: Counter[str] = Counter()
|
|
275
|
+
tool_errors: Counter[str] = Counter()
|
|
276
|
+
timestamps: list[str] = []
|
|
277
|
+
raw_counts: Counter[str] = Counter()
|
|
278
|
+
timeouts = errors = raw_present = 0
|
|
279
|
+
|
|
280
|
+
for r in records:
|
|
281
|
+
tool = r.get("tool_name") or r.get("tool") or "unknown"
|
|
282
|
+
tool_counts[tool] += 1
|
|
283
|
+
ts = r.get("timestamp") or r.get("ts")
|
|
284
|
+
if ts:
|
|
285
|
+
timestamps.append(str(ts))
|
|
286
|
+
resp = r.get("tool_response") or {}
|
|
287
|
+
if isinstance(resp, dict):
|
|
288
|
+
if resp.get("is_error") or resp.get("decision") == "block":
|
|
289
|
+
errors += 1
|
|
290
|
+
tool_errors[tool] += 1
|
|
291
|
+
err_str = json.dumps(resp).lower() if resp else ""
|
|
292
|
+
if "timeout" in err_str or "timed out" in err_str:
|
|
293
|
+
timeouts += 1
|
|
294
|
+
if "raw" in r:
|
|
295
|
+
raw_present += 1
|
|
296
|
+
raw_counts[_classify_raw_field(r.get("raw"))] += 1
|
|
297
|
+
|
|
298
|
+
raw_object = raw_counts.get("object", 0)
|
|
299
|
+
# rate は raw field 存在 record を分母とする (raw 欠如 record は分母から除外)
|
|
300
|
+
raw_rate = round(raw_object / raw_present, 3) if raw_present else 0.0
|
|
301
|
+
return {
|
|
302
|
+
"total": total,
|
|
303
|
+
"tools": dict(tool_counts.most_common()),
|
|
304
|
+
"tool_errors": dict(tool_errors.most_common()),
|
|
305
|
+
"errors": errors,
|
|
306
|
+
"error_rate": round(errors / total, 3) if total else 0.0,
|
|
307
|
+
"timeouts": timeouts,
|
|
308
|
+
"first_ts": min(timestamps) if timestamps else None,
|
|
309
|
+
"last_ts": max(timestamps) if timestamps else None,
|
|
310
|
+
"raw_object_count": raw_object,
|
|
311
|
+
"raw_string_count": raw_counts.get("string", 0),
|
|
312
|
+
"raw_other_count": raw_counts.get("other", 0),
|
|
313
|
+
"raw_present_count": raw_present,
|
|
314
|
+
"raw_object_rate": raw_rate,
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
def count_state_dir(d: Path, suffix: str = ".cleared") -> int:
|
|
319
|
+
if not d.is_dir():
|
|
320
|
+
return 0
|
|
321
|
+
return sum(1 for p in d.iterdir() if p.is_file() and p.name.endswith(suffix))
|
|
322
|
+
|
|
323
|
+
|
|
324
|
+
def gateguard_breakdown() -> dict:
|
|
325
|
+
"""GateGuard state file 名から edit / write / bash 別に集計。"""
|
|
326
|
+
d = ROOT / _cfg("gateguard_state_dir")
|
|
327
|
+
out = {"total": 0, "edit": 0, "write": 0, "bash": 0}
|
|
328
|
+
if not d.is_dir():
|
|
329
|
+
return out
|
|
330
|
+
for p in d.iterdir():
|
|
331
|
+
if not p.is_file() or not p.name.endswith(".cleared"):
|
|
332
|
+
continue
|
|
333
|
+
out["total"] += 1
|
|
334
|
+
if p.name.startswith("edit-"):
|
|
335
|
+
out["edit"] += 1
|
|
336
|
+
elif p.name.startswith("write-"):
|
|
337
|
+
out["write"] += 1
|
|
338
|
+
elif p.name.startswith("bash-"):
|
|
339
|
+
out["bash"] += 1
|
|
340
|
+
return out
|
|
341
|
+
|
|
342
|
+
|
|
343
|
+
def failure_window_summary() -> dict:
|
|
344
|
+
"""failure-window 内の各 session log を集計。"""
|
|
345
|
+
d = ROOT / _cfg("failure_window_dir")
|
|
346
|
+
out: dict[str, dict] = {"sessions": {}, "active_loops": 0}
|
|
347
|
+
if not d.is_dir():
|
|
348
|
+
return out
|
|
349
|
+
for log in d.glob("*.log"):
|
|
350
|
+
try:
|
|
351
|
+
lines = [ln.strip() for ln in log.read_text().splitlines() if ln.strip()]
|
|
352
|
+
except Exception:
|
|
353
|
+
continue
|
|
354
|
+
if not lines:
|
|
355
|
+
continue
|
|
356
|
+
# active loop = 直近 3 行が同 signature
|
|
357
|
+
active = False
|
|
358
|
+
if len(lines) >= 3 and len(set(lines[-3:])) == 1:
|
|
359
|
+
active = True
|
|
360
|
+
out["active_loops"] += 1
|
|
361
|
+
out["sessions"][log.stem] = {
|
|
362
|
+
"events": len(lines),
|
|
363
|
+
"active_loop": active,
|
|
364
|
+
"last_signature": lines[-1] if lines else None,
|
|
365
|
+
}
|
|
366
|
+
return out
|
|
367
|
+
|
|
368
|
+
|
|
369
|
+
def bypass_log_summary(days: int = 7) -> dict:
|
|
370
|
+
"""`.claude/.workflow-state/bypass.log` を集計。
|
|
371
|
+
|
|
372
|
+
形式: `<ISO-8601> | <session_id> | <hook_name> | <env_var> | <reason>`
|
|
373
|
+
(lib/bypass-logger.sh が append する統一フォーマット)
|
|
374
|
+
|
|
375
|
+
出力:
|
|
376
|
+
- total_entries: 直近 N 日 の bypass 件数
|
|
377
|
+
- window_days: 集計対象期間 (既定 7 日)
|
|
378
|
+
- by_session: session_id ごとの bypass 回数 (上位 10)
|
|
379
|
+
- by_hook: hook_name ごとの bypass 回数
|
|
380
|
+
- top_env_vars: 最頻出 env_var top 3
|
|
381
|
+
- log_path: 実 path (デバッグ用)
|
|
382
|
+
- missing_or_empty: ログ不在 / 空なら True
|
|
383
|
+
"""
|
|
384
|
+
log_path = ROOT / ".claude" / ".workflow-state" / "bypass.log"
|
|
385
|
+
out: dict = {
|
|
386
|
+
"log_path": str(log_path),
|
|
387
|
+
"window_days": days,
|
|
388
|
+
"total_entries": 0,
|
|
389
|
+
"by_session": {},
|
|
390
|
+
"by_hook": {},
|
|
391
|
+
"top_env_vars": [],
|
|
392
|
+
"missing_or_empty": True,
|
|
393
|
+
}
|
|
394
|
+
if not log_path.is_file():
|
|
395
|
+
return out
|
|
396
|
+
|
|
397
|
+
cutoff = datetime.now(timezone.utc) - timedelta(days=days)
|
|
398
|
+
session_counts: Counter[str] = Counter()
|
|
399
|
+
hook_counts: Counter[str] = Counter()
|
|
400
|
+
env_var_counts: Counter[str] = Counter()
|
|
401
|
+
total = 0
|
|
402
|
+
|
|
403
|
+
try:
|
|
404
|
+
raw_lines = log_path.read_text(encoding="utf-8").splitlines()
|
|
405
|
+
except OSError:
|
|
406
|
+
return out
|
|
407
|
+
|
|
408
|
+
for raw in raw_lines:
|
|
409
|
+
line = raw.strip()
|
|
410
|
+
if not line or line.startswith("#"):
|
|
411
|
+
continue
|
|
412
|
+
# 期待フィールド数: 5
|
|
413
|
+
parts = [p.strip() for p in line.split("|")]
|
|
414
|
+
if len(parts) < 5:
|
|
415
|
+
continue
|
|
416
|
+
ts_str, session_id, hook_name, env_var, _reason = parts[0], parts[1], parts[2], parts[3], "|".join(parts[4:])
|
|
417
|
+
# ISO-8601 (Z suffix) parse → tz-aware UTC
|
|
418
|
+
try:
|
|
419
|
+
ts = datetime.strptime(ts_str, "%Y-%m-%dT%H:%M:%SZ").replace(tzinfo=timezone.utc)
|
|
420
|
+
except ValueError:
|
|
421
|
+
continue
|
|
422
|
+
if ts < cutoff:
|
|
423
|
+
continue
|
|
424
|
+
total += 1
|
|
425
|
+
session_counts[session_id] += 1
|
|
426
|
+
hook_counts[hook_name] += 1
|
|
427
|
+
env_var_counts[env_var] += 1
|
|
428
|
+
|
|
429
|
+
out["total_entries"] = total
|
|
430
|
+
out["by_session"] = dict(session_counts.most_common(10))
|
|
431
|
+
out["by_hook"] = dict(hook_counts.most_common())
|
|
432
|
+
out["top_env_vars"] = [
|
|
433
|
+
{"env_var": v, "count": c} for v, c in env_var_counts.most_common(3)
|
|
434
|
+
]
|
|
435
|
+
out["missing_or_empty"] = total == 0
|
|
436
|
+
return out
|
|
437
|
+
|
|
438
|
+
|
|
439
|
+
def fmt_bypass_log(b: dict) -> str:
|
|
440
|
+
"""Bypass log section markdown (human-readable)."""
|
|
441
|
+
lines: list[str] = []
|
|
442
|
+
lines.append("## Bypass Log Summary")
|
|
443
|
+
lines.append(f"- source: `{b['log_path']}`")
|
|
444
|
+
lines.append(f"- window: 直近 {b['window_days']} 日")
|
|
445
|
+
if b["missing_or_empty"]:
|
|
446
|
+
lines.append(f"- No bypass entries in last {b['window_days']} days")
|
|
447
|
+
return "\n".join(lines)
|
|
448
|
+
lines.append(f"- total entries: **{b['total_entries']}**")
|
|
449
|
+
if b["by_session"]:
|
|
450
|
+
lines.append("")
|
|
451
|
+
lines.append("### Bypasses by session (top 10)")
|
|
452
|
+
for sid, c in b["by_session"].items():
|
|
453
|
+
lines.append(f" - `{sid}`: {c}")
|
|
454
|
+
if b["by_hook"]:
|
|
455
|
+
lines.append("")
|
|
456
|
+
lines.append("### Bypasses by hook")
|
|
457
|
+
for hk, c in b["by_hook"].items():
|
|
458
|
+
lines.append(f" - `{hk}`: {c}")
|
|
459
|
+
if b["top_env_vars"]:
|
|
460
|
+
lines.append("")
|
|
461
|
+
lines.append("### Top env vars (top 3)")
|
|
462
|
+
for e in b["top_env_vars"]:
|
|
463
|
+
lines.append(f" - `{e['env_var']}`: {e['count']}")
|
|
464
|
+
return "\n".join(lines)
|
|
465
|
+
|
|
466
|
+
|
|
467
|
+
def stale_drafts_summary(threshold_days: int = 90, root: Path | None = None) -> dict:
|
|
468
|
+
"""`docs/draft/*.md` を走査し、未承認 + mtime > threshold_days の draft を返す (task-25 C2)。
|
|
469
|
+
|
|
470
|
+
判定基準:
|
|
471
|
+
- frontmatter (HTML comment 内 `key: value`) で `approval_required: true`
|
|
472
|
+
- `approved_at:` が空 (key 不在 or 値が空文字)
|
|
473
|
+
- file mtime が threshold_days 日より古い
|
|
474
|
+
- `_DRAFT_TEMPLATE.md` のような template / underscore prefix は除外
|
|
475
|
+
|
|
476
|
+
出力:
|
|
477
|
+
- threshold_days: 閾値 (default 90)
|
|
478
|
+
- total: 該当件数
|
|
479
|
+
- drafts: [{path, mtime_iso, days_old}] (days_old 降順)
|
|
480
|
+
- draft_dir_present: ディレクトリ存在判定
|
|
481
|
+
"""
|
|
482
|
+
base = root if root is not None else ROOT
|
|
483
|
+
draft_dir = base / "docs" / "draft"
|
|
484
|
+
out: dict = {
|
|
485
|
+
"threshold_days": threshold_days,
|
|
486
|
+
"total": 0,
|
|
487
|
+
"drafts": [],
|
|
488
|
+
"draft_dir_present": draft_dir.is_dir(),
|
|
489
|
+
}
|
|
490
|
+
if not draft_dir.is_dir():
|
|
491
|
+
return out
|
|
492
|
+
|
|
493
|
+
now = datetime.now()
|
|
494
|
+
cutoff_sec = now.timestamp() - threshold_days * 86400
|
|
495
|
+
findings: list[dict] = []
|
|
496
|
+
|
|
497
|
+
for p in sorted(draft_dir.glob("*.md")):
|
|
498
|
+
name = p.name
|
|
499
|
+
# template / underscore prefix は対象外
|
|
500
|
+
if name.startswith("_"):
|
|
501
|
+
continue
|
|
502
|
+
try:
|
|
503
|
+
st = p.stat()
|
|
504
|
+
except OSError:
|
|
505
|
+
continue
|
|
506
|
+
if st.st_mtime > cutoff_sec:
|
|
507
|
+
continue
|
|
508
|
+
# frontmatter parse (HTML comment block の先頭 30 行のみ)
|
|
509
|
+
try:
|
|
510
|
+
head_lines = []
|
|
511
|
+
with p.open("r", encoding="utf-8", errors="replace") as f:
|
|
512
|
+
for i, line in enumerate(f):
|
|
513
|
+
if i >= 30:
|
|
514
|
+
break
|
|
515
|
+
head_lines.append(line)
|
|
516
|
+
except OSError:
|
|
517
|
+
continue
|
|
518
|
+
head = "".join(head_lines)
|
|
519
|
+
# `approval_required: true` で承認必須を判定 (default true、key 不在も承認必須として扱う)
|
|
520
|
+
# `\s` は改行を含むため `[ \t]` に限定 (改行跨ぎマッチを防止)
|
|
521
|
+
m_req = re.search(r"^[ \t]*approval_required[ \t]*:[ \t]*(\S+)", head, re.MULTILINE)
|
|
522
|
+
approval_required = True
|
|
523
|
+
if m_req:
|
|
524
|
+
approval_required = m_req.group(1).lower() == "true"
|
|
525
|
+
if not approval_required:
|
|
526
|
+
continue
|
|
527
|
+
# `approved_at: <value>` を抽出 — 値が空なら未承認
|
|
528
|
+
m_app = re.search(r"^[ \t]*approved_at[ \t]*:[ \t]*(.*)$", head, re.MULTILINE)
|
|
529
|
+
approved_value = ""
|
|
530
|
+
if m_app:
|
|
531
|
+
approved_value = m_app.group(1).strip()
|
|
532
|
+
if approved_value:
|
|
533
|
+
continue
|
|
534
|
+
|
|
535
|
+
days_old = int((now.timestamp() - st.st_mtime) // 86400)
|
|
536
|
+
try:
|
|
537
|
+
rel = str(p.relative_to(base))
|
|
538
|
+
except ValueError:
|
|
539
|
+
rel = str(p)
|
|
540
|
+
findings.append({
|
|
541
|
+
"path": rel,
|
|
542
|
+
"mtime_iso": datetime.fromtimestamp(st.st_mtime).strftime("%Y-%m-%d"),
|
|
543
|
+
"days_old": days_old,
|
|
544
|
+
})
|
|
545
|
+
|
|
546
|
+
findings.sort(key=lambda d: d["days_old"], reverse=True)
|
|
547
|
+
out["total"] = len(findings)
|
|
548
|
+
out["drafts"] = findings
|
|
549
|
+
return out
|
|
550
|
+
|
|
551
|
+
|
|
552
|
+
def fmt_stale_drafts(sd: dict) -> str:
|
|
553
|
+
"""Stale draft section markdown (task-25 C2)."""
|
|
554
|
+
lines: list[str] = []
|
|
555
|
+
lines.append(f"## Stale Drafts (≥{sd['threshold_days']} days, unapproved)")
|
|
556
|
+
if not sd["draft_dir_present"]:
|
|
557
|
+
lines.append("- (docs/draft/ 不在)")
|
|
558
|
+
return "\n".join(lines)
|
|
559
|
+
if sd["total"] == 0:
|
|
560
|
+
lines.append(f"- 0 drafts (no unapproved drafts older than {sd['threshold_days']} days)")
|
|
561
|
+
return "\n".join(lines)
|
|
562
|
+
lines.append(f"{sd['total']} drafts found:")
|
|
563
|
+
for d in sd["drafts"]:
|
|
564
|
+
lines.append(f" - {d['path']} (起案: {d['mtime_iso']}, {d['days_old']}日経過)")
|
|
565
|
+
return "\n".join(lines)
|
|
566
|
+
|
|
567
|
+
|
|
568
|
+
def settings_drift_check(root: Path | None = None) -> dict:
|
|
569
|
+
"""`.claude/settings.json` と `settings.local.json` を比較 (task-25 C3)。
|
|
570
|
+
|
|
571
|
+
判定:
|
|
572
|
+
- settings.local.json 不在 → drift なし (silent skip)
|
|
573
|
+
- 両 file の top-level key を再帰比較
|
|
574
|
+
- local のみに存在 → "local_only"
|
|
575
|
+
- main のみに存在 → "main_only"
|
|
576
|
+
- 値が違う → "modified" (path + before/after の文字列化)
|
|
577
|
+
|
|
578
|
+
出力:
|
|
579
|
+
- local_present: bool
|
|
580
|
+
- drift_count: int (発見 diff 件数)
|
|
581
|
+
- local_only: list[{path, value}]
|
|
582
|
+
- main_only: list[{path, value}]
|
|
583
|
+
- modified: list[{path, main, local}]
|
|
584
|
+
"""
|
|
585
|
+
base = root if root is not None else ROOT
|
|
586
|
+
main_path = base / ".claude" / "settings.json"
|
|
587
|
+
local_path = base / ".claude" / "settings.local.json"
|
|
588
|
+
out: dict = {
|
|
589
|
+
"main_present": main_path.is_file(),
|
|
590
|
+
"local_present": local_path.is_file(),
|
|
591
|
+
"drift_count": 0,
|
|
592
|
+
"local_only": [],
|
|
593
|
+
"main_only": [],
|
|
594
|
+
"modified": [],
|
|
595
|
+
}
|
|
596
|
+
if not local_path.is_file():
|
|
597
|
+
return out
|
|
598
|
+
if not main_path.is_file():
|
|
599
|
+
# local だけある状態は drift 報告対象だが main を読めないので skip
|
|
600
|
+
return out
|
|
601
|
+
try:
|
|
602
|
+
main_data = json.loads(main_path.read_text(encoding="utf-8"))
|
|
603
|
+
except (OSError, json.JSONDecodeError):
|
|
604
|
+
return out
|
|
605
|
+
try:
|
|
606
|
+
local_data = json.loads(local_path.read_text(encoding="utf-8"))
|
|
607
|
+
except (OSError, json.JSONDecodeError):
|
|
608
|
+
return out
|
|
609
|
+
|
|
610
|
+
local_only: list[dict] = []
|
|
611
|
+
main_only: list[dict] = []
|
|
612
|
+
modified: list[dict] = []
|
|
613
|
+
|
|
614
|
+
def _walk(prefix: str, m: object, l: object) -> None:
|
|
615
|
+
# 両側が dict なら key 単位再帰
|
|
616
|
+
if isinstance(m, dict) and isinstance(l, dict):
|
|
617
|
+
for k in sorted(set(m.keys()) | set(l.keys())):
|
|
618
|
+
child_path = f"{prefix}.{k}" if prefix else k
|
|
619
|
+
if k in m and k not in l:
|
|
620
|
+
main_only.append({"path": child_path, "value": _short(m[k])})
|
|
621
|
+
elif k in l and k not in m:
|
|
622
|
+
local_only.append({"path": child_path, "value": _short(l[k])})
|
|
623
|
+
else:
|
|
624
|
+
_walk(child_path, m[k], l[k])
|
|
625
|
+
return
|
|
626
|
+
# それ以外 (list / scalar) は eq 比較
|
|
627
|
+
if m != l:
|
|
628
|
+
modified.append({
|
|
629
|
+
"path": prefix or "(root)",
|
|
630
|
+
"main": _short(m),
|
|
631
|
+
"local": _short(l),
|
|
632
|
+
})
|
|
633
|
+
|
|
634
|
+
_walk("", main_data, local_data)
|
|
635
|
+
|
|
636
|
+
out["local_only"] = local_only
|
|
637
|
+
out["main_only"] = main_only
|
|
638
|
+
out["modified"] = modified
|
|
639
|
+
out["drift_count"] = len(local_only) + len(main_only) + len(modified)
|
|
640
|
+
return out
|
|
641
|
+
|
|
642
|
+
|
|
643
|
+
def _short(v: object, limit: int = 80) -> str:
|
|
644
|
+
"""値を 1 行 string に圧縮 (drift 出力用)。"""
|
|
645
|
+
try:
|
|
646
|
+
s = json.dumps(v, ensure_ascii=False)
|
|
647
|
+
except (TypeError, ValueError):
|
|
648
|
+
s = str(v)
|
|
649
|
+
if len(s) > limit:
|
|
650
|
+
s = s[: limit - 3] + "..."
|
|
651
|
+
return s
|
|
652
|
+
|
|
653
|
+
|
|
654
|
+
def fmt_settings_drift(sd: dict) -> str:
|
|
655
|
+
"""Settings drift section markdown (task-25 C3)."""
|
|
656
|
+
lines: list[str] = []
|
|
657
|
+
lines.append("## Settings Drift")
|
|
658
|
+
if not sd["local_present"]:
|
|
659
|
+
lines.append("- settings.local.json 不在 → drift 検証 skip")
|
|
660
|
+
return "\n".join(lines)
|
|
661
|
+
if not sd["main_present"]:
|
|
662
|
+
lines.append("- settings.json 不在 → drift 検証 skip")
|
|
663
|
+
return "\n".join(lines)
|
|
664
|
+
if sd["drift_count"] == 0:
|
|
665
|
+
lines.append("- settings.json vs settings.local.json: identical (0 diff)")
|
|
666
|
+
return "\n".join(lines)
|
|
667
|
+
lines.append("settings.json vs settings.local.json:")
|
|
668
|
+
for e in sd["local_only"]:
|
|
669
|
+
lines.append(f" + {e['path']}: {e['value']} (local only)")
|
|
670
|
+
for e in sd["main_only"]:
|
|
671
|
+
lines.append(f" - {e['path']}: <missing in local but present in main>")
|
|
672
|
+
for e in sd["modified"]:
|
|
673
|
+
lines.append(f" ~ {e['path']}: {e['main']} -> {e['local']}")
|
|
674
|
+
return "\n".join(lines)
|
|
675
|
+
|
|
676
|
+
|
|
677
|
+
def confidence_gate_breakdown() -> dict:
|
|
678
|
+
"""Confidence Gate (F3) bypass.log を集計。
|
|
679
|
+
|
|
680
|
+
出力:
|
|
681
|
+
- bypasses: 累計 bypass 回数(ファイル行数)
|
|
682
|
+
- recent_reasons: 直近 5 件の bypass reason(時刻 + reason)
|
|
683
|
+
- bypass_marker_pending: 未消化の bypass.cleared が残っているか
|
|
684
|
+
"""
|
|
685
|
+
d = ROOT / _cfg("confidence_state_dir")
|
|
686
|
+
out: dict = {"bypasses": 0, "recent_reasons": [], "bypass_marker_pending": False}
|
|
687
|
+
if not d.is_dir():
|
|
688
|
+
return out
|
|
689
|
+
log = d / "bypass.log"
|
|
690
|
+
if log.is_file():
|
|
691
|
+
try:
|
|
692
|
+
lines = [ln.rstrip() for ln in log.read_text().splitlines() if ln.strip()]
|
|
693
|
+
except Exception:
|
|
694
|
+
lines = []
|
|
695
|
+
out["bypasses"] = len(lines)
|
|
696
|
+
out["recent_reasons"] = lines[-5:]
|
|
697
|
+
out["bypass_marker_pending"] = (d / "bypass.cleared").is_file()
|
|
698
|
+
return out
|
|
699
|
+
|
|
700
|
+
|
|
701
|
+
def fmt_observation_health(report: dict) -> str:
|
|
702
|
+
"""task-32: Observation Pipeline 健全性セクション markdown。
|
|
703
|
+
|
|
704
|
+
Phase 1: parse-skipped 行数 / raw object rate
|
|
705
|
+
Phase 2: cascade fail 検出時 🔴 warning
|
|
706
|
+
"""
|
|
707
|
+
obs = report.get("observations") or {}
|
|
708
|
+
health = report.get("observation_health") or {}
|
|
709
|
+
threshold = health.get("cascade_threshold", _cascade_threshold())
|
|
710
|
+
total_lines = health.get("total_lines", 0)
|
|
711
|
+
skipped_lines = health.get("skipped_lines", 0)
|
|
712
|
+
cascade = bool(health.get("cascade_suspected", False))
|
|
713
|
+
max_consec = health.get("max_consecutive_skips", 0)
|
|
714
|
+
|
|
715
|
+
lines: list[str] = []
|
|
716
|
+
lines.append("## Observation Pipeline 健全性")
|
|
717
|
+
if total_lines == 0:
|
|
718
|
+
lines.append("- (集計対象 line なし、observation 未発生 or window 外)")
|
|
719
|
+
return "\n".join(lines)
|
|
720
|
+
|
|
721
|
+
jq_valid = total_lines - skipped_lines
|
|
722
|
+
parse_rate_pct = (jq_valid / total_lines * 100) if total_lines else 0.0
|
|
723
|
+
skip_rate_pct = (skipped_lines / total_lines * 100) if total_lines else 0.0
|
|
724
|
+
lines.append(
|
|
725
|
+
f"- parse-skipped: **{skipped_lines}** / {total_lines} lines "
|
|
726
|
+
f"({skip_rate_pct:.2f}% skipped, jq-valid {parse_rate_pct:.2f}%)"
|
|
727
|
+
)
|
|
728
|
+
|
|
729
|
+
raw_present = obs.get("raw_present_count", 0)
|
|
730
|
+
raw_object = obs.get("raw_object_count", 0)
|
|
731
|
+
raw_string = obs.get("raw_string_count", 0)
|
|
732
|
+
raw_other = obs.get("raw_other_count", 0)
|
|
733
|
+
raw_rate_pct = (obs.get("raw_object_rate", 0.0) * 100)
|
|
734
|
+
if raw_present > 0:
|
|
735
|
+
lines.append(
|
|
736
|
+
f"- raw object rate: **{raw_rate_pct:.2f}%** "
|
|
737
|
+
f"(object {raw_object} / string {raw_string} / other {raw_other} / "
|
|
738
|
+
f"present {raw_present})"
|
|
739
|
+
)
|
|
740
|
+
else:
|
|
741
|
+
lines.append("- raw object rate: (no `raw` field observed in window)")
|
|
742
|
+
|
|
743
|
+
lines.append(f"- cascade threshold: {threshold} (env `HC_CASCADE_THRESHOLD` で override)")
|
|
744
|
+
lines.append(f"- max consecutive skips observed: {max_consec}")
|
|
745
|
+
|
|
746
|
+
if cascade:
|
|
747
|
+
lines.append("")
|
|
748
|
+
lines.append(
|
|
749
|
+
f"🔴 **CASCADE FAIL SUSPECTED**: {max_consec} 連続行で JSONDecodeError 発生。"
|
|
750
|
+
"observe.sh write 経路 regression の可能性 (`.claude/skills/continuous-learning-v2/hooks/observe.sh` "
|
|
751
|
+
"の `--rawfile` + `fromjson?` 経路確認)。"
|
|
752
|
+
)
|
|
753
|
+
|
|
754
|
+
return "\n".join(lines)
|
|
755
|
+
|
|
756
|
+
|
|
757
|
+
def fmt_human(report: dict) -> str:
|
|
758
|
+
obs = report["observations"]
|
|
759
|
+
gg = report["gateguard"]
|
|
760
|
+
tg = report["taskguard"]
|
|
761
|
+
fw = report["failure_window"]
|
|
762
|
+
|
|
763
|
+
lines: list[str] = []
|
|
764
|
+
lines.append("# Harness Audit Report")
|
|
765
|
+
lines.append(f"_generated: {datetime.now().isoformat(timespec='seconds')}_")
|
|
766
|
+
lines.append("")
|
|
767
|
+
|
|
768
|
+
# Observations
|
|
769
|
+
lines.append("## 観察ログ (observations.jsonl)")
|
|
770
|
+
if not report["observations_path"]:
|
|
771
|
+
lines.append("- 観測ログが見つかりません(git remote 未設定 or 観察未開始)。")
|
|
772
|
+
else:
|
|
773
|
+
lines.append(f"- source: `{report['observations_path']}`")
|
|
774
|
+
lines.append(f"- window: 直近 {report['window']} 件")
|
|
775
|
+
lines.append(f"- total events: **{obs['total']}**")
|
|
776
|
+
lines.append(
|
|
777
|
+
f"- errors: **{obs['errors']}**(error rate {obs['error_rate']:.1%})"
|
|
778
|
+
)
|
|
779
|
+
lines.append(f"- timeouts: {obs['timeouts']}")
|
|
780
|
+
if obs["first_ts"] and obs["last_ts"]:
|
|
781
|
+
lines.append(f"- range: {obs['first_ts']} → {obs['last_ts']}")
|
|
782
|
+
if obs["tools"]:
|
|
783
|
+
lines.append("")
|
|
784
|
+
lines.append("### tool 別 (top 10)")
|
|
785
|
+
for t, c in list(obs["tools"].items())[:10]:
|
|
786
|
+
err = obs["tool_errors"].get(t, 0)
|
|
787
|
+
rate = (err / c) if c else 0
|
|
788
|
+
marker = " ⚠️" if rate >= 0.3 and c >= 5 else ""
|
|
789
|
+
lines.append(f" - `{t}`: {c} calls / {err} errors ({rate:.0%}){marker}")
|
|
790
|
+
lines.append("")
|
|
791
|
+
|
|
792
|
+
# task-32: Observation Pipeline 健全性 (observations セクション直後)
|
|
793
|
+
if "observation_health" in report:
|
|
794
|
+
lines.append(fmt_observation_health(report))
|
|
795
|
+
lines.append("")
|
|
796
|
+
|
|
797
|
+
# GateGuard
|
|
798
|
+
lines.append("## GateGuard state (F1)")
|
|
799
|
+
lines.append(f"- cleared: **{gg['total']}** files")
|
|
800
|
+
lines.append(f" - edit: {gg['edit']} / write: {gg['write']} / bash: {gg['bash']}")
|
|
801
|
+
if gg["total"] == 0:
|
|
802
|
+
lines.append(" - (まだ初回 Edit/Write/破壊的 Bash の事実調査が発生していない)")
|
|
803
|
+
lines.append("")
|
|
804
|
+
|
|
805
|
+
# TaskGuard
|
|
806
|
+
lines.append("## TaskGuard bypass (タスク管理)")
|
|
807
|
+
lines.append(f"- cleared: **{tg}** files (slug-単位 bypass)")
|
|
808
|
+
if tg > 0:
|
|
809
|
+
lines.append(" - ⚠️ bypass の根拠を CLAUDE.md / docs/tasks/ に記録すること")
|
|
810
|
+
lines.append("")
|
|
811
|
+
|
|
812
|
+
# Failure window
|
|
813
|
+
lines.append("## Failure-loop window (W2.1)")
|
|
814
|
+
lines.append(f"- active loops: **{fw['active_loops']}**")
|
|
815
|
+
if fw["sessions"]:
|
|
816
|
+
for sid, s in fw["sessions"].items():
|
|
817
|
+
badge = " 🔁 ACTIVE LOOP" if s["active_loop"] else ""
|
|
818
|
+
lines.append(f" - `{sid}`: {s['events']} events{badge}")
|
|
819
|
+
if s["last_signature"]:
|
|
820
|
+
lines.append(f" last: `{s['last_signature']}`")
|
|
821
|
+
else:
|
|
822
|
+
lines.append("- (no failure events recorded in current windows)")
|
|
823
|
+
lines.append("")
|
|
824
|
+
|
|
825
|
+
# Confidence Gate (F3)
|
|
826
|
+
cg = report["confidence_gate"]
|
|
827
|
+
lines.append("## Confidence Gate (F3)")
|
|
828
|
+
lines.append(f"- bypasses (累計): **{cg['bypasses']}**")
|
|
829
|
+
if cg["bypass_marker_pending"]:
|
|
830
|
+
lines.append(" - ⚠️ bypass.cleared が未消化(次回の SubagentStop で 1 回 PASS)")
|
|
831
|
+
if cg["recent_reasons"]:
|
|
832
|
+
lines.append(" - 直近 5 件の bypass reason:")
|
|
833
|
+
for r in cg["recent_reasons"]:
|
|
834
|
+
lines.append(f" - `{r}`")
|
|
835
|
+
if cg["bypasses"] == 0 and not cg["bypass_marker_pending"]:
|
|
836
|
+
lines.append(" - (まだ bypass されていない)")
|
|
837
|
+
lines.append("")
|
|
838
|
+
|
|
839
|
+
# Workflow bypass log (W4)
|
|
840
|
+
if "bypass_log" in report:
|
|
841
|
+
lines.append(fmt_bypass_log(report["bypass_log"]))
|
|
842
|
+
lines.append("")
|
|
843
|
+
|
|
844
|
+
# Stale drafts (task-25 C2)
|
|
845
|
+
if "stale_drafts" in report:
|
|
846
|
+
lines.append(fmt_stale_drafts(report["stale_drafts"]))
|
|
847
|
+
lines.append("")
|
|
848
|
+
|
|
849
|
+
# Settings drift (task-25 C3)
|
|
850
|
+
if "settings_drift" in report:
|
|
851
|
+
lines.append(fmt_settings_drift(report["settings_drift"]))
|
|
852
|
+
lines.append("")
|
|
853
|
+
|
|
854
|
+
# Health badge
|
|
855
|
+
lines.append("## Health")
|
|
856
|
+
health = []
|
|
857
|
+
if obs["total"] > 0:
|
|
858
|
+
if obs["error_rate"] >= 0.3:
|
|
859
|
+
health.append("🔴 high error rate")
|
|
860
|
+
elif obs["error_rate"] >= 0.1:
|
|
861
|
+
health.append("🟡 moderate error rate")
|
|
862
|
+
else:
|
|
863
|
+
health.append("🟢 low error rate")
|
|
864
|
+
if fw["active_loops"] > 0:
|
|
865
|
+
health.append(f"🔴 {fw['active_loops']} active failure loop(s)")
|
|
866
|
+
if obs["timeouts"] > 5:
|
|
867
|
+
health.append(f"🟡 {obs['timeouts']} timeouts in window")
|
|
868
|
+
# task-32: cascade fail を Health に昇格
|
|
869
|
+
oh = report.get("observation_health") or {}
|
|
870
|
+
if oh.get("cascade_suspected"):
|
|
871
|
+
health.append(
|
|
872
|
+
f"🔴 cascade fail suspected ({oh.get('max_consecutive_skips', 0)} consecutive parse errors)"
|
|
873
|
+
)
|
|
874
|
+
if not health:
|
|
875
|
+
health.append("🟢 no issues detected")
|
|
876
|
+
for h in health:
|
|
877
|
+
lines.append(f"- {h}")
|
|
878
|
+
|
|
879
|
+
return "\n".join(lines)
|
|
880
|
+
|
|
881
|
+
|
|
882
|
+
def swe_bench_breakdown() -> dict:
|
|
883
|
+
"""SWE-bench Lite dry-run / 本番 results を集計。
|
|
884
|
+
|
|
885
|
+
.claude/skills/eval-harness/swe-bench/results/*.json を読み、
|
|
886
|
+
各 run の completion rate / 平均 cost / 平均時間 / patch 適用率を返す。
|
|
887
|
+
"""
|
|
888
|
+
d = ROOT / ".claude" / "skills" / "eval-harness" / "swe-bench" / "results"
|
|
889
|
+
out: dict = {"runs": [], "total_runs": 0}
|
|
890
|
+
if not d.is_dir():
|
|
891
|
+
return out
|
|
892
|
+
for p in sorted(d.glob("*.json")):
|
|
893
|
+
try:
|
|
894
|
+
data = json.loads(p.read_text(encoding="utf-8"))
|
|
895
|
+
except Exception:
|
|
896
|
+
continue
|
|
897
|
+
s = data.get("summary") or {}
|
|
898
|
+
results = data.get("results") or []
|
|
899
|
+
if not results:
|
|
900
|
+
continue
|
|
901
|
+
n = len(results)
|
|
902
|
+
applied = sum(1 for r in results if r.get("score", {}).get("patch_applies"))
|
|
903
|
+
# resolved = patch applied AND tests run AND f2p tests pass with no failures
|
|
904
|
+
resolved = sum(
|
|
905
|
+
1 for r in results
|
|
906
|
+
if r.get("score", {}).get("patch_applies")
|
|
907
|
+
and r.get("score", {}).get("tests_run")
|
|
908
|
+
and r.get("score", {}).get("tests_passed", 0) > 0
|
|
909
|
+
and r.get("score", {}).get("tests_failed", 0) == 0
|
|
910
|
+
)
|
|
911
|
+
tests_attempted = sum(1 for r in results if r.get("score", {}).get("tests_run"))
|
|
912
|
+
avg_cost = round(s.get("cumulative_cost_usd", 0) / n, 4) if n else 0.0
|
|
913
|
+
avg_dur = round(
|
|
914
|
+
sum(r.get("invoke_duration_sec", 0) for r in results) / n, 2
|
|
915
|
+
) if n else 0.0
|
|
916
|
+
out["runs"].append({
|
|
917
|
+
"file": p.name,
|
|
918
|
+
"model": s.get("model"),
|
|
919
|
+
"patch_mode": s.get("patch_mode"),
|
|
920
|
+
"tasks_run": s.get("tasks_run"),
|
|
921
|
+
"patch_generated": s.get("patch_generated_count"),
|
|
922
|
+
"patch_applied": applied,
|
|
923
|
+
"applied_rate": round(applied / n, 3) if n else 0.0,
|
|
924
|
+
"resolved": resolved,
|
|
925
|
+
"tests_attempted": tests_attempted,
|
|
926
|
+
"resolved_rate": round(resolved / n, 3) if n else 0.0,
|
|
927
|
+
"cumulative_cost_usd": s.get("cumulative_cost_usd"),
|
|
928
|
+
"avg_cost_usd": avg_cost,
|
|
929
|
+
"avg_invoke_duration_sec": avg_dur,
|
|
930
|
+
"cost_cap_usd": s.get("cost_cap_usd"),
|
|
931
|
+
"cost_cap_hit": s.get("cost_cap_hit"),
|
|
932
|
+
"started_at": s.get("started_at"),
|
|
933
|
+
"by_gate_combo": s.get("by_gate_combo") or {},
|
|
934
|
+
"official_harness": data.get("official_harness") or {},
|
|
935
|
+
})
|
|
936
|
+
out["total_runs"] = len(out["runs"])
|
|
937
|
+
return out
|
|
938
|
+
|
|
939
|
+
|
|
940
|
+
def fmt_swe_bench(sb: dict) -> str:
|
|
941
|
+
"""SWE-bench section markdown."""
|
|
942
|
+
lines: list[str] = []
|
|
943
|
+
lines.append("# SWE-bench Lite Audit")
|
|
944
|
+
lines.append(f"_generated: {datetime.now().isoformat(timespec='seconds')}_")
|
|
945
|
+
lines.append("")
|
|
946
|
+
if sb["total_runs"] == 0:
|
|
947
|
+
lines.append("(no runs found in .claude/skills/eval-harness/swe-bench/results/)")
|
|
948
|
+
return "\n".join(lines)
|
|
949
|
+
lines.append(f"- runs: **{sb['total_runs']}**")
|
|
950
|
+
lines.append("")
|
|
951
|
+
lines.append("| run | model | mode | n | applied | rate | resolved | resolved% | cum$ | avg$ | avg(s) | cap | hit |")
|
|
952
|
+
lines.append("|---|---|---|---:|---:|---:|---:|---:|---:|---:|---:|---:|:---:|")
|
|
953
|
+
for r in sb["runs"]:
|
|
954
|
+
hit = "Y" if r.get("cost_cap_hit") else "-"
|
|
955
|
+
mode = (r.get("patch_mode") or "?")[:11]
|
|
956
|
+
lines.append(
|
|
957
|
+
f"| {r['file']} | {r.get('model','?')} | {mode} | {r.get('tasks_run',0)} | "
|
|
958
|
+
f"{r.get('patch_applied',0)} | {r.get('applied_rate',0):.0%} | "
|
|
959
|
+
f"{r.get('resolved',0)} | {r.get('resolved_rate',0):.0%} | "
|
|
960
|
+
f"${r.get('cumulative_cost_usd',0):.3f} | ${r.get('avg_cost_usd',0):.3f} | "
|
|
961
|
+
f"{r.get('avg_invoke_duration_sec',0):.1f} | "
|
|
962
|
+
f"${r.get('cost_cap_usd',0):.1f} | {hit} |"
|
|
963
|
+
)
|
|
964
|
+
|
|
965
|
+
# F1/F2 gate-combo breakdown (only emitted for runs that used --gates-grid).
|
|
966
|
+
grid_runs = [r for r in sb["runs"] if r.get("by_gate_combo")]
|
|
967
|
+
if grid_runs:
|
|
968
|
+
lines.append("")
|
|
969
|
+
lines.append("## F1/F2 Gate Grid")
|
|
970
|
+
for r in grid_runs:
|
|
971
|
+
lines.append(f"### {r['file']}")
|
|
972
|
+
lines.append("")
|
|
973
|
+
lines.append("| combo | selected | applied | rate | resolved | resolved% | cost$ | wall(s) |")
|
|
974
|
+
lines.append("|---|---:|---:|---:|---:|---:|---:|---:|")
|
|
975
|
+
for combo, slot in sorted(r["by_gate_combo"].items()):
|
|
976
|
+
lines.append(
|
|
977
|
+
f"| {combo} | {slot.get('selected',0)} | {slot.get('applied',0)} | "
|
|
978
|
+
f"{slot.get('applied_rate',0):.0%} | {slot.get('resolved',0)} | "
|
|
979
|
+
f"{slot.get('resolved_rate',0):.0%} | "
|
|
980
|
+
f"${slot.get('cost_usd',0):.3f} | {slot.get('wall_time_sec',0):.1f} |"
|
|
981
|
+
)
|
|
982
|
+
# defensive impact: F1 on vs F1 off, F2 on vs F2 off
|
|
983
|
+
bgc = r["by_gate_combo"]
|
|
984
|
+
def _avg(keys: list[str], field: str) -> float:
|
|
985
|
+
vals = [bgc[k].get(field, 0) for k in keys if k in bgc]
|
|
986
|
+
return round(sum(vals) / len(vals), 3) if vals else 0.0
|
|
987
|
+
|
|
988
|
+
f1_on_rate = _avg(["f1_on_f2_on", "f1_on_f2_off"], "applied_rate")
|
|
989
|
+
f1_off_rate = _avg(["f1_off_f2_on", "f1_off_f2_off"], "applied_rate")
|
|
990
|
+
f2_on_rate = _avg(["f1_on_f2_on", "f1_off_f2_on"], "applied_rate")
|
|
991
|
+
f2_off_rate = _avg(["f1_on_f2_off", "f1_off_f2_off"], "applied_rate")
|
|
992
|
+
if any(k in bgc for k in ("f1_on_f2_on", "f1_off_f2_on", "f1_on_f2_off", "f1_off_f2_off")):
|
|
993
|
+
lines.append("")
|
|
994
|
+
lines.append("#### Defensive impact (applied rate)")
|
|
995
|
+
lines.append(f"- F1 on→off: {f1_on_rate:.0%} → {f1_off_rate:.0%} (delta {f1_on_rate - f1_off_rate:+.0%})")
|
|
996
|
+
lines.append(f"- F2 on→off: {f2_on_rate:.0%} → {f2_off_rate:.0%} (delta {f2_on_rate - f2_off_rate:+.0%})")
|
|
997
|
+
|
|
998
|
+
return "\n".join(lines)
|
|
999
|
+
|
|
1000
|
+
|
|
1001
|
+
def router_breakdown(homunculus_root: Path | None = None, project_hash_override: str | None = None) -> dict:
|
|
1002
|
+
"""Aggregate dispatch.jsonl rows from the homunculus tree.
|
|
1003
|
+
|
|
1004
|
+
Strategy:
|
|
1005
|
+
- When an explicit `homunculus_root` is given (e.g. `--router-homunculus-root`),
|
|
1006
|
+
scan every projects/<hash>/dispatch.jsonl beneath it.
|
|
1007
|
+
- Otherwise resolve the current project's hash via `project_hash()` and read
|
|
1008
|
+
only that project's log; if absent, fall back to a global tree-wide scan.
|
|
1009
|
+
|
|
1010
|
+
The aggregation is purposely tolerant: malformed rows are skipped, and a
|
|
1011
|
+
completely empty tree returns zeroed counters with `total: 0`.
|
|
1012
|
+
"""
|
|
1013
|
+
root = Path(homunculus_root) if homunculus_root else HOMUNCULUS
|
|
1014
|
+
|
|
1015
|
+
# Discover candidate logs.
|
|
1016
|
+
logs: list[Path] = []
|
|
1017
|
+
if homunculus_root:
|
|
1018
|
+
logs = sorted((root / "projects").glob("*/dispatch.jsonl")) if (root / "projects").is_dir() else []
|
|
1019
|
+
else:
|
|
1020
|
+
ph = project_hash_override or project_hash()
|
|
1021
|
+
if ph:
|
|
1022
|
+
cand = root / "projects" / ph / "dispatch.jsonl"
|
|
1023
|
+
if cand.exists():
|
|
1024
|
+
logs = [cand]
|
|
1025
|
+
if not logs and (root / "projects").is_dir():
|
|
1026
|
+
logs = sorted((root / "projects").glob("*/dispatch.jsonl"))
|
|
1027
|
+
|
|
1028
|
+
rows: list[dict] = []
|
|
1029
|
+
for log in logs:
|
|
1030
|
+
try:
|
|
1031
|
+
for line in log.read_text(encoding="utf-8").splitlines():
|
|
1032
|
+
line = line.strip()
|
|
1033
|
+
if not line:
|
|
1034
|
+
continue
|
|
1035
|
+
try:
|
|
1036
|
+
rows.append(json.loads(line))
|
|
1037
|
+
except json.JSONDecodeError:
|
|
1038
|
+
continue
|
|
1039
|
+
except OSError:
|
|
1040
|
+
continue
|
|
1041
|
+
|
|
1042
|
+
layer_counts: Counter[str] = Counter()
|
|
1043
|
+
agent_counts: Counter[str] = Counter()
|
|
1044
|
+
confidences: list[float] = []
|
|
1045
|
+
cumulative_cost = 0.0
|
|
1046
|
+
named_count = 0
|
|
1047
|
+
cycles = 0
|
|
1048
|
+
|
|
1049
|
+
for r in rows:
|
|
1050
|
+
layer = str(r.get("fallback_layer") or "unknown")
|
|
1051
|
+
layer_counts[layer] += 1
|
|
1052
|
+
agent = str(r.get("dispatched_agent") or "unknown")
|
|
1053
|
+
agent_counts[agent] += 1
|
|
1054
|
+
if agent and agent != "general-purpose":
|
|
1055
|
+
named_count += 1
|
|
1056
|
+
try:
|
|
1057
|
+
confidences.append(float(r.get("confidence") or 0.0))
|
|
1058
|
+
except (TypeError, ValueError):
|
|
1059
|
+
pass
|
|
1060
|
+
try:
|
|
1061
|
+
cumulative_cost += float(r.get("cost_usd") or 0.0)
|
|
1062
|
+
except (TypeError, ValueError):
|
|
1063
|
+
pass
|
|
1064
|
+
if r.get("cycle_broken"):
|
|
1065
|
+
cycles += 1
|
|
1066
|
+
|
|
1067
|
+
total = len(rows)
|
|
1068
|
+
avg_conf = round(sum(confidences) / len(confidences), 3) if confidences else 0.0
|
|
1069
|
+
named_rate = round(named_count / total, 3) if total else 0.0
|
|
1070
|
+
|
|
1071
|
+
# Order layers in canonical fallback ladder; surface "unknown" last if present.
|
|
1072
|
+
canonical = ["keyword", "llm", "previous", "general-purpose"]
|
|
1073
|
+
layers_ordered = {l: layer_counts.get(l, 0) for l in canonical}
|
|
1074
|
+
for l, c in layer_counts.items():
|
|
1075
|
+
if l not in layers_ordered:
|
|
1076
|
+
layers_ordered[l] = c
|
|
1077
|
+
|
|
1078
|
+
return {
|
|
1079
|
+
"logs_scanned": [str(p) for p in logs],
|
|
1080
|
+
"total": total,
|
|
1081
|
+
"by_layer": layers_ordered,
|
|
1082
|
+
"named_agent_count": named_count,
|
|
1083
|
+
"named_agent_rate": named_rate,
|
|
1084
|
+
"avg_confidence": avg_conf,
|
|
1085
|
+
"cumulative_cost_usd": round(cumulative_cost, 6),
|
|
1086
|
+
"cycle_broken": cycles,
|
|
1087
|
+
"top_agents": dict(agent_counts.most_common(10)),
|
|
1088
|
+
}
|
|
1089
|
+
|
|
1090
|
+
|
|
1091
|
+
def fmt_router(r: dict) -> str:
|
|
1092
|
+
"""Markdown leaderboard for the router section."""
|
|
1093
|
+
lines: list[str] = []
|
|
1094
|
+
lines.append("# Router Dispatch Audit")
|
|
1095
|
+
lines.append(f"_generated: {datetime.now().isoformat(timespec='seconds')}_")
|
|
1096
|
+
lines.append("")
|
|
1097
|
+
if r["total"] == 0:
|
|
1098
|
+
lines.append("- (no dispatch.jsonl rows found)")
|
|
1099
|
+
if r["logs_scanned"]:
|
|
1100
|
+
lines.append("")
|
|
1101
|
+
lines.append("## Scanned logs")
|
|
1102
|
+
for p in r["logs_scanned"]:
|
|
1103
|
+
lines.append(f" - `{p}`")
|
|
1104
|
+
return "\n".join(lines)
|
|
1105
|
+
|
|
1106
|
+
lines.append(f"- total dispatches: **{r['total']}**")
|
|
1107
|
+
lines.append(f"- named-agent rate: **{r['named_agent_rate']:.1%}** ({r['named_agent_count']}/{r['total']})")
|
|
1108
|
+
lines.append(f"- avg confidence: **{r['avg_confidence']:.3f}**")
|
|
1109
|
+
lines.append(f"- cumulative cost: **${r['cumulative_cost_usd']:.4f}**")
|
|
1110
|
+
lines.append(f"- cycle-broken events: {r['cycle_broken']}")
|
|
1111
|
+
lines.append("")
|
|
1112
|
+
|
|
1113
|
+
lines.append("## Layer breakdown")
|
|
1114
|
+
lines.append("| layer | count | share |")
|
|
1115
|
+
lines.append("|---|---:|---:|")
|
|
1116
|
+
for layer, count in r["by_layer"].items():
|
|
1117
|
+
share = (count / r["total"]) if r["total"] else 0
|
|
1118
|
+
lines.append(f"| {layer} | {count} | {share:.1%} |")
|
|
1119
|
+
lines.append("")
|
|
1120
|
+
|
|
1121
|
+
if r["top_agents"]:
|
|
1122
|
+
lines.append("## Top dispatched agents")
|
|
1123
|
+
lines.append("| agent | dispatches |")
|
|
1124
|
+
lines.append("|---|---:|")
|
|
1125
|
+
for agent, count in r["top_agents"].items():
|
|
1126
|
+
lines.append(f"| {agent} | {count} |")
|
|
1127
|
+
|
|
1128
|
+
if r["logs_scanned"]:
|
|
1129
|
+
lines.append("")
|
|
1130
|
+
lines.append(f"_logs scanned: {len(r['logs_scanned'])}_")
|
|
1131
|
+
|
|
1132
|
+
return "\n".join(lines)
|
|
1133
|
+
|
|
1134
|
+
|
|
1135
|
+
# === task-25 B3: cross-repo harness diff =====================================
|
|
1136
|
+
#
|
|
1137
|
+
# `--compare <other-repo>` で他リポの `.claude/` と structural diff を取る。
|
|
1138
|
+
# 設計の前提:
|
|
1139
|
+
# - read-only (両 repo を absolute に書き換えない)
|
|
1140
|
+
# - 標準 library のみ (hashlib / os / pathlib)
|
|
1141
|
+
# - default で runtime-only file (state / cache / .gitignore'd marker) を除外
|
|
1142
|
+
#
|
|
1143
|
+
# 出力 mode:
|
|
1144
|
+
# summary (default): 件数 + 代表 file 列挙 (top 20)
|
|
1145
|
+
# detail: 全 file path を列挙 (大規模 diff 用)
|
|
1146
|
+
# json: machine-readable
|
|
1147
|
+
#
|
|
1148
|
+
# include filter:
|
|
1149
|
+
# {hooks,rules,skills,commands,templates,settings,all} default=all
|
|
1150
|
+
# all 以外を選んだ場合は `.claude/<category>/...` 配下のみ比較
|
|
1151
|
+
|
|
1152
|
+
# 比較対象から外す path pattern (runtime-only / state / cache)。
|
|
1153
|
+
# `.claude/<root>` からの相対 path で match する。
|
|
1154
|
+
_IGNORE_PATTERNS: tuple[str, ...] = (
|
|
1155
|
+
".session-help-shown", # SessionStart marker
|
|
1156
|
+
".workflow-state/", # workflow_guard state (SCHEMA.md 除く全 json/cleared)
|
|
1157
|
+
".gateguard-state/",
|
|
1158
|
+
".taskguard-state/",
|
|
1159
|
+
".failure-window/",
|
|
1160
|
+
".confidence-gate-state/",
|
|
1161
|
+
".compaction-state/",
|
|
1162
|
+
"logs/", # session logs
|
|
1163
|
+
".DS_Store", # macOS
|
|
1164
|
+
)
|
|
1165
|
+
|
|
1166
|
+
# `--compare-include` で許可される category と `.claude/` 配下 path の対応。
|
|
1167
|
+
_INCLUDE_MAP: dict[str, tuple[str, ...]] = {
|
|
1168
|
+
"hooks": ("hooks/",),
|
|
1169
|
+
"rules": ("rules/",),
|
|
1170
|
+
"skills": ("skills/",),
|
|
1171
|
+
"commands": ("commands/",),
|
|
1172
|
+
"templates": ("templates/",),
|
|
1173
|
+
"settings": ("settings.json", "settings.local.json", "harness-config.yml", "mode.yml"),
|
|
1174
|
+
"all": (), # 全 path
|
|
1175
|
+
}
|
|
1176
|
+
|
|
1177
|
+
|
|
1178
|
+
def _is_ignored_relpath(rel: str) -> bool:
|
|
1179
|
+
"""`.claude/` 相対 path が runtime-only path か判定。"""
|
|
1180
|
+
for pat in _IGNORE_PATTERNS:
|
|
1181
|
+
if pat.endswith("/"):
|
|
1182
|
+
if rel.startswith(pat):
|
|
1183
|
+
# SCHEMA.md / bypass.log.template / .gitignore は track 対象なので残す
|
|
1184
|
+
if rel.endswith("/SCHEMA.md") or rel.endswith("/bypass.log.template") or rel.endswith("/.gitignore"):
|
|
1185
|
+
return False
|
|
1186
|
+
return True
|
|
1187
|
+
else:
|
|
1188
|
+
if rel == pat or rel.endswith("/" + pat):
|
|
1189
|
+
return True
|
|
1190
|
+
return False
|
|
1191
|
+
|
|
1192
|
+
|
|
1193
|
+
def _is_included(rel: str, includes: set[str]) -> bool:
|
|
1194
|
+
"""`--compare-include` 指定された category に rel path が該当するか。"""
|
|
1195
|
+
if "all" in includes or not includes:
|
|
1196
|
+
return True
|
|
1197
|
+
for cat in includes:
|
|
1198
|
+
prefixes = _INCLUDE_MAP.get(cat, ())
|
|
1199
|
+
for pre in prefixes:
|
|
1200
|
+
if pre.endswith("/"):
|
|
1201
|
+
if rel.startswith(pre):
|
|
1202
|
+
return True
|
|
1203
|
+
else:
|
|
1204
|
+
if rel == pre:
|
|
1205
|
+
return True
|
|
1206
|
+
return False
|
|
1207
|
+
|
|
1208
|
+
|
|
1209
|
+
def _scan_claude_tree(claude_root: Path, includes: set[str]) -> dict[str, dict]:
|
|
1210
|
+
"""`<claude_root>/.claude/` 配下を再帰探索し file metadata dict を返す。
|
|
1211
|
+
|
|
1212
|
+
返り値: {rel_path: {sha256, size, mtime}}
|
|
1213
|
+
rel_path は `.claude/` を含まない (例: `hooks/observe.sh`)。
|
|
1214
|
+
"""
|
|
1215
|
+
out: dict[str, dict] = {}
|
|
1216
|
+
base = claude_root / ".claude"
|
|
1217
|
+
if not base.is_dir():
|
|
1218
|
+
return out
|
|
1219
|
+
for dirpath, dirnames, filenames in os.walk(base):
|
|
1220
|
+
# symlink loops / .git 系を念のため除外
|
|
1221
|
+
dirnames[:] = [d for d in dirnames if not d.startswith(".git")]
|
|
1222
|
+
for fn in filenames:
|
|
1223
|
+
full = Path(dirpath) / fn
|
|
1224
|
+
try:
|
|
1225
|
+
rel = str(full.relative_to(base))
|
|
1226
|
+
except ValueError:
|
|
1227
|
+
continue
|
|
1228
|
+
if _is_ignored_relpath(rel):
|
|
1229
|
+
continue
|
|
1230
|
+
if not _is_included(rel, includes):
|
|
1231
|
+
continue
|
|
1232
|
+
try:
|
|
1233
|
+
st = full.stat()
|
|
1234
|
+
# 大きすぎる file (>5MB) は size/mtime のみ、hash は skip
|
|
1235
|
+
if st.st_size > 5 * 1024 * 1024:
|
|
1236
|
+
h = "(skipped: large file)"
|
|
1237
|
+
else:
|
|
1238
|
+
h = hashlib.sha256(full.read_bytes()).hexdigest()
|
|
1239
|
+
except OSError:
|
|
1240
|
+
continue
|
|
1241
|
+
out[rel] = {
|
|
1242
|
+
"sha256": h,
|
|
1243
|
+
"size": st.st_size,
|
|
1244
|
+
"mtime": st.st_mtime,
|
|
1245
|
+
}
|
|
1246
|
+
return out
|
|
1247
|
+
|
|
1248
|
+
|
|
1249
|
+
def compare_harness(
|
|
1250
|
+
source_root: Path,
|
|
1251
|
+
target_root: Path,
|
|
1252
|
+
includes: set[str],
|
|
1253
|
+
) -> dict:
|
|
1254
|
+
"""source / target の `.claude/` を比較し structural diff dict を返す。
|
|
1255
|
+
|
|
1256
|
+
出力 key:
|
|
1257
|
+
source_path / target_path: 実 path (絶対)
|
|
1258
|
+
source_count / target_count / source_kb / target_kb
|
|
1259
|
+
missing_in_target: source のみに存在する file list
|
|
1260
|
+
missing_in_source: target のみに存在する file list
|
|
1261
|
+
content_drift: 両方に存在するが hash 不一致 (size / mtime delta 付き)
|
|
1262
|
+
clean: 両方に存在し hash 一致
|
|
1263
|
+
total_clean / total_drift / total_missing_target / total_missing_source
|
|
1264
|
+
"""
|
|
1265
|
+
src_files = _scan_claude_tree(source_root, includes)
|
|
1266
|
+
tgt_files = _scan_claude_tree(target_root, includes)
|
|
1267
|
+
|
|
1268
|
+
src_keys = set(src_files.keys())
|
|
1269
|
+
tgt_keys = set(tgt_files.keys())
|
|
1270
|
+
|
|
1271
|
+
missing_in_target = sorted(src_keys - tgt_keys)
|
|
1272
|
+
missing_in_source = sorted(tgt_keys - src_keys)
|
|
1273
|
+
common = sorted(src_keys & tgt_keys)
|
|
1274
|
+
|
|
1275
|
+
drift: list[dict] = []
|
|
1276
|
+
clean: list[str] = []
|
|
1277
|
+
for rel in common:
|
|
1278
|
+
s = src_files[rel]
|
|
1279
|
+
t = tgt_files[rel]
|
|
1280
|
+
if s["sha256"] != t["sha256"]:
|
|
1281
|
+
mtime_delta_sec = abs(s["mtime"] - t["mtime"])
|
|
1282
|
+
mtime_delta_days = round(mtime_delta_sec / 86400, 2)
|
|
1283
|
+
drift.append({
|
|
1284
|
+
"path": rel,
|
|
1285
|
+
"source_size": s["size"],
|
|
1286
|
+
"target_size": t["size"],
|
|
1287
|
+
"size_delta": t["size"] - s["size"],
|
|
1288
|
+
"mtime_delta_days": mtime_delta_days,
|
|
1289
|
+
})
|
|
1290
|
+
else:
|
|
1291
|
+
clean.append(rel)
|
|
1292
|
+
|
|
1293
|
+
src_kb = round(sum(f["size"] for f in src_files.values()) / 1024, 1)
|
|
1294
|
+
tgt_kb = round(sum(f["size"] for f in tgt_files.values()) / 1024, 1)
|
|
1295
|
+
|
|
1296
|
+
return {
|
|
1297
|
+
"source_path": str((source_root / ".claude").resolve()),
|
|
1298
|
+
"target_path": str((target_root / ".claude").resolve()),
|
|
1299
|
+
"source_count": len(src_files),
|
|
1300
|
+
"target_count": len(tgt_files),
|
|
1301
|
+
"source_kb": src_kb,
|
|
1302
|
+
"target_kb": tgt_kb,
|
|
1303
|
+
"includes": sorted(includes),
|
|
1304
|
+
"missing_in_target": missing_in_target,
|
|
1305
|
+
"missing_in_source": missing_in_source,
|
|
1306
|
+
"content_drift": drift,
|
|
1307
|
+
"clean": clean,
|
|
1308
|
+
"total_clean": len(clean),
|
|
1309
|
+
"total_drift": len(drift),
|
|
1310
|
+
"total_missing_target": len(missing_in_target),
|
|
1311
|
+
"total_missing_source": len(missing_in_source),
|
|
1312
|
+
}
|
|
1313
|
+
|
|
1314
|
+
|
|
1315
|
+
def fmt_compare(result: dict, fmt: str = "summary") -> str:
|
|
1316
|
+
"""compare_harness の result を human-readable markdown に format。"""
|
|
1317
|
+
lines: list[str] = []
|
|
1318
|
+
lines.append("[harness-audit --compare]")
|
|
1319
|
+
lines.append(
|
|
1320
|
+
f"Source: {result['source_path']} "
|
|
1321
|
+
f"({result['source_count']} files, {result['source_kb']} KB)"
|
|
1322
|
+
)
|
|
1323
|
+
lines.append(
|
|
1324
|
+
f"Target: {result['target_path']} "
|
|
1325
|
+
f"({result['target_count']} files, {result['target_kb']} KB)"
|
|
1326
|
+
)
|
|
1327
|
+
if result["includes"]:
|
|
1328
|
+
lines.append(f"Includes: {', '.join(result['includes'])}")
|
|
1329
|
+
lines.append("")
|
|
1330
|
+
|
|
1331
|
+
# default top 20、detail mode で全件表示
|
|
1332
|
+
list_limit = None if fmt == "detail" else 20
|
|
1333
|
+
|
|
1334
|
+
# Missing in target
|
|
1335
|
+
lines.append(f"## Missing in target (source only): {result['total_missing_target']} files")
|
|
1336
|
+
missing_t = result["missing_in_target"]
|
|
1337
|
+
shown = missing_t if list_limit is None else missing_t[:list_limit]
|
|
1338
|
+
for p in shown:
|
|
1339
|
+
lines.append(f" - .claude/{p}")
|
|
1340
|
+
if list_limit is not None and len(missing_t) > list_limit:
|
|
1341
|
+
lines.append(f" ... and {len(missing_t) - list_limit} more (use --compare-format detail)")
|
|
1342
|
+
lines.append("")
|
|
1343
|
+
|
|
1344
|
+
# Missing in source
|
|
1345
|
+
lines.append(f"## Missing in source (target only): {result['total_missing_source']} files")
|
|
1346
|
+
missing_s = result["missing_in_source"]
|
|
1347
|
+
shown = missing_s if list_limit is None else missing_s[:list_limit]
|
|
1348
|
+
for p in shown:
|
|
1349
|
+
lines.append(f" - .claude/{p}")
|
|
1350
|
+
if list_limit is not None and len(missing_s) > list_limit:
|
|
1351
|
+
lines.append(f" ... and {len(missing_s) - list_limit} more (use --compare-format detail)")
|
|
1352
|
+
lines.append("")
|
|
1353
|
+
|
|
1354
|
+
# Content drift
|
|
1355
|
+
lines.append(f"## Content drift (same path, different hash): {result['total_drift']} files")
|
|
1356
|
+
drift = result["content_drift"]
|
|
1357
|
+
shown_drift = drift if list_limit is None else drift[:list_limit]
|
|
1358
|
+
for d in shown_drift:
|
|
1359
|
+
delta = d["size_delta"]
|
|
1360
|
+
sign = "+" if delta >= 0 else ""
|
|
1361
|
+
lines.append(
|
|
1362
|
+
f" - .claude/{d['path']} "
|
|
1363
|
+
f"(source: {d['source_size']}B / target: {d['target_size']}B / "
|
|
1364
|
+
f"size delta: {sign}{delta}B / mtime delta: {d['mtime_delta_days']}d)"
|
|
1365
|
+
)
|
|
1366
|
+
if list_limit is not None and len(drift) > list_limit:
|
|
1367
|
+
lines.append(f" ... and {len(drift) - list_limit} more (use --compare-format detail)")
|
|
1368
|
+
lines.append("")
|
|
1369
|
+
|
|
1370
|
+
# Summary
|
|
1371
|
+
lines.append("## Summary")
|
|
1372
|
+
lines.append(f" - install.sh --update sync 推奨 file 数: {result['total_missing_target']} "
|
|
1373
|
+
"(missing in target が新規追加対象)")
|
|
1374
|
+
lines.append(f" - 真の drift (両 repo で独立進化): {result['total_drift']} (要 manual review)")
|
|
1375
|
+
lines.append(f" - clean: {result['total_clean']} files (両 repo identical)")
|
|
1376
|
+
|
|
1377
|
+
return "\n".join(lines)
|
|
1378
|
+
|
|
1379
|
+
|
|
1380
|
+
def main() -> int:
|
|
1381
|
+
ap = argparse.ArgumentParser()
|
|
1382
|
+
ap.add_argument("--json", action="store_true", help="出力を JSON にする")
|
|
1383
|
+
ap.add_argument("--window", type=int, default=100, help="観察ログの集計件数")
|
|
1384
|
+
ap.add_argument("--swe-bench", action="store_true", help="SWE-bench Lite leaderboard markdown のみ出力")
|
|
1385
|
+
ap.add_argument("--router", action="store_true", help="Agent-router dispatch.jsonl leaderboard markdown のみ出力")
|
|
1386
|
+
ap.add_argument("--router-homunculus-root", default=None, help="Override homunculus_root for the --router subcommand (mainly for tests)")
|
|
1387
|
+
# task-25 B3: cross-repo compare
|
|
1388
|
+
ap.add_argument(
|
|
1389
|
+
"--compare",
|
|
1390
|
+
action="append",
|
|
1391
|
+
default=None,
|
|
1392
|
+
help="他リポの .claude/ root と structural diff を取る (task-25 B3、複数指定可)",
|
|
1393
|
+
)
|
|
1394
|
+
ap.add_argument(
|
|
1395
|
+
"--compare-format",
|
|
1396
|
+
choices=["summary", "detail", "json"],
|
|
1397
|
+
default="summary",
|
|
1398
|
+
help="--compare の出力 format (default: summary)",
|
|
1399
|
+
)
|
|
1400
|
+
ap.add_argument(
|
|
1401
|
+
"--compare-include",
|
|
1402
|
+
action="append",
|
|
1403
|
+
choices=list(_INCLUDE_MAP.keys()),
|
|
1404
|
+
default=None,
|
|
1405
|
+
help="--compare の比較対象 category (default: all、複数指定可)",
|
|
1406
|
+
)
|
|
1407
|
+
ap.add_argument(
|
|
1408
|
+
"--compare-source",
|
|
1409
|
+
default=None,
|
|
1410
|
+
help="--compare の source root (default: cwd)",
|
|
1411
|
+
)
|
|
1412
|
+
# task-25 C2 / C3 toggles
|
|
1413
|
+
ap.add_argument(
|
|
1414
|
+
"--no-stale-drafts",
|
|
1415
|
+
action="store_true",
|
|
1416
|
+
help="stale draft (>=90 days unapproved) section を skip (task-25 C2)",
|
|
1417
|
+
)
|
|
1418
|
+
ap.add_argument(
|
|
1419
|
+
"--stale-drafts-threshold",
|
|
1420
|
+
type=int,
|
|
1421
|
+
default=90,
|
|
1422
|
+
help="stale draft 判定の閾値日数 (default: 90)",
|
|
1423
|
+
)
|
|
1424
|
+
ap.add_argument(
|
|
1425
|
+
"--no-settings-drift",
|
|
1426
|
+
action="store_true",
|
|
1427
|
+
help="settings.local.json drift section を skip (task-25 C3)",
|
|
1428
|
+
)
|
|
1429
|
+
args = ap.parse_args()
|
|
1430
|
+
|
|
1431
|
+
# --compare branch (task-25 B3)
|
|
1432
|
+
if args.compare:
|
|
1433
|
+
source_root = Path(args.compare_source).resolve() if args.compare_source else ROOT
|
|
1434
|
+
if not (source_root / ".claude").is_dir():
|
|
1435
|
+
print(
|
|
1436
|
+
f"error: source .claude/ not found at {source_root}/.claude",
|
|
1437
|
+
file=sys.stderr,
|
|
1438
|
+
)
|
|
1439
|
+
return 2
|
|
1440
|
+
|
|
1441
|
+
includes = set(args.compare_include) if args.compare_include else {"all"}
|
|
1442
|
+
results: list[dict] = []
|
|
1443
|
+
had_error = False
|
|
1444
|
+
for tgt_arg in args.compare:
|
|
1445
|
+
target_root = Path(tgt_arg).expanduser().resolve()
|
|
1446
|
+
if not target_root.exists():
|
|
1447
|
+
print(f"error: target path does not exist: {tgt_arg}", file=sys.stderr)
|
|
1448
|
+
had_error = True
|
|
1449
|
+
continue
|
|
1450
|
+
if not (target_root / ".claude").is_dir():
|
|
1451
|
+
print(
|
|
1452
|
+
f"error: target .claude/ not found at {target_root}/.claude",
|
|
1453
|
+
file=sys.stderr,
|
|
1454
|
+
)
|
|
1455
|
+
had_error = True
|
|
1456
|
+
continue
|
|
1457
|
+
results.append(compare_harness(source_root, target_root, includes))
|
|
1458
|
+
|
|
1459
|
+
if had_error and not results:
|
|
1460
|
+
return 2
|
|
1461
|
+
|
|
1462
|
+
# output
|
|
1463
|
+
if args.compare_format == "json" or args.json:
|
|
1464
|
+
payload = results[0] if len(results) == 1 else {"comparisons": results}
|
|
1465
|
+
print(json.dumps(payload, indent=2, ensure_ascii=False))
|
|
1466
|
+
else:
|
|
1467
|
+
for i, r in enumerate(results):
|
|
1468
|
+
if i > 0:
|
|
1469
|
+
print("")
|
|
1470
|
+
print("---")
|
|
1471
|
+
print("")
|
|
1472
|
+
print(fmt_compare(r, fmt=args.compare_format))
|
|
1473
|
+
return 0 if not had_error else 2
|
|
1474
|
+
|
|
1475
|
+
if args.router:
|
|
1476
|
+
rr = router_breakdown(
|
|
1477
|
+
homunculus_root=Path(args.router_homunculus_root) if args.router_homunculus_root else None,
|
|
1478
|
+
)
|
|
1479
|
+
if args.json:
|
|
1480
|
+
print(json.dumps(rr, indent=2, ensure_ascii=False))
|
|
1481
|
+
else:
|
|
1482
|
+
print(fmt_router(rr))
|
|
1483
|
+
return 0
|
|
1484
|
+
|
|
1485
|
+
if args.swe_bench:
|
|
1486
|
+
sb = swe_bench_breakdown()
|
|
1487
|
+
if args.json:
|
|
1488
|
+
print(json.dumps(sb, indent=2, ensure_ascii=False))
|
|
1489
|
+
else:
|
|
1490
|
+
print(fmt_swe_bench(sb))
|
|
1491
|
+
return 0
|
|
1492
|
+
|
|
1493
|
+
obs_path = find_observations()
|
|
1494
|
+
# task-32: tail_jsonl 返り値 dict 化に対応 (caller 1 箇所のみ修正)
|
|
1495
|
+
tj = tail_jsonl(obs_path, args.window) if obs_path else {
|
|
1496
|
+
"records": [],
|
|
1497
|
+
"skipped_lines": 0,
|
|
1498
|
+
"total_lines": 0,
|
|
1499
|
+
"cascade_suspected": False,
|
|
1500
|
+
"max_consecutive_skips": 0,
|
|
1501
|
+
}
|
|
1502
|
+
records = tj["records"]
|
|
1503
|
+
report = {
|
|
1504
|
+
"generated": datetime.now().isoformat(timespec="seconds"),
|
|
1505
|
+
"project_hash": project_hash(),
|
|
1506
|
+
"observations_path": str(obs_path) if obs_path else None,
|
|
1507
|
+
"window": args.window,
|
|
1508
|
+
"observations": summarize_observations(records),
|
|
1509
|
+
# task-32: observation pipeline 健全性指標
|
|
1510
|
+
"observation_health": {
|
|
1511
|
+
"skipped_lines": tj["skipped_lines"],
|
|
1512
|
+
"total_lines": tj["total_lines"],
|
|
1513
|
+
"cascade_suspected": tj["cascade_suspected"],
|
|
1514
|
+
"max_consecutive_skips": tj["max_consecutive_skips"],
|
|
1515
|
+
"cascade_threshold": _cascade_threshold(),
|
|
1516
|
+
},
|
|
1517
|
+
"gateguard": gateguard_breakdown(),
|
|
1518
|
+
"taskguard": count_state_dir(ROOT / _cfg("taskguard_state_dir")),
|
|
1519
|
+
"failure_window": failure_window_summary(),
|
|
1520
|
+
"confidence_gate": confidence_gate_breakdown(),
|
|
1521
|
+
"bypass_log": bypass_log_summary(),
|
|
1522
|
+
"swe_bench": swe_bench_breakdown(),
|
|
1523
|
+
"router": router_breakdown(),
|
|
1524
|
+
}
|
|
1525
|
+
# task-25 C2 / C3: opt-out flags
|
|
1526
|
+
if not args.no_stale_drafts:
|
|
1527
|
+
report["stale_drafts"] = stale_drafts_summary(threshold_days=args.stale_drafts_threshold)
|
|
1528
|
+
if not args.no_settings_drift:
|
|
1529
|
+
report["settings_drift"] = settings_drift_check()
|
|
1530
|
+
|
|
1531
|
+
if args.json:
|
|
1532
|
+
print(json.dumps(report, indent=2, ensure_ascii=False))
|
|
1533
|
+
else:
|
|
1534
|
+
print(fmt_human(report))
|
|
1535
|
+
sb = report["swe_bench"]
|
|
1536
|
+
if sb["total_runs"] > 0:
|
|
1537
|
+
print("")
|
|
1538
|
+
print(fmt_swe_bench(sb))
|
|
1539
|
+
rr = report["router"]
|
|
1540
|
+
if rr["total"] > 0:
|
|
1541
|
+
print("")
|
|
1542
|
+
print(fmt_router(rr))
|
|
1543
|
+
return 0
|
|
1544
|
+
|
|
1545
|
+
|
|
1546
|
+
if __name__ == "__main__":
|
|
1547
|
+
sys.exit(main())
|