Skip to content

Commit 8a8a791

Browse files
committed
docs: add lessons convention and clarify DX research notes
1 parent 037daff commit 8a8a791

4 files changed

Lines changed: 86 additions & 0 deletions

File tree

.agents/lessons.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Lessons
2+
3+
Persistent log of corrections and insights from past sessions. Agents **must** check this file at the start of every session and append new lessons after corrections.
4+
5+
## Format
6+
7+
Each entry is a single bullet: `- **<topic>** — <lesson>`. Newest entries at the bottom.
8+
9+
## Lessons

.agents/rules/lessons.mdc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Lessons Convention
2+
3+
## Rules
4+
5+
1. **Read at session start** — At the beginning of every conversation, read `.agents/lessons.md` to avoid repeating past mistakes.
6+
2. **Append after corrections** — When the user corrects you or you discover a non-obvious mistake, append a bullet to the `## Lessons` section: `- **<topic>** — <lesson>`.
7+
3. **Keep entries atomic** — One lesson per bullet. Be concise (one sentence).
8+
4. **No duplicates** — Before appending, check if an equivalent lesson already exists.
9+
5. **Never delete lessons** — Only add. If a lesson becomes outdated, append a new one that supersedes it.

.cursor/rules/lessons.mdc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../.agents/rules/lessons.mdc

docs/research/dx-improvements.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# DX Improvements — Research
2+
3+
Candidates for improving developer experience, agent ergonomics, and tooling.
4+
5+
---
6+
7+
## 1. `.agents/lessons.md` convention
8+
9+
**Type:** Doc | **Effort:** ~10 min
10+
11+
Add a persistent lessons file that agents update after corrections. Prevents repeating the same mistakes across sessions. Convention: agents check it before starting, append after corrections.
12+
13+
---
14+
15+
## 2. `--performance` CLI flag
16+
17+
**Type:** Code | **Effort:** ~2-4 hr
18+
19+
Instrument key phases (glob, parse, resolve, insert, index creation) with `perf_hooks` timerify. A `--performance` flag prints a timing breakdown after indexing. Helps users and devs diagnose slow runs without external profiling tools.
20+
21+
Current state: `index-engine.ts` already captures total elapsed ms via `performance.now()`, and `benchmark.ts` measures query speed and reindex speed externally. The gap is per-phase granularity from the CLI itself.
22+
23+
---
24+
25+
## 3. Adapter scaffolding script
26+
27+
**Type:** Code | **Effort:** ~2-4 hr
28+
29+
`codemap create-adapter --name [name]` generates boilerplate for a community language adapter: adapter file, test file, fixture directory. Lowers the barrier for contributors building adapters for new languages.
30+
31+
Prerequisite: community adapter registration API (on roadmap). Scaffolding could land independently with a manual registration step if the API isn't ready.
32+
33+
---
34+
35+
## 4. AST-based config resolution
36+
37+
**Type:** Code | **Effort:** ~2-4 hr
38+
39+
For `codemap.config.ts`, consider AST-based extraction (via `oxc-parser`, already a dependency) instead of executing the config with native `import()` (ESM dynamic import). Faster, no side effects, safer in untrusted repos. JSON configs are already safe.
40+
41+
Trade-off: AST-based can't handle dynamic configs (the current loader supports async functions returning config). Could offer both paths — AST-first with `import()` fallback.
42+
43+
---
44+
45+
## 5. Watch mode
46+
47+
**Type:** Code | **Effort:** ~4-8 hr | **Status:** On roadmap backlog
48+
49+
`node:fs.watch` with `{ recursive: true }` + incremental re-index of changed files. The existing incremental/targeted model (`--files`) already supports the core loop — the gap is the file-watching shell and session management.
50+
51+
Platform note: `recursive: true` on Linux requires Node 19.1+ and behaves differently from macOS FSEvents — may need a fallback or documented minimum.
52+
53+
---
54+
55+
## 6. MCP server wrapping `query`
56+
57+
**Type:** Code | **Effort:** ~4-8 hr | **Status:** On roadmap backlog
58+
59+
Expose `query` as an MCP tool so agents in any IDE can run SQL against the index without shell access. Minimal surface: one tool (run SQL, return rows). Could be a separate entry point or package.
60+
61+
---
62+
63+
## 7. Monorepo / workspace awareness
64+
65+
**Type:** Code | **Effort:** ~8+ hr | **Status:** On roadmap backlog
66+
67+
Discover workspaces from `pnpm-workspace.yaml` / `package.json` workspaces and index per-workspace dependency graphs. Currently Codemap indexes one root — workspace-aware indexing would give more precise `dependencies` edges in monorepos.

0 commit comments

Comments
 (0)