FirstCoder
A runnable local Python coding agent whose loop, tools, permissions and compaction stay readable end to end.
- Source repo
- KomorGiaoGiao/FirstCoder
- Stars
- ★ 246
- Last updated
- today
- FARS reviewed
- Dec 02, 2026
- License
- MIT
- Primary language
- Python
- FA score
- 61/100 · Some gaps
At a glance
- Works with
- Universal · cross-platformOpenAI API · Claude API
- You'll need
- Typical use
- Developers who want to learn how a coding agent is assembled, reading module by module alongside
docs/ARCHITECTURE.mdanddocs/CODEBASE_READING_GUIDE.md. - Main limitation
- The OpenAI Responses API is not used yet, and Anthropic-only extras such as prompt caching remain optional future work.
- Website
- komorgiaogiao.github.io/FirstCoder ↗ set on GitHub
- Maintenance
- Commits in the last 30 dayslast commit 2026-12-02
- Source review
- 61/100 · Some gaps
What does this agent do, and when should you use it?
FirstCoder is an MIT-licensed local coding agent in Python, roughly 25k lines across 174 files under firstcoder/, built so the agent loop, tool calling, permission prompts, sessions and context compaction stay visible instead of hidden behind a black box. Its main interface is a Textual TUI that renders streamed assistant output, tool calls, tool results and permission prompts in one place; the same binary also supports one-shot --message runs and a line-oriented --interactive mode. Mutating tools (write, edit, apply_patch, delete) are gated behind a unified diff review with red removals, green additions and per-file statistics, plus a pre-dispatch snapshot recheck that blocks stale operations. On the model side it pairs an OpenAI Chat Completions-compatible path with a native Anthropic Messages adapter, both implementing the same complete/streaming contract: text deltas, tool-call accumulation, forced tool_choice, usage reporting and PROMPT_TOO_LONG-style error classification. The repository ships pytest coverage and one Harbor evaluation integration, and its docs split architecture, a codebase reading guide, multimodal input design and MCP client configuration.
You launch firstcoder, type a request, and the TUI streams the provider's response while showing each tool call and its result. When the model wants to run write, edit, apply_patch or delete, FirstCoder renders a trusted unified diff (red removals, green additions, per-file stats, bounded expansion) before anything touches disk; in standard mode you approve, deny, or answer reject: <feedback> so the model revises the proposal. Just before dispatch it rechecks the reviewed file snapshots and blocks stale operations — a guard, not a filesystem-level atomic transaction. In bypass mode the review is a non-blocking event and the operation proceeds; the Harbor adapter disables that event for non-interactive task turns. Shell commands follow the permission policy of the active mode, since arbitrary command effects cannot be precomputed safely. Sessions persist and can be resumed, long contexts go through compaction, and the model can be switched at runtime; an optional task_boundary_classifier_model fixes a separate profile for hidden task-boundary requests, capped at 512 output tokens and falling back to a conservative uncertain decision on failure. Config is handled by firstcoder config init, config path and config show, with secrets read only from environment variables and never printed by config show.
- Developers who want to learn how a coding agent is assembled, reading module by module alongside
docs/ARCHITECTURE.mdanddocs/CODEBASE_READING_GUIDE.md. - Engineers building a portfolio or interview-ready project on top of a ~25k-line Python base they can actually explain end to end.
- Individual developers doing daily local edits who want a full diff shown before every file mutation, approving each one or replying
reject: <feedback>. - Teams pointing the agent at their own OpenAI-compatible gateway by configuring
[providers.*]and[models.*]in TOML, then switching with--model provider/modelor TUI/model. - Researchers studying context compaction and long-prompt handling, watching the compaction path and
PROMPT_TOO_LONGclassification in practice. - Teams needing one non-interactive coding turn inside a pipeline, using
firstcoder --messageor the pattern inbenchmark/harbor.
Key setup facts
Pulled from the install and usage notes below. The project README has the current values.
- Install / run
pipx install firstcoder
- Environment variables
FIRSTCODER_API_KEYYURENAPI_API_KEY- Config files
~/.config/firstcoder/config.toml./firstcoder.toml- Runtime
- Python 3.11+
How do you install or deploy this agent?
Install with pipx and prepare a config:
pipx install firstcoderCreate a starter config and inspect it:
firstcoder config init
firstcoder config path
firstcoder config showKeep the secret in an environment variable (config show never prints it):
export FIRSTCODER_API_KEY="your-api-key"Default locations are the global ~/.config/firstcoder/config.toml and the project-level ./firstcoder.toml, with project values merged over global ones. A provider/model profile looks like this:
default_model = "yuren/gpt-5.6-terra"
[providers.yuren]
type = "openai-compatible"
base_url = "https://yurenapi.cn/v1"
api_key_env = "YURENAPI_API_KEY"
[models."yuren/gpt-5.6-terra"]
label = "Yuren Terra"
context_window = 128000
[models."yuren/gpt-5.6-terra".request]
temperature = 0.2
max_tokens = 8192
reasoning_effort = "high"
extra_body = { reasoning_summary = "auto" }To work from source with dev dependencies:
python -m venv .venv
.venv/bin/python -m pip install -e ".[dev]"Runtime needs Python 3.11+ and credentials for either an OpenAI Chat Completions-compatible endpoint or the Anthropic Messages API.
How do you use this agent?
Start the TUI:
firstcoderRun a single message without the TUI:
firstcoder --message "Summarize this repository in one paragraph"Use line-oriented interactive mode:
firstcoder --interactivePick the initial model profile for a run:
firstcoder --model provider/modelInside the TUI, /models opens the configured model picker and /model provider/model switches immediately.
Run the test suite or a focused file:
.venv/bin/python -m pytest
.venv/bin/python -m pytest tests/test_app_tui.py -qSafety boundaries, hardening & integrations
Operational blast radius, source-verified safety controls, and first-run hardening steps before connecting this agent to real workspaces.
Declared capability surface (blast radius)
Can run terminal commands; pair with approval gates or container/OS sandboxing.
Modifies local files; work on a clean Git branch or dedicated worktree.
Makes outbound requests; verify telemetry settings and model data routing on private repos.
What are this agent's strengths and limitations?
- File mutations are preceded by a unified diff with red removals, green additions and per-file stats, plus a pre-dispatch snapshot recheck that blocks stale operations.
- The OpenAI-compatible path and the native Anthropic Messages adapter share one complete/streaming contract (text deltas, tool-call accumulation, forced
tool_choice, usage,PROMPT_TOO_LONGclassification), so swapping providers does not rewrite the upper layers. - Scope stays inspectable: ~25k lines and 174 files under
firstcoder/, backed by an ARCHITECTURE doc and a codebase reading guide. - Verification is concrete, with a pytest suite and one Harbor evaluation integration rather than demo-only code.
- Short path to first run:
pipx install firstcoder, then TUI,--messageor--interactive.
- The OpenAI Responses API is not used yet, and Anthropic-only extras such as prompt caching remain optional future work.
- An external provider key is mandatory; no local-model or fully offline execution path is documented.
- Feature surface is intentionally smaller than platforms like OpenCode, so broader product-style workflows are out of scope.
- The snapshot recheck is a guard, not a filesystem-level atomic transaction, so real concurrent-write risk remains.
- Requires Python 3.11+ and a terminal; no GUI or editor extension is provided.
How does this agent compare with similar options?
Key facts side by side with the most closely related agents.
| Agent | Source review | Form / cost | Stars | Updated | Language | Full support on |
|---|---|---|---|---|---|---|
| FirstCoder This agent | 61 · Some gaps | — | ★ 246 | today | Python | OpenAI API · Claude API |
| Build AI Agents from First Principles | 58 · Major gaps | FrameworkFree + model costs | ★ 403 | 28d ago | Python | OpenAI API · Claude API |
| Autono | 43 · Major gaps | Library / SDKFree + model costs | ★ 214 | 5mo ago | Python | OpenAI API |
| rpi: Rust Coding-Agent Runtime | 71 · Some gaps | CLIFree + model costs | ★ 343 | 1d ago | Rust | OpenAI API · Claude API |
How does FollowAgents rate this agent?
Why each dimension lost points
The bilingual permissions design doc lays out a program-side enforcement chain (ToolPermissionSpec -> PermissionRequest -> PermissionManager -> ALLOW/ASK/DENY -> registry) plus a trusted prewrite diff and snapshot recheck for direct file mutations, which is adequate for ordinary use, so least_privilege/user_confirmation/external_effects score 2. Full marks are withheld because bypass mode, --auto-approve and --benchmark (bypass permissions) are explicit loosening paths, and shell is deliberately excluded from pre-computed review. data_flow_transparency and sensitive_data_handling score 2: `config show` is documented never to print keys, secrets live in env vars, and .env.harbor must stay git-ignored, but this is documentation only — no redaction code is visible in the packet. dependency_security scores 1: every dependency except mcp is unpinned, with no lockfile, audit or update automation. rollback scores 1: only a stale-snapshot guard exists, the docs themselves say it is not a filesystem-level atomic transaction, and there is no undo of applied changes. source_attribution scores 1: the MIT LICENSE names the copyright holder, but there is no third-party attribution and pyproject declares no license field.
self_consistency scores 2: README, AGENTS.md, docs and pyproject agree on module layout, test commands and version 0.1.12, with no visible contradiction; the '~25k lines / 174 files' scale claims cannot be checked from the sampled packet. dependency_availability scores 2: dependencies are mainstream PyPI packages, requires-python>=3.11, mcp is bounded, and the install path is clear; deducted because most dependencies are unpinned, weakening long-term reproducibility. failure_messages scores 2: cli.py prints `error: ...` to stderr with non-zero exit codes, and docs mention PROMPT_TOO_LONG-style classification plus an `uncertain` fallback for classifier failures; the sampled cli.py is truncated, so not every error path is confirmed.
audience_and_scenarios scores 2: the README names learners, extenders and interview-preparation users and contrasts the project with OpenCode and tutorial repos, though the scenarios read as positioning rather than concrete playbooks. capability_boundaries scores 2: it states it does not use the OpenAI Responses API, that Anthropic prompt caching is future work, that shell effects cannot be precomputed, and that bypass is not removal of code paths. trigger_precision scores 2: CLI subcommands (config/mcp), --model, --message, --interactive, --tui, --attachment and a separate task_boundary_classifier_model are well defined; ambiguity handling is not further documented. environment_fit scores 2: pipx install, global plus project TOML config, and TUI/REPL/single-turn modes fit local development, but coverage is limited to Python 3.11+ and OpenAI-compatible/Anthropic providers.
information_architecture scores 2: a docs index, modular directories (agent/app/context/providers/tools/permissions/session) and an AGENTS.md structure section are clear. install_notes scores 2: pipx install, a dev venv with `pip install -e ".[dev]"`, and config init/path/show are all documented. naming_stability scores 2: package name firstcoder, entry point firstcoder.cli:main and version 0.1.12 are consistent. examples_and_faq scores 2: quickstart, config samples, a permissions debugging checklist and test commands exist, but there is no standalone FAQ. known_limitations scores 2: the comparison table, the non-atomic caveat, the missing Responses API and bypass semantics are stated. license scores 2: a full MIT LICENSE file is present; deducted because pyproject declares no license field, so metadata and file are not fully aligned. versioning_changelog scores 1: a version number and a tag-triggered PyPI workflow exist, but there is no CHANGELOG. maintenance_responsibility scores 1: only a single author is named, the publisher is unverified by the FollowAgents registry, and there is no CONTRIBUTING/SECURITY or maintainer commitment file; AGENTS.md covers only commit and PR habits.
output_usability scores 2: the TUI surfaces streamed output, tool calls, diffs and permission prompts, with session persistence and resume, which is usable day to day; no execution evidence is in the packet. marginal_value scores 2: it positions itself as a readable local Python coding-agent reference, differentiated from large platforms, with clear value for study and extension, though the teaching-agent niche is crowded. cost_benefit scores 2: a comparatively small codebase, local operation and bring-your-own API key keep learning and modification cheap, but unpinned dependencies and no changelog add long-term uncertainty.
claim_traceability scores 2: benchmark claims point to a specific run directory (benchmark/runs/harbor/aider-polyglot-feedback-retry-20260726/...) with instructions to read its README first, and test commands name concrete test files; the benchmark numbers are self-reported and the raw result files are not in the packet. cross_source_corroboration scores 2: README, AGENTS.md, the permissions design docs and pyproject corroborate module structure, test commands and the permission chain. fact_inference_separation scores 2: the docs separate guarantees from 'guard, not atomic transaction' and split reward=0, RewardFileNotFoundError, network errors and verifier timeouts into distinct categories; deducted for promotional phrasing such as 'real, runnable' that carries no supporting evidence in the packet.
- Publisher identity is unverified by the FollowAgents registry; the repository names a single author and ships no SECURITY/CONTRIBUTING or maintainer commitment file, so the long-term maintenance and update path is uncertain.
- Loosening paths exist: bypass permission mode, --auto-approve, and --benchmark (bypass permissions). In non-interactive or automated use, file mutations and shell commands may run without human confirmation.
- All dependencies except mcp are unpinned, with no lockfile or dependency audit, so installs may drift over time.
- Rollback is limited: only a prewrite snapshot recheck blocks stale overwrites, the docs state it is not a filesystem-level atomic transaction, and applied changes have no undo mechanism.
- Benchmark figures such as the 96.38% Aider Polyglot result are self-reported; the raw result files are not part of this packet and should not be treated as independently verified.
- This is a static source review and cli.py is truncated in the packet; the actual permission, tool-execution and provider-adapter implementations are not fully visible, so confidence is low.
Thanks — we use this to improve the page.
Subscribe to the FollowAgents RSS feed, or save this agent to your browser shortlist to compare on your next visit.