Skip to content

Add Computational Complexity Section to Scope Skill Output Template#695

Merged
Trecek merged 3 commits intointegrationfrom
scope-skill-add-computational-complexity-section-to-output-t/693
Apr 10, 2026
Merged

Add Computational Complexity Section to Scope Skill Output Template#695
Trecek merged 3 commits intointegrationfrom
scope-skill-add-computational-complexity-section-to-output-t/693

Conversation

@Trecek
Copy link
Copy Markdown
Collaborator

@Trecek Trecek commented Apr 10, 2026

Summary

Add a Computational Complexity section to the scope skill's output template in SKILL.md, positioned between the existing "Technical Context" and "Hypotheses" sections. The section contains 4 fields: Dominant operation, Scaling behavior, Known bottlenecks, and Gotchas. An instruction emphasizing baseline computation costs is added to the "Known bottlenecks" field. A corresponding subagent instruction is added to Step 1 so the scope workflow actively gathers complexity information. A contract test is added to validate the section's presence and field completeness.

Architecture Impact

Process Flow Diagram

%%{init: {'flowchart': {'nodeSpacing': 40, 'rankSpacing': 55, 'curve': 'basis'}}}%%
flowchart TB
    %% CLASS DEFINITIONS %%
    classDef terminal fill:#1a237e,stroke:#7986cb,stroke-width:2px,color:#fff;
    classDef stateNode fill:#004d40,stroke:#4db6ac,stroke-width:2px,color:#fff;
    classDef handler fill:#e65100,stroke:#ffb74d,stroke-width:2px,color:#fff;
    classDef phase fill:#6a1b9a,stroke:#ba68c8,stroke-width:2px,color:#fff;
    classDef newComponent fill:#2e7d32,stroke:#81c784,stroke-width:2px,color:#fff;
    classDef output fill:#00695c,stroke:#4db6ac,stroke-width:2px,color:#fff;
    classDef detector fill:#b71c1c,stroke:#ef5350,stroke-width:2px,color:#fff;

    %% TERMINALS %%
    START([START])
    COMPLETE([COMPLETE])

    subgraph Step0 ["Step 0 — Setup"]
        direction TB
        ParseArgs["Parse Args<br/>━━━━━━━━━━<br/>research_question from<br/>skill invocation args"]
        DetectIssue{"GitHub issue ref<br/>━━━━━━━━━━<br/>URL / owner/repo#N / #N?"}
        FetchIssue["fetch_github_issue<br/>━━━━━━━━━━<br/>include_comments: true<br/>issue body → primary question"]
        MkDir["mkdir -p<br/>━━━━━━━━━━<br/>.autoskillit/temp/scope/"]
    end

    subgraph Step1 ["● Step 1 — Parallel Exploration (Task tool, model: sonnet)"]
        direction LR
        SubA["Subagent A<br/>━━━━━━━━━━<br/>Prior Art Survey<br/>existing impls + tests"]
        SubB["Subagent B<br/>━━━━━━━━━━<br/>Technical Context<br/>modules, data structures"]
        SubC["Subagent C<br/>━━━━━━━━━━<br/>External Research<br/>web search, tools, papers"]
        SubD["Subagent D<br/>━━━━━━━━━━<br/>Metric Context<br/>src/metrics.rs, thresholds"]
        SubE["★ Subagent E<br/>━━━━━━━━━━<br/>Computational Complexity<br/>O(n²)/O(n log n) analysis<br/>bottlenecks + gotchas"]
    end

    subgraph Step2 ["● Step 2 — Synthesize Findings"]
        direction TB
        Consolidate["Consolidate Subagent Outputs<br/>━━━━━━━━━━<br/>structured scope report"]
        subgraph ReportSections ["Output Template Sections"]
            direction LR
            S1["Research Question"]
            S2["Known/Unknown Matrix"]
            S3["Prior Art in Codebase"]
            S4["External Research"]
            S5["Technical Context"]
            S6["● Computational Complexity<br/>━━━━━━━━━━<br/>Dominant op · Scaling<br/>Bottlenecks · Gotchas"]
            S7["Hypotheses"]
            S8["Proposed Directions"]
            S9["Success Criteria"]
            S10["Metric Context"]
        end
    end

    subgraph Step3 ["Step 3 — Write Output"]
        direction TB
        SaveReport["Save Scope Report<br/>━━━━━━━━━━<br/>.autoskillit/temp/scope/<br/>scope_{topic}_{timestamp}.md"]
        EmitToken["Emit Output Token<br/>━━━━━━━━━━<br/>scope_report = {abs_path}"]
    end

    subgraph ContractTests ["★ tests/contracts/test_scope_contracts.py"]
        direction TB
        T1["test_section_exists<br/>━━━━━━━━━━<br/>## Computational Complexity<br/>present in SKILL.md"]
        T2["test_field_present<br/>━━━━━━━━━━<br/>Dominant op / Scaling /<br/>Known bottlenecks / Gotchas<br/>(parametrized ×4)"]
        T3["test_section_between<br/>━━━━━━━━━━<br/>TC_idx < CC_idx < Hyp_idx<br/>ordering enforced"]
        T4["test_baseline_computation<br/>━━━━━━━━━━<br/>regex: baseline.*computation<br/>in Known bottlenecks"]
        T5["test_complexity_subagent<br/>━━━━━━━━━━<br/>regex: Subagent.*Complexity<br/>in Step 1 instructions"]
    end

    %% FLOW %%
    START --> ParseArgs
    ParseArgs --> DetectIssue
    DetectIssue -->|"yes — issue ref found"| FetchIssue
    DetectIssue -->|"no — plain text question"| MkDir
    FetchIssue -->|"issue body as primary question"| MkDir

    MkDir --> SubA & SubB & SubC & SubD & SubE

    SubA & SubB & SubC & SubD & SubE --> Consolidate
    Consolidate --> S1 & S2 & S3 & S4 & S5 & S6 & S7 & S8 & S9 & S10
    S1 & S2 & S3 & S4 & S5 & S6 & S7 & S8 & S9 & S10 --> SaveReport

    SaveReport --> EmitToken
    EmitToken --> COMPLETE

    %% Contract tests read SKILL.md statically — not part of runtime flow
    T1 & T2 & T3 & T4 & T5 -.->|"reads SKILL.md at test-time"| S6

    %% CLASS ASSIGNMENTS %%
    class START,COMPLETE terminal;
    class ParseArgs,MkDir handler;
    class DetectIssue stateNode;
    class FetchIssue handler;
    class SubA,SubB,SubC,SubD phase;
    class SubE newComponent;
    class Consolidate phase;
    class S1,S2,S3,S4,S5,S7,S8,S9,S10 output;
    class S6 newComponent;
    class T1,T2,T3,T4,T5 detector;
