Module: vvaharness/remediation_agent
Role. The repair crew. For each verified finding it proposes (and in fix mode applies) a minimal patch, gated by a deterministic policy, and writes a per-finding DTO.
Size. 60 files · ~5,410 LOC.
Once issues are confirmed, this package drafts the fix. It picks a repair strategy from a playbook keyed by weakness type + language + framework, asks the model for the smallest change that fixes the root cause, and — in fix mode — applies it. A deterministic policy gate decides what may be touched, reverts edits to forbidden paths, and honours an emergency kill-switch. Every finding gets a tidy folder (a DTO) recording the finding, the proposed change, a diff, and a status.
About the AI engine behind it. plugin_runner drives the model through DeepAgents
(see backends for what that is) rather than the simple ask-one-question
pattern the detection stages use — because proposing a fix means reading the surrounding
code, editing it, and checking the result, several steps in a row. This is the one place in
the entire pipeline where the AI is given write access to your files: it can Read, Glob,
Grep, Edit, and Write, but a shell (Bash) is never on the table, and every edit still has
to pass the deterministic policy gate before it counts as applied.
Explain-it-simply. A careful repair crew that only makes the smallest safe fix, follows a rulebook about what it's allowed to touch, and files paperwork for every job.
Data-flow (this module)
Technical details
remediate.py drives from an existing scan report; runner.py is the per-finding loop
(process_findings, remediate_one). discovery.py/report_parser/ locate and parse the scan's
Markdown/SARIF findings. select/ picks top-N by CVSS (pq.py, topspec.py). playbook.py
resolves the fix Strategy; prompts.py builds the model-agnostic system/user prompts.
plugin_runner/ runs the remediation method for one finding across backends (including DeepAgents
virtualization). Two gate layers: policy_gate/ is the deterministic eligibility gate
(allow/deny CWE, forbidden globs, diff cap) and policy/ wires the pre-gate/post-gate + on-disk
revert of forbidden-path edits, with a kill-switch. models/ defines the RemediationVerdict,
Change, and 3-Gates contract. artifacts/ writes the canonical remediate_report.json +
evidence/ (triage.json, summary.md, diff.patch), with git/synthetic diff capture under
artifacts/diff/. report_augment/ folds remediation results back into the combined MD+SARIF
report. interactive/ is the arrow-key finding picker for -i. frameworks.py detects language
and framework; rule_paths.py locates rule files across install layouts.
DeepAgents specifics for this stage.
plugin_runner::_invoke_deepagents()setscwd=repo(the real target, not a copy) and builds the tool list as everything configured minusBash(tools = tuple(t for t in _tools(cfg) if t != "Bash"),disallowed_tools=("Bash",)) — this is the only stage whose DeepAgents session can call Write/Edit. The model vendor formodels.remediateis chosen bydeepagents/options.py::build_model(): Anthropic ifprovider: anthropicor the model id contains "claude", OpenAI otherwise. Full mechanics, including the shared loop-budget constant: LLD §9.
File map (quick scan)
| File | LOC | Purpose |
|---|---|---|
remediation_agent/__init__.py |
43 | remediation_agent — remediation subpackage. |
remediation_agent/artifacts/__init__.py |
58 | remediation_agent.artifacts — render and persist a remediation verdict to disk. |
remediation_agent/artifacts/diff/__init__.py |
53 | remediation_agent.artifacts.diff — capture a scoped diff of the edited files. |
remediation_agent/artifacts/diff/gitcapture.py |
140 | remediation_agent.artifacts.diff.gitcapture — real git diff capture. |
remediation_agent/artifacts/diff/paths.py |
73 | remediation_agent.artifacts.diff.paths — repo-relative path normalisation + confinement. |
remediation_agent/artifacts/diff/snapshot.py |
57 | remediation_agent.artifacts.diff.snapshot — pre-edit file snapshots. |
remediation_agent/artifacts/diff/synth.py |
100 | remediation_agent.artifacts.diff.synth — synthesized unified diff for non-git targets. |
remediation_agent/artifacts/layout.py |
35 | remediation_agent.artifacts.layout — file/folder names and schema constants. |
remediation_agent/artifacts/report.py |
71 | remediation_agent.artifacts.report — assemble the canonical remediate_report.json. |
remediation_agent/artifacts/summary.py |
46 | remediation_agent.artifacts.summary — the human-readable summary.md renderer. |
remediation_agent/artifacts/validation.py |
37 | remediation_agent.artifacts.validation — the empty s11 validation block. |
remediation_agent/artifacts/writer.py |
92 | remediation_agent.artifacts.writer — orchestrate the per-finding on-disk layout. |
remediation_agent/discovery.py |
102 | remediation_agent.discovery — locate the scan report and select findings. |
remediation_agent/frameworks.py |
90 | remediation_agent.frameworks — per-file language + per-repo framework detection. |
remediation_agent/interactive/__init__.py |
48 | remediation_agent.interactive — arrow-key issue picker for vvaharness remediate -i. |
remediation_agent/interactive/keys.py |
75 | remediation_agent.interactive.keys — raw key input + decoding. |
remediation_agent/interactive/loop.py |
147 | remediation_agent.interactive.loop — the interactive remediation loops. |
remediation_agent/interactive/render.py |
92 | remediation_agent.interactive.render — menu rendering + selection parsing. |
remediation_agent/models/__init__.py |
34 | remediation_agent.models — the structured-output contract for one remediation. |
remediation_agent/models/change.py |
24 | remediation_agent.models.change — one edited-file record in a remediation verdict. |
remediation_agent/models/gates.py |
42 | remediation_agent.models.gates — the 3-gate evidence status block. |
remediation_agent/models/verdict.py |
100 | remediation_agent.models.verdict — the per-finding RemediationVerdict contract. |
remediation_agent/options.py |
70 | remediation_agent.options — parse the remediate command's CLI flags. |
remediation_agent/playbook.py |
154 | remediation_agent.playbook — fix-strategy resolver for the Remediation Agent. |
remediation_agent/plugin_runner/__init__.py |
330 | remediation_agent.plugin_runner — run the remediation method for one finding. |
remediation_agent/plugin_runner/helpers.py |
76 | remediation_agent.plugin_runner.helpers — tool list, prompt build, verdict coerce. |
remediation_agent/plugin_runner/run.py |
142 | remediation_agent.plugin_runner.run — the per-finding apply_plugin orchestration. |
remediation_agent/plugin_runner/trace.py |
68 | remediation_agent.plugin_runner.trace — --verbose stderr tracing helpers. |
remediation_agent/policy/__init__.py |
59 | remediation_agent.policy — wire the deterministic gate + playbook into the agent. |
remediation_agent/policy/context.py |
104 | remediation_agent.policy.context — load the gate + playbook once per run. |
remediation_agent/policy/decide.py |
84 | remediation_agent.policy.decide — the pre-gate (before any LLM call). |
remediation_agent/policy/postgate.py |
195 | remediation_agent.policy.postgate — enforce path policy on the generated diff. |
remediation_agent/policy/revert.py |
120 | remediation_agent.policy.revert — roll back forbidden-path edits on disk. |
remediation_agent/policy_gate/__init__.py |
63 | remediation_agent.policy_gate — deterministic eligibility gate. |
remediation_agent/policy_gate/action.py |
43 | remediation_agent.policy_gate.action — the gate decision value types. |
remediation_agent/policy_gate/diffscan.py |
76 | remediation_agent.policy_gate.diffscan — diff inspection + verdict capping. |
remediation_agent/policy_gate/gate.py |
133 | remediation_agent.policy_gate.gate — the deterministic eligibility gate. |
remediation_agent/policy_gate/loader.py |
100 | remediation_agent.policy_gate.loader — parse the shipped remediation_policy.yaml. |
remediation_agent/policy_gate/matching.py |
45 | remediation_agent.policy_gate.matching — glob matching helpers. |
remediation_agent/prompts.py |
137 | remediation_agent.prompts — the remediation method as model-agnostic prompt text. |
remediation_agent/remediate.py |
132 | remediation_agent.remediate — drive remediation from an existing scan report. |
remediation_agent/report_augment/__init__.py |
94 | Augment the combined SARIF + MD report with remediation results. |
remediation_agent/report_augment/dto.py |
158 | remediation_agent.report_augment.dto — load + classify the per-finding DTOs. |
remediation_agent/report_augment/locate.py |
85 | remediation_agent.report_augment.locate — locate + copy the scan report. |
remediation_agent/report_augment/markdown.py |
146 | remediation_agent.report_augment.markdown — add remediation sections to the MD copy. |
remediation_agent/report_augment/mdsafe.py |
67 | remediation_agent.report_augment.mdsafe — escape untrusted text for Markdown. |
remediation_agent/report_augment/sarif.py |
88 | remediation_agent.report_augment.sarif — add remediation blocks to the SARIF copy. |
remediation_agent/report_augment/summary.py |
59 | remediation_agent.report_augment.summary — the report-level ## Remediation Summary. |
remediation_agent/report_parser/__init__.py |
49 | remediation_agent.report_parser — locate and parse the Markdown reports a scan produced. |
remediation_agent/report_parser/field_sections.py |
72 | remediation_agent.report_parser.field_sections — regexes + section splitting. |
remediation_agent/report_parser/fields.py |
124 | remediation_agent.report_parser.fields — rich per-finding field extraction. |
remediation_agent/report_parser/finding.py |
53 | remediation_agent.report_parser.finding — the Finding dataclass. |
remediation_agent/report_parser/ids.py |
61 | remediation_agent.report_parser.ids — stable finding id + cheap CVSS extraction. |
remediation_agent/report_parser/locate.py |
48 | remediation_agent.report_parser.locate — artefact folder names and scan-report discovery. |
remediation_agent/report_parser/parse.py |
105 | remediation_agent.report_parser.parse — finding-header parsing and the done-marker. |
remediation_agent/rule_paths.py |
82 | Locate remediation rules across source, wheel, and user installs. |
remediation_agent/runner.py |
147 | remediation_agent.runner — the per-finding processing loop. |
remediation_agent/select/__init__.py |
49 | remediation_agent.select — shared "top N by CVSS" finding selection. |
remediation_agent/select/pq.py |
110 | remediation_agent.select.pq — the priority-queue "top N by CVSS" selector. |
remediation_agent/select/topspec.py |
123 | remediation_agent.select.topspec — parse + resolve the --top N cap. |
Files & functions, explained
Every class and function below has a one-line plain-English note — readable whether you write code or not. _name marks an internal helper.
remediation_agent/__init__.py
43 LOC. remediation_agent — remediation subpackage.
No top-level classes or functions (package init / constants).
remediation_agent/artifacts/__init__.py
58 LOC. remediation_agent.artifacts — render and persist a remediation verdict to disk.
No top-level classes or functions (package init / constants).
remediation_agent/artifacts/diff/__init__.py
53 LOC. remediation_agent.artifacts.diff — capture a scoped diff of the edited files.
No top-level classes or functions (package init / constants).
remediation_agent/artifacts/diff/gitcapture.py
140 LOC. remediation_agent.artifacts.diff.gitcapture — real git diff capture.
Functions
- changed_files_whole_tree() — Provides the “changed files whole tree” logic.
- capture_git_diff() — Checks / decides the version control code change step.
remediation_agent/artifacts/diff/paths.py
73 LOC. remediation_agent.artifacts.diff.paths — repo-relative path normalisation + confinement.
Functions
- _norm_path() — (internal helper) reads and cleans up the path value.
- _safe_repo_path() — (internal helper) Provides the “safe code repository path” logic.
remediation_agent/artifacts/diff/snapshot.py
57 LOC. remediation_agent.artifacts.diff.snapshot — pre-edit file snapshots.
Functions
- snapshot_files() — Provides the “snapshot files” logic.
remediation_agent/artifacts/diff/synth.py
100 LOC. remediation_agent.artifacts.diff.synth — synthesized unified diff for non-git targets.
Functions
- synth_unified_diff() — Builds / writes the unified code change step.
remediation_agent/artifacts/layout.py
35 LOC. remediation_agent.artifacts.layout — file/folder names and schema constants.
No top-level classes or functions (package init / constants).
remediation_agent/artifacts/report.py
71 LOC. remediation_agent.artifacts.report — assemble the canonical remediate_report.json.
Functions
- status_for() — Provides the “status for” logic.
- build_report() — Builds / writes the report value.
remediation_agent/artifacts/summary.py
46 LOC. remediation_agent.artifacts.summary — the human-readable summary.md renderer.
Functions
- render_summary() — Builds / writes the summary value.
remediation_agent/artifacts/validation.py
37 LOC. remediation_agent.artifacts.validation — the empty s11 validation block.
Functions
- empty_validation() — Provides the “empty fix-check” logic.
remediation_agent/artifacts/writer.py
92 LOC. remediation_agent.artifacts.writer — orchestrate the per-finding on-disk layout.
Functions
- write_verdict() — Builds / writes the pass/fail decision value.
remediation_agent/discovery.py
102 LOC. remediation_agent.discovery — locate the scan report and select findings.
Classes
- Layout — Represents the “Layout” data/behaviour used in this file.
Functions
- locate_report() — Looks up / reads the report value.
- cvss_score_of() — Provides the “severity score score of” logic.
- load_findings() — Looks up / reads the candidate issues value.
- prepare_layout() — Builds / writes the layout value.
remediation_agent/frameworks.py
90 LOC. remediation_agent.frameworks — per-file language + per-repo framework detection.
Functions
- language_for() — Provides the “language for” logic.
- detect_frameworks() — Looks up / reads the frameworks value.
remediation_agent/interactive/__init__.py
48 LOC. remediation_agent.interactive — arrow-key issue picker for vvaharness remediate -i.
No top-level classes or functions (package init / constants).
remediation_agent/interactive/keys.py
75 LOC. remediation_agent.interactive.keys — raw key input + decoding.
Functions
- decode_key() — Provides the “decode key” logic.
- _read_key() — (internal helper) looks up / reads the key value.
remediation_agent/interactive/loop.py
147 LOC. remediation_agent.interactive.loop — the interactive remediation loops.
Functions
- _remediate_one() — (internal helper) runs the one value.
- run_interactive() — Runs the interactive value.
- _loop_tty() — (internal helper) runs the tty value.
- _loop_prompt() — (internal helper) runs the prompt value.
remediation_agent/interactive/render.py
92 LOC. remediation_agent.interactive.render — menu rendering + selection parsing.
Functions
- render_rows() — Builds / writes the rows value.
- _clear_and_draw() — (internal helper) Provides the “clear and draw” logic.
- parse_selection() — Reads and cleans up the selection value.
remediation_agent/models/__init__.py
34 LOC. remediation_agent.models — the structured-output contract for one remediation.
No top-level classes or functions (package init / constants).
remediation_agent/models/change.py
24 LOC. remediation_agent.models.change — one edited-file record in a remediation verdict.
Classes
- Change — Represents the “Change” data/behaviour used in this file.
remediation_agent/models/gates.py
42 LOC. remediation_agent.models.gates — the 3-gate evidence status block.
Classes
- Gates — Represents the “rule checks” data/behaviour used in this file.
remediation_agent/models/verdict.py
100 LOC. remediation_agent.models.verdict — the per-finding RemediationVerdict contract.
Classes
- RemediationVerdict — Represents the “RemediationVerdict” data/behaviour used in this file.
- schema_json_compact() — Provides the “schema data file compact” logic.
- coerce() — Reads and cleans up the convert safely value.
remediation_agent/options.py
70 LOC. remediation_agent.options — parse the remediate command's CLI flags.
Classes
- RemediateOptions — Represents the “RemediateOptions” data/behaviour used in this file.
Functions
- parse_options() — Reads and cleans up the options value.
- _mode_from() — (internal helper) Provides the “mode from” logic.
remediation_agent/playbook.py
154 LOC. remediation_agent.playbook — fix-strategy resolver for the Remediation Agent.
Classes
- Strategy — Represents the “Strategy” data/behaviour used in this file.
- as_prompt_block() — Provides the “as prompt block” logic.
- Playbook — Represents the “fix strategies” data/behaviour used in this file.
- _load() — (internal helper) looks up / reads the load value.
- max_diff_lines() — Provides the “max code change lines” logic.
- max_files_touched() — Provides the “max files changed” logic.
- resolve() — Checks / decides the resolve value.
- guidance_for() — Provides the “guidance for” logic.
Functions
- _default_playbook_path() — (internal helper) Provides the “default fix strategies path” logic.
remediation_agent/plugin_runner/__init__.py
330 LOC. remediation_agent.plugin_runner — run the remediation method for one finding.
Functions
- _run_sync() — (internal helper) runs the sync value.
- _debug_log() — (internal helper) Provides the “debug log” logic.
- _terminal_stats() — (internal helper) Provides the “terminal stats” logic.
- _debug_terminal() — (internal helper) Provides the “debug terminal” logic.
- _report_recursion_limit() — (internal helper) builds / writes the loop-depth limit step.
- _verdict_extraction_prompt() — (internal helper) Provides the “pass/fail decision extraction prompt” logic.
- _extract_verdict_from_history() — (internal helper) reads and cleans up the pass/fail decision from history step.
- _attempt_extraction() — (internal helper) Provides the “attempt extraction” logic.
- _consume_deepagents() — (internal helper) runs the deepagents value.
- _virtualize_deepagents_prompt() — (internal helper) Provides the “virtualize deepagents prompt” logic.
- _invoke_deepagents() — (internal helper) runs the deepagents value.
- _invoke() — (internal helper) runs the invoke value.
remediation_agent/plugin_runner/helpers.py
76 LOC. remediation_agent.plugin_runner.helpers — tool list, prompt build, verdict coerce.
Functions
- _tools() — (internal helper) Provides the “tools” logic.
- _build_user() — (internal helper) builds / writes the user value.
- _coerce_verdict() — (internal helper) reads and cleans up the pass/fail decision value.
remediation_agent/plugin_runner/run.py
142 LOC. remediation_agent.plugin_runner.run — the per-finding apply_plugin orchestration.
Functions
- apply_plugin() — Runs the plugin value.
remediation_agent/plugin_runner/trace.py
68 LOC. remediation_agent.plugin_runner.trace — --verbose stderr tracing helpers.
Functions
- dump() — Builds / writes the dump value.
- dump_policy() — Builds / writes the rules value.
remediation_agent/policy/__init__.py
59 LOC. remediation_agent.policy — wire the deterministic gate + playbook into the agent.
No top-level classes or functions (package init / constants).
remediation_agent/policy/context.py
104 LOC. remediation_agent.policy.context — load the gate + playbook once per run.
Classes
- PolicyContext — Represents the “PolicyContext” data/behaviour used in this file.
Functions
- _sr() — (internal helper) Provides the “safe-read” logic.
- policy_enabled() — Provides the “rules enabled” logic.
- _resolve_input() — (internal helper) checks / decides the input value.
- build_context() — Builds / writes the context value.
remediation_agent/policy/decide.py
84 LOC. remediation_agent.policy.decide — the pre-gate (before any LLM call).
Classes
- PreResult — Represents the “PreResult” data/behaviour used in this file.
- allowed() — Provides the “allowed” logic.
Functions
- pre_decision() — Provides the “pre decision” logic.
- guidance_verdict() — Provides the “guidance pass/fail decision” logic.
remediation_agent/policy/postgate.py
195 LOC. remediation_agent.policy.postgate — enforce path policy on the generated diff.
Classes
- PostResult — Represents the “PostResult” data/behaviour used in this file.
Functions
- worktree_forbidden_matches() — Provides the “working copy forbidden matches” logic.
- _gates_ok() — (internal helper) checks / decides the ok value.
- enforce_post() — Provides the “enforce post” logic.
remediation_agent/policy/revert.py
120 LOC. remediation_agent.policy.revert — roll back forbidden-path edits on disk.
Functions
- _is_git_worktree() — (internal helper) checks / decides the version control working copy step.
- _is_tracked() — (internal helper) checks / decides the tracked value.
- _within_repo() — (internal helper) Provides the “within code repository” logic.
- revert_files() — Provides the “revert files” logic.
remediation_agent/policy_gate/__init__.py
63 LOC. remediation_agent.policy_gate — deterministic eligibility gate.
No top-level classes or functions (package init / constants).
remediation_agent/policy_gate/action.py
43 LOC. remediation_agent.policy_gate.action — the gate decision value types.
Classes
- Action — Represents the “Action” data/behaviour used in this file.
- Decision — Represents the “Decision” data/behaviour used in this file.
- may_generate_patch() — Provides the “may generate code change” logic.
remediation_agent/policy_gate/diffscan.py
76 LOC. remediation_agent.policy_gate.diffscan — diff inspection + verdict capping.
Functions
- inspect_diff() — Provides the “inspect code change” logic.
- cap_verdict() — Checks / decides the pass/fail decision value.
remediation_agent/policy_gate/gate.py
133 LOC. remediation_agent.policy_gate.gate — the deterministic eligibility gate.
Classes
- RemediationGate — Represents the “RemediationGate” data/behaviour used in this file.
- deny_paths() — Provides the “deny paths” logic.
- forbid_patch_paths() — Provides the “forbid code change paths” logic.
- decide() — Checks / decides the decide value.
- patch_touches_forbidden() — Provides the “code change touches forbidden” logic.
- changed_paths_hit_deny() — Provides the “changed paths hit deny” logic.
- forbidden_files() — Provides the “forbidden files” logic.
Functions
- _default_policy_path() — (internal helper) Provides the “default rules path” logic.
remediation_agent/policy_gate/loader.py
100 LOC. remediation_agent.policy_gate.loader — parse the shipped remediation_policy.yaml.
Classes
- PolicyData — Represents the “PolicyData” data/behaviour used in this file.
Functions
- _norm_cwe() — (internal helper) reads and cleans up the weakness type value.
- parse_policy() — Reads and cleans up the rules value.
remediation_agent/policy_gate/matching.py
45 LOC. remediation_agent.policy_gate.matching — glob matching helpers.
Functions
- _glob_match() — (internal helper) Provides the “file pattern match” logic.
- _first_match() — (internal helper) Provides the “first match” logic.
remediation_agent/prompts.py
137 LOC. remediation_agent.prompts — the remediation method as model-agnostic prompt text.
Functions
- build_system() — Builds / writes the system value.
- _policy_block() — (internal helper) Provides the “rules block” logic.
- build_user() — Builds / writes the user value.
remediation_agent/remediate.py
132 LOC. remediation_agent.remediate — drive remediation from an existing scan report.
Functions
- remediate() — Runs the fix value.
remediation_agent/report_augment/__init__.py
94 LOC. Augment the combined SARIF + MD report with remediation results.
Functions
- augment_reports() — Adds detail to the reports value.
- _augment() — (internal helper) adds detail to the augment value.
remediation_agent/report_augment/dto.py
158 LOC. remediation_agent.report_augment.dto — load + classify the per-finding DTOs.
Functions
- _skipped_dto() — (internal helper) Provides the “skipped per-finding fix record” logic.
- _load_dtos() — (internal helper) looks up / reads the dtos value.
- _load_triage() — (internal helper) looks up / reads the triage value.
- _status_and_reason() — (internal helper) Provides the “status and reason” logic.
- _finding_of() — (internal helper) looks up / reads the of value.
- _files_touched() — (internal helper) Provides the “files changed” logic.
- _remediation_block() — (internal helper) Provides the “fix block” logic.
remediation_agent/report_augment/locate.py
85 LOC. remediation_agent.report_augment.locate — locate + copy the scan report.
Functions
- _locate_scan_report() — (internal helper) looks up / reads the scan report step.
- _ensure_combined() — (internal helper) checks / decides the combined value.
remediation_agent/report_augment/markdown.py
146 LOC. remediation_agent.report_augment.markdown — add remediation sections to the MD copy.
Functions
- _md_remediation_section() — (internal helper) Provides the “Markdown report fix section” logic.
- _best_md_match() — (internal helper) Provides the “best Markdown report match” logic.
- _augment_md() — (internal helper) adds detail to the Markdown report value.
- _augment_segment() — (internal helper) adds detail to the segment value.
remediation_agent/report_augment/mdsafe.py
67 LOC. remediation_agent.report_augment.mdsafe — escape untrusted text for Markdown.
Functions
- _md_escape() — (internal helper) Provides the “Markdown report escape” logic.
- _md_code_span() — (internal helper) Provides the “Markdown report code span” logic.
remediation_agent/report_augment/sarif.py
88 LOC. remediation_agent.report_augment.sarif — add remediation blocks to the SARIF copy.
Functions
- _result_loc() — (internal helper) Provides the “result lines of code” logic.
- _match_by_loc() — (internal helper) checks / decides the by lines of code step.
- _match_by_title() — (internal helper) checks / decides the by title step.
- _match_sarif() — (internal helper) checks / decides the machine-readable report value.
- _augment_sarif() — (internal helper) adds detail to the machine-readable report value.
remediation_agent/report_augment/summary.py
59 LOC. remediation_agent.report_augment.summary — the report-level ## Remediation Summary.
Functions
- _summary_counts() — (internal helper) Provides the “summary counts” logic.
- _md_summary_section() — (internal helper) Provides the “Markdown report summary section” logic.
remediation_agent/report_parser/__init__.py
49 LOC. remediation_agent.report_parser — locate and parse the Markdown reports a scan produced.
No top-level classes or functions (package init / constants).
remediation_agent/report_parser/field_sections.py
72 LOC. remediation_agent.report_parser.field_sections — regexes + section splitting.
Functions
- _file_loc() — (internal helper) Provides the “file lines of code” logic.
- _sections() — (internal helper) Provides the “sections” logic.
- _first_code_block() — (internal helper) Provides the “first code block” logic.
remediation_agent/report_parser/fields.py
124 LOC. remediation_agent.report_parser.fields — rich per-finding field extraction.
Functions
- parse_finding_fields() — Reads and cleans up the candidate issue fields step.
remediation_agent/report_parser/finding.py
53 LOC. remediation_agent.report_parser.finding — the Finding dataclass.
Classes
- Finding — Represents the “candidate issue” data/behaviour used in this file.
- label() — Provides the “label” logic.
- slug() — Provides the “short name” logic.
remediation_agent/report_parser/ids.py
61 LOC. remediation_agent.report_parser.ids — stable finding id + cheap CVSS extraction.
Functions
- cvss_score_only() — Provides the “severity score score only” logic.
- finding_id() — Looks up / reads the identifier value.
remediation_agent/report_parser/locate.py
48 LOC. remediation_agent.report_parser.locate — artefact folder names and scan-report discovery.
Functions
- find_scan_dir() — Looks up / reads the scan dir step.
- latest_report() — Provides the “latest report” logic.
remediation_agent/report_parser/parse.py
105 LOC. remediation_agent.report_parser.parse — finding-header parsing and the done-marker.
Functions
- parse_findings() — Reads and cleans up the candidate issues value.
- mark_done() — Provides the “mark done” logic.
remediation_agent/rule_paths.py
82 LOC. Locate remediation rules across source, wheel, and user installs.
Functions
- settings_path() — Provides the “settings path” logic.
- configured_inputs_dir() — Sets up / maintains the inputs dir step.
- save_inputs_dir() — Builds / writes the inputs dir step.
- candidate_inputs_dirs() — Looks up / reads the inputs dirs step.
- locate_rule() — Looks up / reads the rule value.
- missing_rules() — Provides the “missing rules” logic.
- validate_inputs_dir() — Checks / decides the inputs dir step.
remediation_agent/runner.py
147 LOC. remediation_agent.runner — the per-finding processing loop.
Functions
- model_banner() — Provides the “model summary line” logic.
- _finding_identity() — (internal helper) looks up / reads the identity value.
- remediate_one() — Runs the one value.
- process_findings() — Runs the candidate issues value.
remediation_agent/select/__init__.py
49 LOC. remediation_agent.select — shared "top N by CVSS" finding selection.
No top-level classes or functions (package init / constants).
remediation_agent/select/pq.py
110 LOC. remediation_agent.select.pq — the priority-queue "top N by CVSS" selector.
Functions
- band_score() — Provides the “band score” logic.
- select_top_by_cvss() — Checks / decides the highest-priority by severity score step.
- select_top_logged() — Checks / decides the highest-priority logged step.
remediation_agent/select/topspec.py
123 LOC. remediation_agent.select.topspec — parse + resolve the --top N cap.
Functions
- _coerce_top_value() — (internal helper) reads and cleans up the highest-priority value step.
- parse_top_arg() — Reads and cleans up the highest-priority arg step.
- cfg_top_n_findings() — Provides the “code control-flow highest-priority n candidate issues” logic.
- resolve_top() — Checks / decides the highest-priority value.
See also: HLD · LLD · Data Flow · module index.