Skip to content

docs: a Claude Code guide for a local server and its prompt prefix - #4931

Open
javierbits wants to merge 1 commit into
ashhart:mainfrom
javierbits:docs/3225-claude-code-guide
Open

javierbits wants to merge 1 commit into
ashhart:mainfrom
javierbits:docs/3225-claude-code-guide

Conversation

@javierbits

@javierbits javierbits commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

What this changes

Adds docs/claude-code.md: it starts a server for Claude Code, points the client at it, explains which model id the client asks for and why the served id is the one to pass, sets the client's context window, and documents the attribution block with measured per-turn prompt-cache numbers. docs/api.md, README.md and CHANGELOG.md link it.

Checks on this head

  • Head commit: 0ecf42b5bbdc9cf83ac81e4b6b90fd44197ba4c9
  • Lean checker, python3 tools/zig/lean_check.py, on the base and on this head: 165 problems on base 3942d6865 and 165 on this head, no new findings.
  • python3 tools/pr_check.py --base origin/main --pr 4931: 0 errors, 0 warnings. Tests run: the guide's flow was run end to end: one source-build server at ef6bf1bea, the head when measured (zig build native -Dnvcc=..., zig build grammar -Dxgrammar=...), Claude Code v2.1.299 with --model local-model, three resumed turns per arm with and without CLAUDE_CODE_ATTRIBUTION_HEADER=0, and one Read tool round. Every request answered (HTTP 200); the per-turn numbers are in the guide. git diff --check is clean.
  • CI: pending on this head (docs-only; all workflows run on the branch).
  • Not run, and why: the host suite (zig build test test-golden), because only Markdown changed; its last pass on main is unchanged by this head.

Receipt

n/a: documentation only, nothing new can reach inference. The measured numbers in the guide come from a source build at this head, nvidia/Qwen3.8-27B-NVFP4 on one GB10, Ubuntu 24.04.5, driver 580.178.04, CUDA 13.0.88, Zig 0.17.0, --context 65536 --parallel 1; the client logged cache_read_input_tokens 24,576 on turns 2 and 3 in both arms.

  • Main against branch: cells and numbers, or why they can't be run: n/a, documentation.
  • Boxes it reaches: none, documentation.
  • New switch? Default, accepted values, profile row: none.
  • Environment, with the TensorFold commit, Zig and backend toolchain, machine and GPU, checkpoint and revision: 3942d6865, Zig 0.17.0, CUDA 13.0.88, one GB10, nvidia/Qwen3.8-27B-NVFP4 at snapshot 482ca0f3832238542f8f5295dde86b5f22711d80.
  • Paths and platforms the change reaches, which I ran and which I could not: docs/claude-code.md, the docs/api.md link, README.md and CHANGELOG.md; no code path. The measurements are one GB10 and one client version; the guide says which client versions need the setting.
  • Exactness, from tools/bench_concurrent.py --alone --serial or token_sha against "draft": false: n/a, documentation; the server's replies were unchanged by this head.
  • Main against this branch, same machine and checkpoint, posted before asking for a run on our machines (or why you can't): n/a, documentation.
  • Decode speed before and after, from tools/bench_openai.py: n/a, documentation.
  • Prompt speed before and after: the cold first request's ttft_s from tools/bench_cache.py --require-cold on a long prompt, or "n/a" with the reason when the change cannot reach prompt processing: n/a, documentation; the guide's per-turn resumed counts are the measured cache effect.
  • Licence of any new weights or drafter, or "n/a": n/a, no new weights.

Checklist

  • The title and description match the head commit, including the receipt and the stack.
  • New tests fail before the change, pass after it, and skip cleanly without their dependency. (No new test: the numbers in the guide are the receipt.)
  • Comments and docstrings are one line. No measurements or history in the source.
  • No personal data, machine names, internal hosts or local paths in the diff or its commits. No AI attribution lines.

@javierbits
javierbits force-pushed the docs/3225-claude-code-guide branch 2 times, most recently from b5401bb to a4853a2 Compare November 24, 2026 18:15
@javierbits
javierbits marked this pull request as ready for review November 24, 2026 19:46
@javierbits
javierbits force-pushed the docs/3225-claude-code-guide branch from a4853a2 to 0ecf42b Compare November 24, 2026 19:47
@AIFlowML

Copy link
Copy Markdown
Contributor

I walked through the quick start at 0ecf42b5bbdc9cf83ac81e4b6b90fd44197ba4c9. The first tensorfold launch claude example leaves out the 65,536-token window that the guide calls for and that the measurement uses. The launcher forwards the environment and configures the endpoint and key, so a fresh shell running just that block won't set the custom-model window. Could the first example include it?

CLAUDE_CODE_MAX_CONTEXT_TOKENS=65536 tensorfold launch claude --model local-model

zig test launch_cli.zig on the source file from that head passed all four launcher tests on Apple silicon with Zig 0.17.0. The head also test-merges cleanly into main ed70f71aa7e561974dc4ec005e17fe64cba3d98a. I exercised the launcher tests with their injected process boundary and did not rerun the live Claude Code cache measurement.

Igor Lessio - AIFLOW LABS

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Docs: a Claude Code guide that keeps its prompt prefix cacheable

2 participants