Loading

Scenarios Diagram

%%{init: {'flowchart': {'nodeSpacing': 40, 'rankSpacing': 55, 'curve': 'basis'}}}%%
flowchart LR
    %% CLASS DEFINITIONS %%
    classDef cli fill:#1a237e,stroke:#7986cb,stroke-width:2px,color:#fff;
    classDef stateNode fill:#004d40,stroke:#4db6ac,stroke-width:2px,color:#fff;
    classDef handler fill:#e65100,stroke:#ffb74d,stroke-width:2px,color:#fff;
    classDef phase fill:#6a1b9a,stroke:#ba68c8,stroke-width:2px,color:#fff;
    classDef newComponent fill:#2e7d32,stroke:#81c784,stroke-width:2px,color:#fff;
    classDef output fill:#00695c,stroke:#4db6ac,stroke-width:2px,color:#fff;
    classDef detector fill:#b71c1c,stroke:#ef5350,stroke-width:2px,color:#fff;

    subgraph S1 ["SCENARIO 1: Scope Skill Happy Path"]
        direction LR
        S1_CLI["● scope/SKILL.md<br/>━━━━━━━━━━<br/>/autoskillit:scope {question}"]
        S1_ISSUE{"GitHub issue<br/>reference?"}
        S1_FETCH["fetch_github_issue<br/>━━━━━━━━━━<br/>include_comments: true"]
        S1_PARALLEL["Step 1: Parallel Subagents<br/>━━━━━━━━━━<br/>Task tool, model: sonnet"]
        S1_A["Subagent A<br/>━━━━━━━━━━<br/>Prior Art Survey"]
        S1_B["Subagent B<br/>━━━━━━━━━━<br/>Technical Context"]
        S1_C["Subagent C<br/>━━━━━━━━━━<br/>External Research"]
        S1_D["Subagent D<br/>━━━━━━━━━━<br/>Metric Context"]
        S1_E["★ Subagent E<br/>━━━━━━━━━━<br/>Computational Complexity<br/>(dominant op, scaling,<br/>bottlenecks, gotchas)"]
        S1_SYNTH["Step 2: Synthesize Findings<br/>━━━━━━━━━━<br/>Consolidate all subagents"]
        S1_OUT["scope report .md<br/>━━━━━━━━━━<br/>.autoskillit/temp/scope/"]
    end

    subgraph S2 ["SCENARIO 2: Contract Test Validation"]
        direction LR
        S2_PYTEST["pytest<br/>━━━━━━━━━━<br/>task test-check"]
        S2_TEST["★ test_scope_contracts.py<br/>━━━━━━━━━━<br/>TestComputationalComplexitySection"]
        S2_READ["_read_scope_skill_md()<br/>━━━━━━━━━━<br/>pkg_root() / skills_extended/scope/SKILL.md"]
        S2_CHECK1["test_section_exists<br/>━━━━━━━━━━<br/>## Computational Complexity in content"]
        S2_CHECK2["test_field_present<br/>━━━━━━━━━━<br/>Dominant op · Scaling ·<br/>Bottlenecks · Gotchas"]
        S2_CHECK3["test_section_between_...<br/>━━━━━━━━━━<br/>Tech Context &lt; CC &lt; Hypotheses"]
        S2_CHECK4["test_baseline_computation<br/>━━━━━━━━━━<br/>re.search baseline.*computation"]
        S2_CHECK5["test_complexity_subagent<br/>━━━━━━━━━━<br/>re.search Subagent.*Complexity"]
        S2_PASS["CI Green<br/>━━━━━━━━━━<br/>All 6 assertions pass"]
    end

    subgraph S3 ["SCENARIO 3: Report Output Structure"]
        direction LR
        S3_SYNTH["Synthesize step<br/>━━━━━━━━━━<br/>Consolidate subagent findings"]
        S3_TC["## Technical Context<br/>━━━━━━━━━━<br/>Architecture, modules, data flow"]
        S3_CC["● ## Computational Complexity<br/>━━━━━━━━━━<br/>Dominant operation<br/>Scaling behavior<br/>Known bottlenecks (+ baseline)<br/>Gotchas"]
        S3_HYP["## Hypotheses<br/>━━━━━━━━━━<br/>Falsifiable claims"]
        S3_FILE["scope_{topic}_{timestamp}.md<br/>━━━━━━━━━━<br/>Emits: scope_report = {abs_path}"]
    end

    %% SCENARIO 1 FLOW %%
    S1_CLI --> S1_ISSUE
    S1_ISSUE -- "yes" --> S1_FETCH
    S1_ISSUE -- "no" --> S1_PARALLEL
    S1_FETCH --> S1_PARALLEL
    S1_PARALLEL --> S1_A & S1_B & S1_C & S1_D & S1_E
    S1_A & S1_B & S1_C & S1_D & S1_E --> S1_SYNTH
    S1_SYNTH --> S1_OUT

    %% SCENARIO 2 FLOW %%
    S2_PYTEST --> S2_TEST
    S2_TEST --> S2_READ
    S2_READ --> S2_CHECK1 & S2_CHECK2 & S2_CHECK3 & S2_CHECK4 & S2_CHECK5
    S2_CHECK1 & S2_CHECK2 & S2_CHECK3 & S2_CHECK4 & S2_CHECK5 --> S2_PASS

    %% SCENARIO 3 FLOW %%
    S3_SYNTH --> S3_TC --> S3_CC --> S3_HYP --> S3_FILE

    %% CLASS ASSIGNMENTS %%
    class S1_CLI,S2_PYTEST stateNode;
    class S1_ISSUE detector;
    class S1_FETCH handler;
    class S1_PARALLEL,S1_SYNTH,S3_SYNTH phase;
    class S1_A,S1_B,S1_C,S1_D handler;
    class S1_E newComponent;
    class S1_OUT,S3_FILE output;
    class S2_TEST newComponent;
    class S2_READ,S2_CHECK1,S2_CHECK2,S2_CHECK3,S2_CHECK4,S2_CHECK5 handler;
    class S2_PASS output;
    class S3_TC handler;
    class S3_CC newComponent;
    class S3_HYP,S3_TC handler;
