Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,14 @@ working on DevMap.
Update the relevant document whenever implementation or verification changes
its contents. Do not duplicate these personal notes into the public `docs/`
folder unless the information is intended for users or contributors.

<!-- DevMap Instruction Block -->
## DevMap Context

Before working in this repository, read `DEVMAP.md` first.
Read `.devmap/index.json` first, then the relevant
`.devmap/features/*.json` map. Inspect files from `sourcePriority` before
exploring broadly. Use `.devmap/snapshot.json` only when those lightweight
navigation files are insufficient. If the navigation files are missing, run
`devmap analyze`.
<!-- End DevMap Instruction Block -->
86 changes: 86 additions & 0 deletions DEVMAP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# DevMap

This repository uses DevMap to create reusable project context for developers and AI agents.

## Project Context

- Detected framework: astro
- Agent navigation index: `.devmap/index.json`
- Feature maps: `.devmap/features/*.json`
- Full analysis archive: `.devmap/snapshot.json`
- DevMap config: `~/.devmap/config.json`

## Recommended Workflow

1. Run `devmap analyze` after cloning the repository.
2. Run `devmap analyze --fresh` after major architecture changes.
3. Use `devmap ask "<question>"` before manually exploring unrelated files.
4. Treat DevMap output as an architecture overview, then verify critical behavior in source code.

## Commands

```bash
devmap analyze
devmap analyze --json
devmap ask "how does authentication work?"
devmap ask "where is authentication handled?" --json
devmap doctor
devmap doctor --json
```

## Agent Navigation Contract

This repository uses DevMap as the primary navigation source. Use the lightweight
navigation files before broad repository exploration.

Preferred reading order:

1. Read `.devmap/index.json`.
2. Pick the relevant feature using its name and keywords.
3. Open the matching `.devmap/features/*.json` map.
4. Inspect only the files listed in `sourcePriority` first.
5. Read `.devmap/snapshot.json` only when the index and feature maps are
insufficient or full archive/debug context is required.

Do not scan the whole repository first.

Open source files only when:

- the snapshot is missing;
- the snapshot is stale;
- the snapshot does not contain enough detail;
- exact implementation is required;
- the task is edit, debug, or refactor;
- the user explicitly asks for code changes.

When source inspection is needed, inspect the smallest relevant set first.
Prefer feature entry points and flow steps over broad folder exploration.

## Required Agent Workflow

1. Read `DEVMAP.md`.
2. Read `.devmap/index.json`.
3. Open the relevant feature map.
4. Inspect at most the smallest relevant source-file set from `sourcePriority`.
5. Explain which navigation entry guided the decision when giving advice.
6. Avoid unrelated files unless the navigation data is incomplete or exact
code verification is required.

If `.devmap/index.json` or `.devmap/snapshot.json` is missing, run
`devmap analyze` when DevMap is available and configured. If analyze fails
because DevMap is not initialized, ask the user to run `devmap init` and then
`devmap analyze`.

If the snapshot may be stale, run `devmap analyze --fresh` before relying on
it.

Use `--json` when calling DevMap programmatically so stdout remains one
parseable JSON document without ANSI or terminal decoration.

Do not edit generated files inside `.devmap/`.

## Repository Safety

- `.devmap/` is local generated state and should stay out of Git.
- Never commit API keys or provider credentials.
- DevMap helps locate relevant code; it does not replace source-level verification.
19 changes: 8 additions & 11 deletions PRD.md
Original file line number Diff line number Diff line change
Expand Up @@ -327,16 +327,11 @@ Run static analysis, generate project snapshot, and output a readable project ov

```bash
devmap analyze
devmap analyze --deep
```

**`--deep` flag:**

| | Standard | `--deep` |
|---|---|---|
| Analysis scope | Project-level overview | Per-module detailed explanation |
| AI usage | Lower | Higher |
| Best for | Quick mapping | Large/unfamiliar projects |
`devmap analyze` uses the provider and model stored in
`~/.devmap/config.json`. Groq users choose a model during setup and can change
it later with `devmap config model <model-id>`.

**Generated files:**

Expand Down Expand Up @@ -576,9 +571,7 @@ ai/
| Command | Model | Reason |
|---|---|---|
| `analyze` | `openai/gpt-oss-20b` | Balanced architecture interpretation |
| `analyze --deep` | `openai/gpt-oss-120b` | Heavy cross-module reasoning |
| `analyze` fallbacks | `qwen/qwen3.6-27b` -> `llama-3.3-70b-versatile` -> `llama-3.1-8b-instant` | Keep snapshot enrichment available across model-specific limits |
| `analyze --deep` fallbacks | `llama-3.3-70b-versatile` -> `qwen/qwen3.6-27b` -> `openai/gpt-oss-20b` | Degrade heavy reasoning gradually instead of failing immediately |

