← TinyGPT · docs · devlog · roadmap · speedup
source: docs/recipes/cookbook-personal-code-specialist.md · view on GitHub ↗

Cookbook - Personal Code Specialist

What you get:

What this is not: an editor plugin. Continue.dev and Aider already know how to call OpenAI-compatible local servers; TinyGPT only has to serve the model.

1. Build A Repo Corpus

The example script walks the current repo, keeps source/doc files, and emits JSONL rows with path and text. Run:

examples/repo-specialist-cli/run.sh corpus .

Output:

.tinygpt/repo-specialist/corpus.jsonl

2. Train Or Fine-Tune

Use the corpus as the domain data for a specialist run. The exact command depends on the base model you are using; keep it small and eval-driven:

tinygpt sft \
  --base ~/.cache/tinygpt/runs/huge-base-v1/huge-base-v1.tinygpt \
  --corpus .tinygpt/repo-specialist/corpus.jsonl \
  --steps 2000 \
  --out .tinygpt/repo-specialist/model.tinygpt

If you already have a checkpoint:

export TINYGPT_MODEL=.tinygpt/repo-specialist/model.tinygpt

3. Serve It

tinygpt serve "$TINYGPT_MODEL" --host 127.0.0.1 --port 8080

4. Continue.dev

Continue’s OpenAI provider accepts apiBase. Add this to ~/.continue/config.yaml:

name: TinyGPT Local Specialist
version: 0.0.1
schema: v1
models:
  - name: TinyGPT Repo Specialist
    provider: openai
    model: tinygpt
    apiBase: http://127.0.0.1:8080/v1
    apiKey: not-needed
    roles:
      - chat
      - edit
      - apply
    capabilities:
      - tool_use

Generate the snippet:

examples/repo-specialist-cli/run.sh continue

5. Aider

Aider can connect to an OpenAI-compatible endpoint with environment variables:

export OPENAI_API_BASE=http://127.0.0.1:8080/v1
export OPENAI_API_KEY=not-needed
aider --model openai/tinygpt

Generate the snippet:

examples/repo-specialist-cli/run.sh aider

6. Benchmark

Create a held-out file of repo-specific prompts:

{"prompt":"Add a route matching the existing Astro page style.","expected_contains":"frontmatter"}
{"prompt":"Write a Swift CLI subcommand using the existing run(args:) pattern.","expected_contains":"static func run(args:"}

Then run:

tinygpt run-bench \
  --model "$TINYGPT_MODEL" \
  --tasks custom-code-patterns \
  --limit 50 \
  --out docs/artifacts/repo-specialist-bench.jsonl

Record:

ModelPattern matchCompile/test passMean latency
TinyGPT repo specialistfill after runfill after runfill after run
General coding baselinefill after runfill after runfill after run

Honest Limitations

See also: smolagents and Pydantic AI.