Repository navigation
g023 Code — Release 1.3.4
Version: 1.3.4
Date: 2026-09-14
Supersedes: 1.3.2 (and the earlier 1.3.3 cut of 2026-08-21)
Artifacts: g023-code-1.3.4.tar.gz, g023-code-1.3.4.zip, unpacked tree in g023-code-1.3.4/
Pure-Python DeepSeek V4 powered coding agent. Subagent-First architecture,
terminal-native UI built on rich + prompt_toolkit. One model, one
endpoint: deepseek-flash on POST /responses. 421 tests, all
passing, none of them on the network.
This recut replaces the 2026-08-21 1.3.3 artifacts. Those archives
shipped deepseek-v4-flash, tiktoken, a 147-test suite, and a
partial installer config.json. The program in this folder is the
current one.
1.3.4 (2026-09-14 recut)
The theme is still money — knowing what the API costs before, while,
and after you spend it — plus everything measured since the August cut
about how that money actually moves.
Model identity — deepseek-flash
Every DeepSeek call sends deepseek-flash: orchestrator, FileReader's
LLM path, nested Agent, /g023-compact, DeepSeek vision. /model
accepts the alias flash. Retired ids (deepseek-v4-flash,
deepseek-v4-flash-vision-exp) coerce on load. deepseek-v4-pro is
still withheld: /responses has not enabled it.
Thinking is a 0–100 dial, default and ceiling 75 (wire high).
max / 100 / xhigh cap to 75. Off is reasoning: {"effort": "none"}.
What we measured (2026-09-10 sheet, 2026-09-14 probes)
Pinned by tests or the published sheet; the rest is labelled.
- Off-peak Flash: hit $0.003/M, miss $0.15/M (~50×), output
$0.60/M (~200× a hit). Peak is exactly 2×, Monday–Friday only.
Weekend hours that look like Beijing 09–12 / 14–18 are off-peak. - Keeping a hot prefix beats shrinking it. DeepSeek hits only on a
full prefix-unit match from token 0. Blanking 500 cached tokens busts
a ~3k tail; recoup is ~294 further turns.cost_policy.pytherefore
does not rewrite a cached prefix unless the window is full, the
leftover is uncached, or the objective is done. Layer-1 auto-micro
waits for window pressure. Bulky Bash / FetchUrl / ListDir bodies are
vaulted before they enter a cache unit. - FileReader buys Flash only for a semantic question. Unfocused
reads of any language are a local index. An exact / unique-suffix
symbolfocusis local too (0 API). A sentence still costs 1. - Nested Agent reuses the parent's frozen prefix (instructions +
tools + pinned effort). Depth-2 was measured and not shipped. - Rejected with numbers: sharing the parent prefix for focused
FileReader; slicing ReadFile / Agent JSON at 6000 chars (a 10505-char
summary became an unparseable 5590-char stump). - Effort and temperature are pinned to the standing prefix — both are
/responsescache-key fields.
End-to-end session cost is still not measured. G023_READFILE_RAW=1
is the A/B flag; /cost is the meter.
Installer
installer.sh / installer.bat write the full PERSISTED_KEYS set
matching Settings defaults: deepseek-flash, reasoning_effort: 75,
max_iterations: 255, max_context_tokens: 256000,
vision_backend: none, vision_max_image_dim: 800, backups on, surge
notify on / pause off. tiktoken is gone — the context gauge is last
API input_tokens / settings.max_context_tokens. Re-running is still
the way to repair a half-finished setup.
New since the August 1.3.3 cut (now 1.3.4)
cost_policy.py— cache-aware keep vs compact vs vault.effort.py— 0–100 ↔ wire aliases,[handoff]/[next_effort].learn.py— cross-session procedures (/learn, Learn* tools).
Guides are searched on demand, never prepended to the system prompt.session_log.py— append-only JSONL +.g023/logs/handoffs.
/resumeand--continue//resume log.working_set.py— remaining-work object; goal-completion judge.memory_notes.py,prompt_store.py—.g023/memory/,
.g023/prompts/(Ctrl+Up).paths.py— project-root confinement for file tools and/undo.project_instructions.py—g023.md/g023_compact.md/
AGENTS.md.or_subagents.py—/orsubOpenRouter offload for Agent turns.- Tools: Edit (unique-span replace, fails closed), Glob, TodoWrite,
LearnSearch/Get/Put, SessionSearch. /max-ctx,/compact-threshold,/undo,/g023-compact.- WriteFile and Edit snapshot
.g023/backups/before overwriting. - Vision send is always constrained-resized to 800px.
- Parallel ALLOW reads; pairing-intact history is a hard invariant.
Surge, OpenRouter vision, config scopes (from the August cut, still here)
/surge converts Beijing peak windows to the local clock, prices with
them, and can pause around them. /or is OpenRouter vision (OK.dat).
/config is the global vs per-project split. /signals (alias
/drift) is the cheap view of silent API drift.
Documentation & media
Docs are one page per part, indexed by docs/README.md, audited
against this source. The README's API-call table, price numbers, and
"what we measured" claims are either asserted by a test, quoted from
the 2026-09-10 sheet, or labelled as arithmetic / unmeasured.
Screenshots were re-shot on this build from /tmp/g023-shoot/...
(sanitised paths, no home directory, no keys, deepseek-flash only).
A /responses probe timed out, so live agent-turn stills and videos
were not rebuilt; panel stills do not need the API and are current.
What changed in 1.3.2 (since 1.3.1)
/goalis no longer bounded by the step cap.- The default step cap is 255, up from 100.
What changed in 1.3.0 / 1.3.1 (since 1.2.0)
- Configurable per-turn step cap and output budget dial.
- Symbol-to-line-range file reading.
- Drift signals (
/signals). - Honesty pass removing unverified claims from the docs.
What changed in 1.2.0 (still current)
Moved entirely to the DeepSeek Responses API (POST /responses),
which is what makes DeepSeek's native web search a first-class tool
of the loop. Response items are echoed back byte-identical.
Install
Requirements: Python 3.11+ and a DeepSeek API key.
cd /path/to/g023-code
./installer.sh # Windows: installer.batIt finds a Python 3.11+, builds a .venv, installs only missing
dependencies, asks once for the API key, writes a default
config.json, and puts g023 on your PATH. Re-running it is safe.
Optional extras: pillow (vision preprocessing), curl_cffi + h2 +
brotli + zstandard (browser-grade fetching); prompt_toolkit is
strongly recommended for tab completion, history and the live status
bar but the input line degrades to a plain prompt without it.
Contents
g023_code/ the package
api.py DeepSeek Responses API client
cli.py the CLI class, main loop, slash handlers
commands.py the command catalogue as data
config.py paths, settings, scopes, pricing data
cost_policy.py cache-aware keep vs compact vs vault
effort.py 0–100 effort ↔ wire aliases
learn.py cross-session procedures
orchestrator.py the agent loop
paths.py project-root confinement
session_log.py JSONL + objective handoffs
surge.py peak/off-peak pricing arithmetic
usage.py token/cost accounting
working_set.py remaining work + goal judge
subagents/ file_reader, searcher, vision, router
tools/ registry (permissions) + schemas (wire shapes)
docs/ one page per part, indexed by docs/README.md
media/screenshots/ sanitised TUI captures (no home path, no keys)
installer.sh/.bat installers
g023.sh/.bat launchers
ds_pricing.json DeepSeek price sheet (regular + surge)
ds_times.json DeepSeek peak windows (Mon–Fri)
K.dat.example key file template (create K.dat from it)
config.json default configuration (Settings defaults)
What's included
Runtime source, user documentation, installers, launchers, the price
sheet, and the screenshot set. Not included: tests, capture
tooling, videos, build notes (SPEC.md, bbs/, scratch/,
memory/), API keys (K.dat, OK.dat are never shipped),
OR_VISION.json / OR_SUB_MODELS.json (optional; the program runs
without them), cache/history files.
Requirements
rich, httpx, pygments, prompt_toolkit (recommended), pillow
(vision), curl_cffi/h2/brotli/zstandard (fetching) — see
requirements.txt. No local tokenizer.
Notes
Costs shown are computed locally from the token counts the API returns
and the price table in ds_pricing.json — an estimate of your bill,
not a reading of it. The prices are surge-aware as of the sheet's
effective date (2026-09-10); if DeepSeek changes its rate card, update
the JSON.
Verify the archives with SHA256SUMS in this folder.