DevMap retries a rate-limited model up to three times, then advances through
the command-specific chain. It also advances when a model is unavailable or
Expand All @@ -591,6 +584,10 @@ Model availability changes over time. Before changing the default routing,
verify the current Groq model list and lifecycle status. Preview models must
not be used as a primary default for a public DevMap release.

Groq setup lists the currently available Groq models after validating the API
key. Users choose one with arrow keys and Enter; the selected model is stored
as the user's preferred model.

OpenRouter setup asks for a model ID after validating the API key. Pressing
Enter selects `openrouter/free`; entering another free or paid model stores
that exact model as the user's preferred model. Explicit user selections take
Expand Down Expand Up @@ -1017,7 +1014,7 @@ Rate limit reached.

DevMap will retry in 12 seconds.

Tip: Use standard analyze instead of --deep for lower token usage.
Tip: Choose a smaller model with devmap config model <model-id> for lower token usage.
```

All error messages must be:
Expand Down
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -253,10 +253,11 @@ AI features require a provider API key. DevMap uses Groq by default — analysis
| OpenAI | Planned |
| Gemini | Planned |

`devmap init` lets you choose Groq or OpenRouter with the arrow keys. For
OpenRouter, pressing Enter at `OpenRouter model [openrouter/free]:` keeps the
free router; typing another model ID uses that free or paid model instead.
Change it later with `devmap config model <model-id>`.
`devmap init` lets you choose Groq or OpenRouter with the arrow keys. Groq
shows the available model list and stores the selected model. For OpenRouter,
pressing Enter at `OpenRouter model [openrouter/free]:` keeps the free router;
typing another model ID uses that free or paid model instead. Change it later
with `devmap config model <model-id>`.

API keys are stored locally:

Expand Down
5 changes: 4 additions & 1 deletion docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,6 @@ MVP default model routing:
| Command | Primary | Ordered fallbacks |
| ---------------- | -------------------------- | ----------------- |
| `analyze` | `openai/gpt-oss-20b` | `qwen/qwen3.6-27b` -> `llama-3.3-70b-versatile` -> `llama-3.1-8b-instant` |
| `analyze --deep` | `openai/gpt-oss-120b` | `llama-3.3-70b-versatile` -> `qwen/qwen3.6-27b` -> `openai/gpt-oss-20b` |

Each model receives up to three exponential-backoff retries for HTTP 429.
After those retries, or when a model is unavailable or returns HTTP 5xx,
Expand All @@ -657,6 +656,10 @@ on 2026-06-20. Recheck provider lifecycle status before publishing a release.
Users can override automatic routing with `devmap config model <model>`.
Running `devmap config model auto` restores the defaults above.

Groq setup lists available Groq models after API-key validation and stores the
selected model in the global config. The stored model is used as the primary
choice until the user changes it with `devmap config model`.

OpenRouter does not use the Groq command-routing table. During `devmap init`,
Enter accepts `openrouter/free`, while a typed model ID is stored and used
exactly as the user selected it. Explicit OpenRouter model choices receive no
Expand Down
53 changes: 12 additions & 41 deletions docs/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ devmap init
* Confirm AI provider
* Input API key or read environment variable
* Validate API key
* Ask for a Groq model from the provider model list
* Ask for an OpenRouter model; Enter defaults to `openrouter/free`
* Save global configuration to `~/.devmap/config.json`
* Detect current project framework
Expand Down Expand Up @@ -120,17 +121,12 @@ Analyze the current project and generate a reusable project snapshot.

### Usage

```bash
devmap analyze
devmap analyze --deep
```

### Modes

| Mode | Purpose |
| -------- | -------------------------------------- |
| Standard | Fast project overview |
| `--deep` | More detailed architecture explanation |
```bash
devmap analyze
```

`devmap analyze` uses the model stored in `~/.devmap/config.json`. Change the
stored model with `devmap config model <model-id>`.

### Responsibilities

Expand Down Expand Up @@ -219,33 +215,7 @@ Snapshot saved:

```


### Deep Output

When using:

```bash
devmap analyze --deep
```

DevMap adds a deeper module-level explanation.

Example:

```txt
Module Breakdown

app/
Main application routes and layouts.

app/api/
Server-side API routes.

lib/
Shared utilities, database access, authentication logic, and helpers.
```

### Rules
### Rules

* Static analysis must run before AI interpretation
* Do not send the entire project source to AI
Expand Down Expand Up @@ -415,7 +385,10 @@ devmap config model auto
`auto` restores command-based routing:

* `analyze` uses `openai/gpt-oss-20b`
* `analyze --deep` uses `openai/gpt-oss-120b`

For Groq, `devmap init` lists available models after API-key validation. Pick a
model with the arrow keys and press Enter. The selected model is stored in the
global config.

For OpenRouter, `devmap init` prompts with:

