A terminal-native controlled patch pipeline for proposing, inspecting, validating, and safely applying code changes.
Aegis Code is a safety/control layer around AI-assisted patch generation. It is designed to:
- generate proposal diffs
- validate and inspect patches
- attempt conservative repair for specific malformed diffs
- block unsafe or invalid patches
- require explicit human confirmation before file mutation
- optionally verify with tests after apply
Aegis Code is not:
- an autonomous coding agent
- a replacement for developer review
- a blind patch applier
- a guarantee that every generated patch is correct
- Generate a proposal (no file mutation):
aegis-code "fix failing tests" --propose-patch- Inspect the latest diff:
aegis-code diff
aegis-code diff --stat
aegis-code diff --full- Run apply check:
aegis-code apply --check- Apply only with explicit confirmation:
aegis-code apply --confirm- Apply and run tests:
aegis-code apply --confirm --run-testsInstall (dev):
pip install -e .Initialize project files:
aegis-code initSetup readiness check:
aegis-code setup --checkRefresh and inspect local runtime context:
aegis-code context refresh
aegis-code context showPropose + inspect + check + apply:
aegis-code "triage current test failures" --propose-patch
aegis-code diff
aegis-code apply --check
aegis-code apply --confirm --run-tests- Proposal-first: generation is proposal-only.
- No silent apply:
--confirmis required for mutation. - Accepted vs invalid diffs:
- accepted diff:
.aegis/runs/latest.diff - invalid diff:
.aegis/runs/latest.invalid.diff
- accepted diff:
aegis-code diffpreferslatest.diff; if missing, it showslatest.invalid.diffwith a BLOCKED warning.- Apply safety scoring is written to run metadata:
HIGH,MEDIUM,LOW,BLOCKED
apply --checkandapply --confirmgate on latest run safety forlatest.diff:LOWandBLOCKEDare blocked.
- Hard-invalid guards block placeholder/truncation content and destructive rewrites.
- Destructive rewrite protection includes tests/docs-focused guards.
- No git commands are run by Aegis Code.
- Stale diff cleanup: task runs clear prior
latest.diff/latest.invalid.diffbefore new generation.
Use bounded test-fix workflow:
aegis-code fix
aegis-code fix --confirm
aegis-code fix --confirm --max-cycles 2Behavior:
fixwithout--confirmis non-mutating.fix --confirmonly applies accepted diffs withHIGH/MEDIUMsafety.- Stops early on repeated failure signatures to avoid loops.
- For simple single-test pytest assertion mismatches, Aegis Code can use a deterministic micro-fix (single assertion update) instead of provider generation.
- Deterministic micro-fixes still go through diff/check metadata and safety gating.
Project and status:
aegis-code init
aegis-code setup
aegis-code setup --check
aegis-code status
aegis-code report
aegis-code compare
aegis-code overview
aegis-code nextRuntime/task:
aegis-code "<task>"
aegis-code "<task>" --dry-run
aegis-code "<task>" --propose-patchDiff/apply/fix:
aegis-code diff
aegis-code diff --stat
aegis-code diff --full
aegis-code apply --check
aegis-code apply --check <path>
aegis-code apply --confirm
aegis-code apply --confirm <path>
aegis-code apply --confirm --run-tests
aegis-code fix
aegis-code fix --confirm --max-cycles 2Context/budget/policy:
aegis-code context refresh
aegis-code context show
aegis-code budget set 1.00
aegis-code budget status
aegis-code budget clear
aegis-code policy statusWorkspace:
aegis-code workspace init
aegis-code workspace add <path>
aegis-code workspace remove <path>
aegis-code workspace status
aegis-code workspace status --detailed
aegis-code workspace overview
aegis-code workspace refresh-context
aegis-code workspace run "<task>" --dry-run
aegis-code workspace run "<task>" --confirmAegis Code supports project and global key management via aegis-code keys.
- project scope: stored for current project
- global scope: reusable across projects/workspaces
Examples:
aegis-code keys status
aegis-code keys list
aegis-code keys set OPENAI_API_KEY --project
aegis-code keys set OPENAI_API_KEY --global
aegis-code keys clear OPENAI_API_KEY --projectWorkspace operations reuse each project's local config, context, and runtime controls.
Budget in Aegis Code is a runtime control signal for behavior (for example mode selection and control policy), not a real billing/cost tracker.
- Python-first workflow today.
- Provider output quality can vary.
- Complex semantic fixes may still block or require task refinement/manual edits.
- Node/JS support is planned but not complete.
pip install -e .
aegis-code init
aegis-code setup --check
aegis-code context refresh
# run a proposal-producing task
aegis-code "fix failing tests" --propose-patch
# inspect proposal
aegis-code diff --stat
aegis-code diff
# validate apply safety
aegis-code apply --check
# apply with explicit confirmation + test verification
aegis-code apply --confirm --run-testsIf latest patch is invalid/blocked, inspect raw provider diff:
aegis-code diff --full- Command reference:
docs/commands.md - Apply check:
docs/apply_check.md - Apply confirm:
docs/apply_confirm.md - Workspace:
docs/workspace.md - Providers and keys:
docs/providers.md - Create workflow:
docs/create.md - Demo workflow:
docs/demo_workflow.md