Files
Open_Ultra_SAST/.kiro/specs/hunter-learning-loop/tasks.md
T
Marius CiepluchandClaude Fable 5.2 1a9865496b spec: nine specs superseded, their needed tasks carried to the three lines
hunter-learning-loop gets group 7 (the driver on the trace), search-with-proof
group 7 (proof on the driver's suspects, shown to the developer), pre-push-safety-net
task 18, and engine-change-scoped-analysis the carried engine work. Superseded specs
keep their directory with a notice. The breadth ledger follows.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
2026-11-30 09:22:35 +01:00

13 KiB

Implementation Plan

  • 1. Foundation: the feature table and its producers

  • 1.1 Create the feature table with a versioned column schema, masks and digests

    • One row per candidate location (change, path, line) with key, label, feature, provenance and fold columns
    • Rows read and write as JSONL and parquet; a table digest covers rows and schema version
    • A mask drops named feature columns and is recorded with the table it was applied to
    • Done when a round-trip test shows the same digest after write and read, and a masked table lists its mask
    • Requirements: 3.1, 3.5, 4.2, 5.1
  • 1.2 Produce the four existing annotations from the repository only (P)

    • Diff hunks at head with on-changed-line and distance; enclosing function, span, callers, entry points from the source facts; roles, def-use and obligations from the semantic facts; the closed family list with one-line definitions
    • An annotation a producer cannot compute is recorded as absent with a reason, never defaulted
    • Done when a fixture repository yields every column, and a repository with a planted advisory id and a security-worded commit message yields no feature carrying either
    • Requirements: 3.2, 3.3, 3.4, 3.7, 3.8
    • Boundary: producers
  • 1.3 Label the rows by the benchmark's rule (P)

    • Fix-site rows of positives label 1 with the change's family and fix span; ordinary-push rows label 0; other rows on a positive label null and are excluded from scoring
    • Each positive row carries the verification record reference next to the label; a row whose source cannot be traced is rejected
    • Done when a fixture manifest with one positive and two ordinary pushes produces the expected labels and the null rows are excluded
    • Requirements: 1.1, 1.2, 1.3, 1.4, 1.5, 1.6
    • Boundary: FeatureTable, training_set.py
  • 1.4 Install the research extra and pin the program runtime

    • Optional dependency group for the loop with the program runtime and the table library, pinned to a minor version; the core install stays unchanged
    • Done when the extra installs into the research environment and the core test suite collects without it
    • Requirements: 5.1, 9.5
  • 2. Core: the hunter as a program

  • 2.1 Define the hunt signature and the program with the three repository tools

    • Inputs are the rendered unmasked feature columns plus the hunks; the output is the classifier's answer structure with a family from the closed list and cited lines inside the shown text
    • The tool loop is bounded by the run budget; an answer outside the vocabulary or citing unseen lines is recorded unknown
    • Done when a scripted model drives the program through the tools on a fixture and the parsed findings match the fixture's expectation
    • Requirements: 3.5, 3.6, 5.1, 5.2, 5.4
  • 2.2 Score a change: the search metric with feedback (P)

    • A suspicion within the scorer's tolerance of the fix site with the right family counts as a hit; ordinary-push suspicions are counted per push; the feedback text names the missed site or the off-diff suspicions
    • Done when the metric reproduces the pilot's hit list for the 12 positives from their recorded suspicions
    • Requirements: 1.4, 4.3, 7.1, 7.2
    • Boundary: search_metric
  • 2.3 Record a run as a content-addressed artifact (P)

    • Program id, schema version, mask, data digests, every scored configuration, spend, calls, replay hits, wall time, library versions; the saved program and its cache directory travel with it
    • A run that exhausts its budget writes no artifact and reports the spend so far
    • Done when two identical runs produce the same artifact id and a budget-exhausted run leaves only the partial report
    • Requirements: 5.1, 5.2, 5.3, 5.5, 9.1, 9.2, 9.5
    • Boundary: RunArtifact
  • 3. Integration: the runner and the baseline

  • 3.1 Run the program through the existing hunter-arm runner

    • The runner takes a program artifact and a mask, computes the table rows for each change at head, renders the inputs, runs the program and writes the same record shape as today, resumable by change id, input digest, program id and mask
    • The pilot manifest is refused by digest unless the run is explicitly a pilot report run
    • Done when a run over a five-change fixture manifest with the scripted model writes records the existing scorer accepts
    • Requirements: 2.4, 8.4, 9.3, 9.4
  • 3.2 Prove the plumbing: baseline program on the 12 pilot positives

    • The baseline instruction equals today's hunter prompt plus the hunks; one live, budgeted run over the 12 positives only, as a pilot report run
    • Done when the search metric over the new records is compared with the pilot's recorded hunter hits and the difference is explained in the measurement record
    • Requirements: 8.1, 8.4, 8.5, 8.6
    • Depends: 2.2, 2.3
  • 4. Core: the training set, folds and ablation

  • 4.1 Source the training set apart from the pilot

    • About one hundred advisories through the fix-site catalog and verifier, pilot repositories excluded, at least 40 accepted positives across two languages, 20 ordinary pushes per positive from the same repositories; the sourcing run is recorded
    • Done when the frozen training manifest lists its positives, negatives, languages and the pilot exclusion check
    • Requirements: 2.1, 2.2, 2.3
  • 4.2 Fold by repository and audit every annotation for leaks

    • Compile folds and held-out folds by repository group; the leak audit runs over every feature column and reports any that separates positives from negatives on its own
    • Done when the folds are disjoint by repository and the audit report lists each column with its separation score
    • Requirements: 2.5, 2.6
  • 4.3 Register and run a paired ablation

    • A manifest fixes the table digest, the masks, the folds, the metric, the sample size, the budget and the decision rule before anything runs; each arm runs over the same changes with the same program and sampling
    • Results per arm carry the paired effect on search recall and suspicions per ordinary push, per family and pooled, with intervals from the repository-clustered bootstrap and a paired test
    • Done when an ablation over a fixture manifest with the scripted model yields two arms, the paired statistics, and the full recall-against-suspicions curve
    • Requirements: 4.1, 4.2, 4.3, 4.7, 4.8
  • 4.4 Build the importance table and apply the keep/drop rule

    • For every annotation, its effect when removed from the full set and when added to the baseline, with intervals and counts; an annotation stays only on a held-out effect whose interval excludes zero or when a kept annotation needs it; one that raises suspicions without raising recall is dropped and recorded
    • Done when the table is written for a fixture ablation and the rule's decisions match the fixture's expectations
    • Requirements: 4.4, 4.5, 4.6
  • 4.5 Contamination check

    • A training repository later found in the pilot or in a benchmark report marks every run that used it as contaminated and excludes those runs from any gain
    • Done when a fixture run is marked contaminated after its repository is added to a report list
    • Requirements: 2.7
  • 5. Core: proposals and acceptance

  • 5.1 Propose candidates with the program runtime's optimisers

    • One change per round: an instruction proposal, a demonstration set, or a mask; proposals score on compile folds with the search metric; the proposer never sees held-out results; rejected candidates stay visible to the next round
    • Done when a round on a fixture produces a candidate with its compile-fold score and the proposer's inputs are shown to exclude held-out data
    • Requirements: 5.4, 6.6, 6.8
  • 5.2 Accept or reject by the rule

    • Compile-fold and held-out results per family; accepted only when both are non-negative, one strictly positive, no family below its regression budget, instruction under the length cap; ties rejected; the comparison is recorded in the new artifact
    • Done when every clause of the rule has a synthetic fold-result test that flips the decision
    • Requirements: 5.6, 6.1, 6.2, 6.3, 6.4, 6.5, 6.7
  • 6. Validation: the pilot gain

  • 6.1 Run an accepted program once over the held-out pilot and report the gain

    • Same scorer and metrics as the pilot; before-and-after of search recall, suspicions per push, push-level recall, false alarms per 100 and precision, per family, with intervals; the proof arm's workload per 100 pushes; the gate distance read off the curve; the run recorded next to the pilot's measurement, at most once per accepted program
    • Done when the measurement record exists with the before-and-after table and the instrument proof for every change
    • Requirements: 7.3, 7.4, 7.5, 8.1, 8.2, 8.3, 8.6

Amendment of 2026-11-30: the driver on the trace (roadmap line 1)

Maintainer decision of 2026-11-30 (.kiro/steering/roadmap.md, top section): "for me it's prio that the driver (augmented by abstract interpreation and wrapped into probablistic dspy loops) finds bugs I want to avoid". This spec is the driver's spec and is active again. The correction of 2026-10-14 is narrowed: the driver may be compiled on compile folds of training repositories; admission and evaluation populations never train; software shape features alone decide nothing. Tasks 4.1 and 6 stay open as written. Group 7 is new. Requirements and design do not yet say this: run /kiro-spec-requirements hunter-learning-loop and /kiro-spec-design hunter-learning-loop for the amendment before group 7 is implemented beyond 7.1 and 7.2, which only measure what exists.

  • 7. The driver reads the abstract interpretation and runs as a probabilistic DSPy loop
  • 7.1 Put the trace into the driver's input
    • The prover's ordered trace for a changed location (entry, request-derived arguments with provenance, the protected operation, the guards and whether one dominates) and the engine's facts for it become one annotation of HuntProgram, beside the diff hunk; a location with no trace says so with its cause, and is not dropped
    • Done when the driver runs on a fixture change with and without the annotation and the record shows the trace bytes it was given, nonzero
    • Carried from: reachability-flow-model 4.1 (path context for the hunter)
  • 7.2 Baseline: the driver with and without the trace on the training pool (roadmap N1)
    • Same changes, same program and same sampling for both arms over benchmarks/valid/train/pool-train.toml, through the paired ablation of 4.3; search recall and suspicions per ordinary push, per family and pooled, with intervals; the record proves nonzero input for every change
    • Paid: needs the maintainer's spend ceiling before it starts
    • Done when the measurement record exists under benchmarks/measurements/ in the fixed schema of detection-quality.md rule 3
    • Depends: 7.1
  • 7.3 Sample the driver and score by agreement
    • Each question is asked k times; a location's score is the share of samples that name it; k, the temperature and the model version are fixed in the manifest before the run; the score orders suspects and never establishes a defect
    • Report top-K recall per push (K = 1, 3, 5) of the true vulnerable function among the changed functions
    • Done when a fixture run with the scripted model yields the scores, and the top-K metric is reported beside search recall
    • Carried from: learned-decision-engine 17.1, 17.2 (the triage objective)
  • 7.4 Compile the loop on training repositories (roadmap N3)
    • The proposer of 5.1 and the acceptance rule of 5.2 over the training set of 4.1; instructions and demonstrations only, chosen on compile folds, never on held-out folds or an admission population
    • Every accepted program passes the reversed-pair probe of src/openultrasast/core/probes.py before any admission read; a program that separates reversed fixes by diff shape is rejected and recorded
    • Done when one accepted or rejected candidate exists with its compile-fold and held-out results and its probe result
    • Carried from: learned-decision-engine 16 (the jointly optimised LLM program)
    • Depends: 4.1, 7.2, 7.3
  • 7.5 The driver judges intent and raises no evidence
    • Where the trace shows an operation with no dominating check, the driver says whether the entry is meant to be open, as a ranked opinion; it cannot turn a suspect into a finding. A finding needs the trace's own rule or a demonstration
    • Done when a test shows a driver opinion changes the order of suspects and never their evidence class
    • Carried from: authorization-obligations 3.3
  • 7.6 Hand the top suspects to the proof arm
    • The top-K suspects of a push go to search-with-proof as starting intents, with the trace; the record carries the proof arm's workload per 100 pushes
    • Done when one training-pool change runs driver to search on a fixture executor and the handoff record names the suspect, the trace digest and the search outcome
    • Depends: 7.3; search-with-proof 7.1

Folded into 4.1 from contributor-scan 5.2: the training set holds vibe-code pairs, and at least one of them as a whole repository. The maintainer named them on 2026-11-30: the families are access control and path traversal; the repositories are AI-written web applications, Express/TypeScript and FastAPI/Python. This narrows 4.1's "two languages" to TypeScript and Python. The spend ceiling for 7.2 is 10 USD.