Expand All @@ -430,7 +403,6 @@ The typed model is stored as the primary choice and is not silently replaced.
Automatic routing also uses ordered fallback chains:

* `analyze`: `qwen/qwen3.6-27b`, `llama-3.3-70b-versatile`, then `llama-3.1-8b-instant`
* `analyze --deep`: `llama-3.3-70b-versatile`, `qwen/qwen3.6-27b`, then `openai/gpt-oss-20b`

DevMap advances after model-unavailable and transient provider responses. For
rate limits, it first retries the current model three times with exponential
Expand Down Expand Up @@ -476,7 +448,6 @@ integration.
```bash
devmap init --json
devmap analyze --json
devmap analyze --deep --json
devmap onboarding --json
devmap doctor --json
devmap config model auto --json
Expand Down
18 changes: 18 additions & 0 deletions docs/for-me-personal/PROGRESS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,24 @@ Terakhir diperbarui: 2026-06-23

## Update 2026-06-23

### Groq Model Picker And Analyze Deep Removal

- `~/.devmap/config.json` tetap menyimpan `provider`, `apiKey`, dan `model`.
Config lama tanpa `provider` atau `model` dibaca sebagai `provider: "groq"`
dan `model: "auto"` agar tetap backward compatible.
- `devmap init` untuk Groq sekarang mengambil daftar model dari endpoint model
Groq setelah API key valid, lalu menampilkan picker arrow-key/Enter.
- Model Groq yang dipilih disimpan ke global config dan dapat diganti dengan
`devmap config model <model-id>`.
- OpenRouter setup tidak diubah: tetap memakai prompt model text dengan default
`openrouter/free`.
- Flag `devmap analyze --deep` dihapus dari CLI dan dokumentasi aktif. Hasil
investigasi: analyzer static, snapshot, dan cache path-nya sama; perbedaan
sebelumnya hanya routing model/fallback, prompt/token limit, dan output
`Module Breakdown` kecil.

---

### Ask Command — Complete Removal

- **Seluruh fitur `devmap ask` dihapus permanen.**
Expand Down
29 changes: 19 additions & 10 deletions docs/for-me-personal/TEST.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,25 @@ Remove-Item Env:OPENROUTER_API_KEY
Jangan simpan atau menyalin API key nyata ke repository, snapshot, output test,
atau dokumentasi debugging.

## Groq Model Picker And Analyze Command

Focused automated tests:

```powershell
pnpm --filter devmap exec tsx --test test/init-and-errors.test.ts test/config-command.test.ts test/analyze-ai.test.ts
```

Expected:

- Config lama di `~/.devmap/config.json` yang hanya berisi `apiKey` tetap
terbaca sebagai Groq dengan `model: "auto"`.
- Setup Groq interaktif menampilkan daftar model Groq setelah API key valid.
- Pilih model dengan arrow key lalu Enter; model tersimpan di global config.
- `devmap config model <model-id>` tetap dapat mengganti model yang tersimpan.
- `devmap analyze --help` tidak menampilkan flag `--deep`.
- OpenRouter setup tetap memakai prompt model text dengan default
`openrouter/free`.

## Mixed Workspace Snapshot Accuracy

Jalankan static analyze pada root DevMap dengan config AI terisolasi:
Expand Down Expand Up @@ -258,12 +277,8 @@ pnpm --filter devmap exec tsx --test test/config-command.test.ts test/analyze-ai

Expected automatic routing:

- `ask`: `llama-3.1-8b-instant`
- `analyze`: `openai/gpt-oss-20b`
- `analyze --deep`: `openai/gpt-oss-120b`
- `ask` fallback: Qwen 3.6 27B -> Llama 70B Versatile -> GPT-OSS 20B
- `analyze` fallback: Qwen 3.6 27B -> Llama 70B Versatile -> Llama 8B Instant
- deep fallback: Llama 70B Versatile -> Qwen 3.6 27B -> GPT-OSS 20B

Automated expectations:

Expand Down Expand Up @@ -925,12 +940,6 @@ Pastikan:
- raw provider error dan stack trace tidak muncul;
- `doctor` menyatakan key dan model valid.

Tes deep model:

```powershell
devmap analyze --deep --fresh
```

Hapus key:

```powershell
Expand Down
6 changes: 2 additions & 4 deletions packages/cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,17 +90,15 @@ DevMap-owned server.
```bash
devmap init
devmap analyze
devmap analyze --deep
devmap analyze --fresh
devmap onboarding --write
devmap onboarding --write --language id
devmap doctor
devmap config model auto
```

Groq automatic routing uses a fast model for focused questions and larger
models for architecture analysis. OpenRouter uses the model selected during
init. Change either provider's model with:
Groq and OpenRouter use the model selected during init. Change either
provider's model with:

```bash
devmap config model <model-id>
Expand Down
Loading
Loading