Loading

Closes #693

Implementation Plan

Plan file: /home/talon/projects/autoskillit-runs/impl-20260409-182034-729139/.autoskillit/temp/make-plan/scope_skill_computational_complexity_plan_2026-04-09_182600.md

🤖 Generated with Claude Code via AutoSkillit

Token Usage Summary

Step uncached output cache_read cache_write count time
plan 64 8.0k 855.8k 55.8k 1 5m 18s
verify 42 6.4k 533.0k 32.6k 1 4m 14s
implement 158 5.6k 667.9k 48.4k 1 2m 1s
prepare_pr 68 3.7k 211.6k 22.2k 1 1m 23s
run_arch_lenses 122 9.7k 392.9k 60.3k 2 3m 26s
compose_pr 67 6.6k 237.2k 27.8k 1 1m 48s
Total 521 40.0k 2.9M 247.0k 18m 13s

…late

Add Subagent E (Computational Complexity) to the minimum required subagents
in Step 1 and a new ## Computational Complexity section (Dominant operation,
Scaling behavior, Known bottlenecks, Gotchas) between Technical Context and
Hypotheses in the Step 2 output template. Add contract tests in
tests/contracts/test_scope_contracts.py validating section presence, field
completeness, ordering, baseline instruction, and subagent instruction.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Comment thread tests/contracts/test_scope_contracts.py
Comment thread tests/contracts/test_scope_contracts.py
from autoskillit.core import pkg_root


def _read_scope_skill_md() -> str:
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[info] tests: _read_scope_skill_md() is called independently in every test method and parametrized case (7+ disk reads of the same immutable file). A class-level @pytest.fixture(scope='class') would eliminate redundant I/O with no functional change.

Copy link
Copy Markdown
Collaborator Author

@Trecek Trecek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AutoSkillit review found 2 blocking issues. See inline comments.

Trecek added 2 commits April 9, 2026 19:12
…tion slice

Assert fields are present within the slice between '## Computational Complexity'
and '## Hypotheses', not against the full file text.
…re body content

Replace single-line pattern with re.DOTALL match requiring Subagent heading AND
'dominant operation' in the body, preventing false pass on a bare heading alone.
@Trecek Trecek added this pull request to the merge queue Apr 10, 2026
Merged via the queue into integration with commit 5991a7c Apr 10, 2026
2 checks passed
@Trecek Trecek deleted the scope-skill-add-computational-complexity-section-to-output-t/693 branch April 10, 2026 02:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant