This directory contains a local AI coding agent CLI. The project focuses on the engineering harness around coding agents: scoped file access, command permissions, skill loading, planning, structured trace, evidence cache, context compression, project instructions, repository mapping, and session recovery.
Run commands from this project directory:
cd D:\Code\agent_learning\ai_coding_agent
python aicoding.py config inspectaicoding.py: CLI entry point.aicoding_app/: application code.skills/: task-specificSKILL.mdfiles loaded byload_skill.runtime/: generated sessions, traces, and logs.tests/: automated tests.
flowchart TD
A["CLI task or chat turn"] --> B["Session restore"]
B --> C["Harness context"]
C --> D["Skill inventory"]
D --> E["LangGraph agent or deterministic fallback"]
E --> F["Tools: list/search/read/apply_patch/run_command"]
F --> G["Permission policy"]
F --> H["Evidence cache"]
F --> I["Structured trace"]
E --> J["Final answer with diff and validation"]
J --> K["Session save"]
Inspect public configuration without printing secrets:
python aicoding.py config inspectRun one task:
python aicoding.py run --workspace . --task "replace 'old' with 'new' in app.py"Run a read-only analysis:
python aicoding.py ask --workspace . --task "explain the project layout"Create a structured plan without editing files:
python aicoding.py plan --workspace . --task "add tests for permissions"Run a focused edit task with the same plan-before-edit safety gate:
python aicoding.py edit --workspace . --task "replace 'old' with 'new' in app.py"Run the staged agent loop with trace state transitions:
python aicoding.py agent --workspace . --task "replace 'old' with 'new' in app.py"Run the agent loop with conservative pytest auto-repair:
python aicoding.py agent --workspace . --task "fix failing tests"Start a multi-turn session:
python aicoding.py chat --workspace . --session-id demoResume a saved session:
python aicoding.py resume --session-id demoShow structured trace:
python aicoding.py trace show --session-id demoServe the local multi-turn Web UI:
python aicoding.py trace serve --open
python aicoding.py trace serve --session-id demo --port 8765Print repository intelligence:
python aicoding.py dev repo map --workspace .Explain a symbol, file, or pytest failure with repository intelligence:
python aicoding.py dev context explain --workspace . --query "CodingAgent"
python aicoding.py dev context explain --workspace . --query "aicoding_app/agent.py"
python aicoding.py dev context explain --workspace . --query "FAILED tests/test_agent.py::test_agent - AssertionError"Run one allowed validation command:
python aicoding.py dev verify --workspace . --validation-command "python -m pytest tests"Print a local git engineering summary:
python aicoding.py dev git summary --workspace .Manage local engineering memory:
python aicoding.py dev memory add --kind command --text "Run python -m pytest tests before PR"
python aicoding.py dev memory inspect
python aicoding.py dev memory forget --id mem-12345678Create a dry-run schedule plan:
python aicoding.py dev schedule plan --workspace . --task "run pytest weekly" --cadence weeklyDry-run an eval suite:
python aicoding.py dev eval run --workspace . --suite tests/fixtures/eval_suite.jsonList connector placeholders:
python aicoding.py dev connectors listCheck or clean text hygiene after model edits:
python aicoding.py dev text check --workspace .
python aicoding.py dev text clean --workspace .- Skill loading: the agent sees a short inventory and loads full instructions only when relevant.
- Planning: edits require a recorded plan before
apply_patchcan mutate files. - Structured trace: model calls, tool calls, patch application, command results, and final responses are written as JSONL.
- Multi-turn Web UI:
webstarts a local-only browser UI for user-facing coding conversations. It restores saved session history, keeps follow-up turns on the same session id, supportsask,plan,edit, andagent, and keeps trace/tool details in a side inspector. Submitted workspaces must be the project root or a directory underruntime/.trace serveremains available as a compatibility alias for the same local server. - Evidence cache: file reads, searches, commands, patches, and skills are cached as summaries for later turns.
- Context compression: session context preserves the current plan, recent turns, project instructions, repository map, cached evidence, and latest diff within a token budget.
- Permission policy: file operations are scoped to
--workspace, and commands must match the configurable whitelist. - Project instructions:
AGENTS.mdand.aicoding/AGENTS.mdare loaded into context when present. - Repository map: file inventory, dependency files, test roots, Python symbols,
and imports are available through
repo mapand therepo_maptool. - Context explain: symbols, files, imports, reverse imports, source/test
relationships, and pytest failure output can be explained through
context explainand theexplain_contexttool. - Patch preview:
preview_patchvalidates paths and hunk matches without modifying files. - Validation:
verifyandrun_validationrun only whitelisted commands and attach pytest failure context when available. - Auto repair loop:
agentcan run pytest, parse failures, apply a narrow deterministic repair for simple assertion/return-value mismatches, and re-run validation. It does not weaken tests or attempt broad rewrites. - Git summary:
git summary,git_commit_preview, and PR-ready summaries help prepare a local change for review. They do not commit, push, or create PRs. - Hooks:
.aicoding/config.tomlcan defineafter_verifyhooks; Phase 3 only previews whether they are allowed by policy and does not execute them. - Memory:
memory add/inspect/forgetstores local engineering facts inruntime/memory.jsonand rejects text that looks like secrets. - Schedule planning:
schedule planproduces a dry-run plan only; it does not register a Windows task or run anything in the background. - Eval harness:
eval runreads a JSON suite and prints a dry-run summary; it does not call models, edit files, or run validation commands. - Connectors:
connectors listreports disabled/read-only GitHub/MCP placeholders. No external API calls are made. - Text hygiene:
text checkreports non-ASCII characters without modifying files;text cleanapplies conservative replacements for common mojibake and typographic punctuation.
Copy .env.example to .env and configure an OpenAI-compatible endpoint:
AICODING_MODEL_API_KEY=<provider-api-key>
AICODING_MODEL_API_BASE=https://api.deepseek.com
AICODING_MODEL_NAME=deepseek-v4-flashWithout a configured model, the CLI still supports deterministic demo edits:
create <path> with "content"set <path> to "content"append "content" to <path>replace "old" with "new" in <path>
python -m pytest tests
python -m ruff check .
python -m pyright