Fix analyze-report misdetecting Strategic Overviews as AI Strategy#147
Merged
Conversation
Report-type detection keyed on the substring "ai strategy" appearing anywhere in the body, so a 23-section Strategic Overview that merely discussed a company's AI strategy was classified as ai_strategy and graded against the wrong template's required sections (Current State / Recommendations / Implementation), failing the skill's own QA gate for a contract-compliant report. - _detect_report_type now uses the filename first, then a section-structure fingerprint (distinctive Strategic Overview vs AI Strategy headings), and only falls back to legacy content phrases when there is no structural signal. - report-contract.md documents the exact citation format the gate scores (inline [cite: N] markers + a ## Sources appendix) with a worked example, so an agent following the contract also passes analyze-report. Mirrors re-synced. - Add regression tests: an overview mentioning "AI strategy" with a non-conforming filename detects as strategic_overview; an AI Strategy doc detects by sections.
# Conflicts: # docs/CHANGELOG.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes a self-inflicted QA-gate bug surfaced by primr-zero testing: an agent that follows the skill's own
report-contract.md(a 23-section Strategic Overview) could be failed by the skill's ownprimr --analyze-reportgate.Root cause:
_detect_report_typeclassified the report asai_strategywhenever the substring "ai strategy" appeared anywhere in the body — so a Strategic Overview that merely discusses a company's AI strategy was graded against the AI-strategy template's required sections (Current State/Recommendations/Implementation), none of which are in the 23-section contract. Detection was also filename-fragile, which is exactly why a host-written report with a non-conforming filename tripped it.Changes
_detect_report_typenow uses the filename first, then classifies by which template's distinctive##headings are present (Products and Services / SWOT / Porter's / Strategic Positioning … vs Executive Decision Brief / Opportunity Inventory / Board Decision …). It only consults the legacy content phrases when there is no structural signal.report-contract.md(primr-zero skill) now spells out the exact format the gate scores — inline[cite: N]markers + a## Sourcesappendix — with a worked example, so a contract-compliant report also passesanalyze-report. Mirrors re-synced.strategic_overview; an AI Strategy doc detects by its sections.Testing
tests/test_qa/+tests/test_primr_zero_skill.py: 461 passed (including the new regression tests and the skill-mirror sync check). ruff clean.Independent of #146 (branched off
main).