npm package: @sumant.pathak/devjar
Description: Scan your project into a Claude-ready knowledge map. Use 60-70% fewer tokens on any AI coding tool.
Latest version: 1.0.18

# devjar

Scan your project into a Claude-ready knowledge map. Rewrite vague prompts into structured ones. Use 60–70% fewer tokens on any AI coding tool.

---

Every Claude Code session starts blind. You re-explain the same context, re-read the same files, burn tokens on clarification. devjar fixes both.

---

## Quick start

```bash
npm install -g devjar
cd your-project
devjar init
```

Your project is now mapped. Claude reads `CLAUDE.md` at session start and never re-reads your files again.

For prompt normalization, pick a provider once:

```bash
ollama pull llama3.2          # free, runs locally
devjar config --provider ollama --model llama3.2
devjar prompt "fix login bug"
```

---

## Commands

| Command | What it does |
|---|---|
| `devjar init` | Scan project → generate `CLAUDE.md` (stack, file map, rules) |
| `devjar prompt "text"` | Rewrite vague input into STAR-C format, copy to clipboard |
| `devjar update` | Regenerate `CLAUDE.md` after major changes |
| `devjar update --watch` | Live watcher — updates file map on every save |
| `devjar stats` | Token savings estimate, streak, per-project breakdown |
| `devjar config` | Set AI provider, or run setup wizard |

---

## Provider setup

**Ollama — free, local, no account needed (recommended)**

```bash
# Install from https://ollama.com, then:
ollama pull llama3.2
devjar config --provider ollama --model llama3.2
```

**Cloud providers**

```bash
devjar config --provider gemini    --key AIza...    # free tier at aistudio.google.com
devjar config --provider anthropic --key sk-ant-...
devjar config --provider openai    --key sk-...
```

First time you run `devjar prompt` with no config, the setup wizard runs automatically.

---

## What it looks like

```
$ devjar init
⬡ devjar init → /your-project
────────────────────────────────────────────────────
Phase 1  Scanning project structure...
  ✓ 115 files | Stack: React + Vite
Phase 2  Pattern extraction via Haiku...
  ✓ 5 rules extracted from 4 key files
Phase 3  Writing CLAUDE.md...
────────────────────────────────────────────────────
✓ CLAUDE.md generated — 115 files scanned, 5 rules extracted
  → /your-project/CLAUDE.md
```

```
$ devjar prompt "login not working after deploy"
⬡ devjar prompt
────────────────────────────────────────────────────
  Provider: ollama/llama3.2
  Input:    login not working after deploy
  ✓ CLAUDE.md loaded (7236 chars)

─── STAR-C Prompt ───────────────────────────────────
S — care-home — React + Vite, auth via httpOnly cookie
T — Debug login failure introduced after deployment
A — Check src/routes/auth.js COOKIE_OPTIONS (SameSite attr)
    Verify KV session creation on login success
R — Login succeeds, sc_token cookie set, /api/auth/me returns user
C — Don't change PBKDF2 iterations (CF Workers hard cap: 100k)
    Don't rotate JWT_SECRET without flushing KV sessions
────────────────────────────────────────────────────

Copy to clipboard? (Y/n) y
✓ Copied
```

---

## How it works

`devjar init` walks your project, reads `package.json` + config files, then sends 3–5 key files to your AI provider and extracts naming conventions, patterns, and 5 unbreakable rules. Writes everything to `CLAUDE.md`.

`devjar prompt` sends your vague input + your `CLAUDE.md` to your provider. Gets back a structured prompt with the exact files to check, expected result, and constraints inferred from your codebase. One provider call ≈ $0.00 with Ollama.

---

## Requirements

- Node.js 18+
- `devjar init` — fully offline, no provider needed
- `devjar prompt` — Ollama (free) or any cloud API key
- `devjar stats` / `devjar update` — fully offline

---

## License

MIT