Create unprivileged server or worker LXCs and build native binaries inside the container. Refresh a clean published checkout before updates, preserve configuration and history, and roll back failed binary activation without resetting local source work. Refs #19
9.1 KiB
FinalToken
A small tray app that tracks Claude Code and Codex usage and limits on Windows 11 and CachyOS. It keeps provider credentials owned by the installed CLIs. The optional web dashboard coordinates official CLI login with transient authorization-code relay (D14). A stats panel shows history, small popups warn when usage runs ahead of or behind a limit's pace, and a Stream Deck plugin puts stats on keys. Developer: schmidt.florian (Gitea user name).
Sources of truth
docs/requirements.mdholds the requirements, with stable IDs (R1).docs/decisions.mdholds the recorded decisions (D1), each with why and what it gives up. Read the ones for your area before working in it. Cite IDs in code comments, commits and PRs rather than restating the text.- Each project under
src/andtests/has a shortAGENTS.md. Read it before changing the project.
Recorded decisions are binding
Build what the decisions say. When a task conflicts with one, or one looks wrong, stop: comment on
the issue with the conflict and a proposal, add status/needs-decision, and leave the call to the
developer. A decision changes only through a PR that edits its text in docs/decisions.md, keeps
the decision, why and gives-up format, and carries the type/decision label.
Layout
| Path | What it is |
|---|---|
src/FinalToken.Core |
No UI. Domain model, pace (D7), collectors (D3, D4), history store (D5), refresh scheduler (D6), snapshot contract (D9), settings, plugin installer (D11) |
src/FinalToken.App |
Avalonia desktop app (D8): stats panel, tray, settings, popups |
src/FinalToken.Cli |
finaltoken-cli console: runs a refresh and prints the snapshot, for scripts and checks |
src/FinalToken.StreamDeck |
Stream Deck plugin executable and its .sdPlugin assets (D10) |
src/FinalToken.Fleet |
Account/machine metadata, shared analysis and pending official CLI logins (D14) |
src/FinalToken.Web |
Authenticated self-hosted dashboard and outbound-worker API (D14) |
src/FinalToken.Worker |
Per-OS-user collector and official CLI login process host (D14) |
tests/* |
One test project per tested project, named <Project>.Tests |
tools/ |
Repository tools, listed under Tools |
Rules for code
- Current C# 14 on .NET 10: file-scoped namespaces, primary constructors, collection expressions,
requiredandinit, pattern matching,System.Threading.Lock. Nullable reference types on. - NativeAOT-safe everywhere (D1): System.Text.Json source generation, Avalonia compiled bindings,
no reflection-driven serialization, binding or loading, no
dynamic, no runtime code generation. Trim and AOT analyzer warnings are errors; never suppress one without a one-line reason at that spot. - Never touch provider credentials (D2): do not open credential files, provider environment secrets or keychains, never log message text, and never call a provider's HTTP API. D14 permits authenticated, transient authorization-response relay to the pending official CLI login. Dashboard/worker access keys authenticate FinalToken transport; they are not provider credentials.
- Child processes (
claude,codex) run without a shell, with arguments as a list, a timeout and cancellation, and are killed with their process tree when they overrun (D6). - Every file the app writes for itself is written atomically (D5).
- Paths come from
Environment.GetFolderPath,Path.Combineand the environment overrides named in D3 and D4, never from hard-coded drive letters or/home/<user>. - Parsers of CLI output and files are total: unknown or malformed input becomes a diagnostic, never an exception that stops a refresh, and never a guessed value.
- A new package needs a justification in its PR and must be NativeAOT-compatible. Package
versions live in
Directory.Packages.props. - New behaviour has tests. Parser tests use small, hand-written fixtures under the test project; never copy a real transcript or rollout into the repo.
Workflow
- Issue first. Find or create the Gitea issue at
https://git.finalfactory.de/FinalFactory/FinalTokenand assign it to schmidt.florian. Put the plan on the issue as a checklist and keep it current. Give it atype/label. Claim agent work with the active agent labels. - One branch per issue, in its own worktree: branch
<issue>-<slug>fromorigin/master, checked out at../FinalToken-wt/<issue>-<slug>. - Commit with an
area: summarysubject (docs:,tools:,core:,app:,streamdeck:,cli:), a body that says why, andRefs #N. Push after every commit. - Open a PR into
masterwith a body that follows.gitea/pull_request_template.mdand saysCloses #N. The PR title becomes the squash commit subject, so it follows the commit style. - Review. After the last push, start a fresh reviewer as described in
docs/agents/review.md. Fix blocking findings, push, and start a new review. - Merge with a squash merge once the review passes, then delete the branch and remove the worktree.
Codex workers use GPT-6.1 Sol, model ID gpt-6.1-sol. Never select GPT-6 Sol or gpt-6-sol.
Active agent labels
| Label | Meaning |
|---|---|
status/in-progress |
At least one agent works on the issue now |
agent/florian |
The active agents work for schmidt.florian |
model/<exact-model-id> |
An active agent uses this exact model ID |
- Add
status/in-progress,agent/florianand each active model's label when work starts, and post a claim comment with the models, their roles, the branch and the worktree. - The coordinating agent keeps labels and comments current; workers report to it and do not edit the issue. Remove a model label when its last agent stops, and all three kinds when none runs.
- Add and remove single labels. Never replace the issue's label list.
Workers
The coordinating agent briefs workers, answers their questions and keeps the commits, pushes,
issue comments and the PR. Workers leave their changes uncommitted, end with a summary of the
commands they ran and their results, and list open questions under QUESTIONS:. Never let two
agents edit the same files at once.
When you are stuck
- Stop when the same problem survives two attempts, or as soon as something proves
impossible. Comment on the issue with what you tried, what failed and what you need, and set
status/blockedorstatus/needs-decision. - The review loop has a limit: after a PR's second failed review, the developer decides how
it goes on (
docs/agents/review.md).
Building and testing
Releasing: bump <Version> in Directory.Build.props, then publish; the tool stamps the plugin manifest.
Run every command from the repository root.
| Command | What it does |
|---|---|
dotnet build FinalToken.slnx -c Release |
Builds everything; any warning fails |
dotnet test --solution FinalToken.slnx -c Release |
Runs every test project |
python -B tools/docs/check_docs.py |
Checks that local links and anchors resolve, that each ID is defined once and that every cited ID exists |
Every change runs the build, the affected tests and the documentation check. UI changes also need a screenshot of each changed view: compiling is not working.
Tools
tools/icon/make_icon.py: renders the shared app icon with development-only Pillow 11.3.0. Runpython -B tools/icon/make_icon.py; test withpython -B tools/icon/test_make_icon.py.tools/docs/check_docs.py: the documentation check; its tests arepython -B tools/docs/test_check_docs.py.tools/gitea.sh: calls the Gitea API with the stored git credential orGITEA_TOKEN.tools/agent-review.sh: posts an agent review and sets theagent-reviewstatus; seedocs/agents/review.md.tools/publish.py: publishes the app,finaltoken-cliand Stream Deck plugin with NativeAOT into an empty output directory and creates a ZIP beside it. Run on the target OS. It stamps the plugin manifest'sVersionfrom<Version>; its test ispython -B tools/test_publish.py.tools/test_web_dashboard.py: provider-free HTTP/worker/process integration; build Release first.--serve-fixtureruns a temporary synthetic dashboard for screenshots. Seedocs/web-dashboard.md.tools/proxmox.sh: creates/updates a managed Debian 13 LXC from the Proxmox host. Its Python helpers live intools/proxmox/; test withpython -B tools/proxmox/test_installer.py. Seedocs/proxmox.md.tools/proxmox-update.sh CTID: fast-forwards a clean tracking checkout, then runs the fetched installer against a managed CT; test withpython -B tools/proxmox/test_update.py.tools/check_public.py --history: read-only publication pattern check. It reports paths/pattern names, never matching values; tests arepython -B tools/test_check_public.py. Seedocs/publication.md.
Writing
Docs, commit messages and PR bodies use plain, short sentences in the style of
docs/decisions.md. Link issues as
[#1](https://git.finalfactory.de/FinalFactory/FinalToken/issues/1).
Shared memory
Durable lessons (a gotcha, a convention, a command) go into this file, a project's AGENTS.md or
.agents/mind/, through a PR. Session state and handoffs go in issue comments.