gitasking
v0.3.0
Published
RAG codebase assistant — index a git repo locally, then ask questions and edit code with Claude or a local Ollama model (no API key), designed to minimize token usage.
Maintainers
Readme
gitasking
████ █████ ███ ███ █████ ███ █ █ ███ █████ █████
█ █ █ █ █ █ █ █ █ █ █ █ █
████ ████ █████ █ █ █ █ █ █ █ ████
█ █ █ █ █ █ █ █ █ █ █ █ █
█ █ █████ █ █ ███ █ ███ █ ███ █ █████
by Javid SalimovRAG codebase assistant. Index a git repo locally, then ask questions about it and let it edit code — designed to spend Claude tokens as rarely as possible.
Why it's cheap on tokens
Three layers cut Claude usage:
- Local embeddings — the whole repo is embedded on your machine
(
all-MiniLM-L6-v2via Transformers.js). Indexing costs 0 tokens. - Retrieval — each question/edit sends only the top‑k relevant code chunks to Claude, never the whole codebase.
- Answer cache — semantically similar repeat questions are served from a local cache with no Claude call at all.
Claude is called only on a fresh (cache‑miss) question or an edit, and only for
a handful of code chunks.
Install
npm install -g gitasking
# or, from source:
npm install && npm run buildAPI key
Provide your Anthropic key any of these ways (resolved in this order):
# a) environment variable (takes priority)
export ANTHROPIC_API_KEY=sk-ant-...
# b) save it once, locally (hidden input)
gitasking login
# c) do nothing — the first `gitasking ask`/`edit` prompts you for it
# and offers to save it for next timeResolution order: ANTHROPIC_API_KEY env var → saved file
(~/.gitasking/credentials.json, owner‑only) → interactive hidden prompt. Remove a
saved key with gitasking logout.
Commands
| Command | What it does |
|---|---|
| gitasking index [path] | Index a repo locally (no Claude tokens). Default path: current dir. Incremental — re‑embeds only changed files. |
| gitasking ask "<question>" | Answer a question with code snippets, citing path:line. Claude only on a cache miss. |
| gitasking edit "<instruction>" | Propose search/replace edits, show a diff, then apply after confirmation. |
| gitasking clear-cache | Clear the answer cache for a repo. |
| gitasking login / gitasking logout | Save / remove the Anthropic API key. |
Every run prints the banner to stderr, so it never pollutes piped stdout
(e.g. gitasking ask "..." > answer.md).
Usage
# 1. Index a repo (local, no tokens)
gitasking index
gitasking index /path/to/repo
# 2. Ask questions (Claude only on a cache miss)
gitasking ask "how does authentication work?"
gitasking ask "where is the HTTP server started?" --path /path/to/repo
gitasking ask "..." --model claude-sonnet-4-6 # cheaper model
gitasking ask "..." --top-k 12 # retrieve more chunks
gitasking ask "..." --no-cache # always call Claude
# 3. Edit code from an instruction (diff + confirm)
gitasking edit "rename the function fooBar to fooBaz where it's defined"
gitasking edit "add input validation to parseConfig" --dry-run # preview only
gitasking edit "..." --yes # apply without confirming
# 4. Maintenance
gitasking clear-cache
gitasking login # save key (hidden input)
gitasking logout # remove saved keyEditing code
gitasking edit "<instruction>" retrieves the relevant chunks, asks Claude for
exact search/replace edits, prints a diff, and applies them only after you
confirm (default answer is No). Flags: --dry-run shows the diff without
writing, --yes skips the confirmation. Edits that don't match a file exactly
(or aren't unique, or escape the repo) are skipped and reported. After applying,
run gitasking index to refresh the index.
Re‑running gitasking index re‑embeds only changed files and clears the (possibly
stale) answer cache.
Models
Default: claude-opus-4-8. Cheaper alternatives via --model:
| Model | Input / Output ($/1M) |
|---|---|
| claude-opus-4-8 (default) | $5.00 / $25.00 |
| claude-sonnet-4-6 | $3.00 / $15.00 |
| claude-haiku-4-5 | $1.00 / $5.00 |
Programmatic API
import { resolveConfig, runIndex, retrieve, answer, proposeEdits, planEdits, writePlan } from 'gitasking';
const cfg = resolveConfig('/path/to/repo');
await runIndex(cfg, console.log);
// Q&A
const { chunks } = await retrieve(cfg, 'how does routing work?');
const text = await answer(cfg, 'how does routing work?', chunks, (t) => process.stdout.write(t));
// Edit
const edits = await proposeEdits(cfg, 'add a health check route', chunks);
const plan = await planEdits(cfg.repoPath, edits);
await writePlan(plan); // writes the filesHow it stores data
Per repo, under .gitasking/:
index.json— code chunk vectors + metadatameta.json— per‑file content hashes (incremental indexing)answer-cache.json— cached question embeddings + answers
The API key (if saved) lives separately at ~/.gitasking/credentials.json.
Add .gitasking/ to your .gitignore.
Requirements
- Node.js ≥ 18
giton PATH (indexing usesgit ls-files, so it respects.gitignore)
License
MIT
