revert: remove codebase intelligence system
Rolled back the intel system due to overengineering concerns: - 1200+ line hook with SQLite graph database - 21MB sql.js dependency - Entity generation spawning additional Claude calls - Complex system with unclear value Removed: - /gsd:analyze-codebase command - /gsd:query-intel command - gsd-intel-index.js, gsd-intel-session.js, gsd-intel-prune.js hooks - gsd-entity-generator, gsd-indexer agents - entity.md template - sql.js dependency Preserved: - Model profiles feature - Statusline hook - All other v1.9.x improvements -3,065 lines removed Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,173 +0,0 @@
|
||||
# Entity Template
|
||||
|
||||
Template for `.planning/codebase/{entity-slug}.md` - file-level intelligence documentation.
|
||||
|
||||
---
|
||||
|
||||
## File Template
|
||||
|
||||
```markdown
|
||||
---
|
||||
path: {path}
|
||||
type: {type}
|
||||
updated: {updated}
|
||||
status: {status}
|
||||
---
|
||||
|
||||
# {filename}
|
||||
|
||||
## Purpose
|
||||
|
||||
{purpose}
|
||||
|
||||
## Exports
|
||||
|
||||
{exports}
|
||||
|
||||
## Dependencies
|
||||
|
||||
{dependencies}
|
||||
|
||||
## Used By
|
||||
|
||||
{used_by}
|
||||
|
||||
## Notes
|
||||
|
||||
{notes}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Field Reference
|
||||
|
||||
### Frontmatter
|
||||
|
||||
| Field | Values | Description |
|
||||
|-------|--------|-------------|
|
||||
| `path` | Absolute path | Full path to the file |
|
||||
| `type` | module, component, util, config, test, api, hook | Primary classification |
|
||||
| `updated` | YYYY-MM-DD | Last time this entity was updated |
|
||||
| `status` | active, deprecated, stub | Current state |
|
||||
|
||||
### Sections
|
||||
|
||||
**Purpose** (required)
|
||||
1-3 sentences covering:
|
||||
- What this file does
|
||||
- Why it exists
|
||||
- Who/what uses it (high-level)
|
||||
|
||||
**Exports** (required for modules with exports)
|
||||
List each export with signature and description:
|
||||
```markdown
|
||||
- `functionName(arg: Type): ReturnType` - What it does
|
||||
- `ClassName` - What it represents
|
||||
- `CONSTANT_NAME` - What value it holds
|
||||
```
|
||||
|
||||
For files without exports (config, tests), write "None" or describe what the file defines.
|
||||
|
||||
**Dependencies** (required)
|
||||
Internal dependencies use wiki-links (slugified paths):
|
||||
```markdown
|
||||
- [[src-lib-db]] - Database client
|
||||
- [[src-types-user]] - User type definitions
|
||||
```
|
||||
|
||||
External dependencies use plain text:
|
||||
```markdown
|
||||
- react - Component framework
|
||||
- jose - JWT handling
|
||||
```
|
||||
|
||||
**Used By** (grows over time)
|
||||
Files that import this one, using wiki-links:
|
||||
```markdown
|
||||
- [[src-app-api-auth-route]]
|
||||
- [[src-components-dashboard]]
|
||||
```
|
||||
|
||||
Initially may be empty or incomplete. Updated as Claude encounters imports.
|
||||
|
||||
**Notes** (optional)
|
||||
Patterns, gotchas, or context:
|
||||
```markdown
|
||||
- Uses singleton pattern for connection pooling
|
||||
- WARNING: Must call `init()` before any other method
|
||||
- Related: See [[src-lib-cache]] for caching layer
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Slug Convention
|
||||
|
||||
Entity slugs are derived from file paths:
|
||||
- `src/lib/db.ts` becomes `src-lib-db`
|
||||
- `src/app/api/auth/route.ts` becomes `src-app-api-auth-route`
|
||||
|
||||
Rule: Replace `/` and `.` with `-`, drop file extension.
|
||||
|
||||
---
|
||||
|
||||
## Example
|
||||
|
||||
```markdown
|
||||
---
|
||||
path: /project/src/lib/auth.ts
|
||||
type: util
|
||||
updated: 2025-01-15
|
||||
status: active
|
||||
---
|
||||
|
||||
# auth.ts
|
||||
|
||||
## Purpose
|
||||
|
||||
JWT token management using jose library. Handles token creation, verification, and refresh rotation. Used by all protected API routes via middleware.
|
||||
|
||||
## Exports
|
||||
|
||||
- `createAccessToken(userId: string): Promise<string>` - Creates 15-min access token
|
||||
- `createRefreshToken(userId: string): Promise<string>` - Creates 7-day refresh token
|
||||
- `verifyToken(token: string): Promise<TokenPayload>` - Validates and decodes token
|
||||
- `rotateRefresh(oldToken: string): Promise<TokenPair>` - Issues new token pair
|
||||
|
||||
## Dependencies
|
||||
|
||||
- [[src-lib-db]] - Stores refresh tokens for revocation
|
||||
- [[src-types-auth]] - TokenPayload, TokenPair types
|
||||
- jose - JWT signing and verification
|
||||
- bcrypt - Password hashing
|
||||
|
||||
## Used By
|
||||
|
||||
- [[src-middleware]]
|
||||
- [[src-app-api-auth-login-route]]
|
||||
- [[src-app-api-auth-logout-route]]
|
||||
- [[src-app-api-auth-refresh-route]]
|
||||
|
||||
## Notes
|
||||
|
||||
- Access tokens are stateless; refresh tokens stored in DB for revocation
|
||||
- Uses RS256 algorithm with keys from environment
|
||||
- WARNING: Never log token values, even in debug mode
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Guidelines
|
||||
|
||||
**When to create/update:**
|
||||
- After modifying a file during plan execution
|
||||
- When encountering a file that lacks documentation
|
||||
- When relationships change (new imports, exports)
|
||||
|
||||
**Minimal viable entity:**
|
||||
At minimum, an entity needs frontmatter + Purpose. Other sections can be "TBD" if unknown.
|
||||
|
||||
**Accuracy over completeness:**
|
||||
Better to have partial accurate info than complete guesses. Mark unknowns explicitly.
|
||||
|
||||
**Link discovery:**
|
||||
The hook that processes entities extracts all `[[wiki-links]]` to build the relationship graph. Ensure links use correct slug format.
|
||||
@@ -598,8 +598,7 @@ Execute each task in the prompt. **Deviations are normal** - handle them automat
|
||||
- Continue implementing, applying rules as needed
|
||||
- Run the verification
|
||||
- Confirm done criteria met
|
||||
- **Update intel entities** for modified files (see `<update_intel_entity>` below)
|
||||
- **Commit the task** (see `<task_commit>` below) - includes entity files in commit
|
||||
- **Commit the task** (see `<task_commit>` below)
|
||||
- Track task completion and commit hash for Summary documentation
|
||||
- Continue to next task
|
||||
|
||||
@@ -928,148 +927,6 @@ None - plan executed exactly as written.
|
||||
|
||||
</deviation_documentation>
|
||||
|
||||
<update_intel_entity>
|
||||
|
||||
## Update Codebase Intelligence Entity
|
||||
|
||||
**Trigger:** After each task's `<done>` criteria met, BEFORE committing.
|
||||
|
||||
This step documents your understanding of modified files. The knowledge base self-evolves as you work.
|
||||
|
||||
**1. Get files from the just-completed task:**
|
||||
|
||||
Check the task's `<files>` list. If no `<files>` attribute, use `git status --short` to identify modified files.
|
||||
|
||||
**2. For each file, determine if significant:**
|
||||
|
||||
**Skip these patterns (not worth indexing):**
|
||||
```bash
|
||||
# Build/generated
|
||||
node_modules/*, .next/*, dist/*, build/*, .git/*
|
||||
|
||||
# Tests (their targets are more valuable)
|
||||
*.test.*, *.spec.*, __tests__/*, __mocks__/*
|
||||
|
||||
# Config files (change rarely, low context value)
|
||||
package.json, package-lock.json, tsconfig.json, *.config.*, *.config.js, *.config.ts
|
||||
|
||||
# Environment and locks
|
||||
.env*, *.lock, *.log, yarn.lock, pnpm-lock.yaml
|
||||
```
|
||||
|
||||
If file matches skip pattern: continue to next file.
|
||||
|
||||
**3. Derive entity path:**
|
||||
|
||||
```bash
|
||||
# Convert file path to entity filename
|
||||
# src/lib/auth.ts → src-lib-auth.md
|
||||
# app/api/users/route.ts → app-api-users-route.md
|
||||
|
||||
FILE_PATH="$1"
|
||||
ENTITY_NAME=$(echo "$FILE_PATH" | sed 's|^[./]*||' | tr '/' '-' | sed 's/\.[^.]*$//')
|
||||
ENTITY_PATH=".planning/intel/entities/${ENTITY_NAME}.md"
|
||||
```
|
||||
|
||||
**4. Create intel directory if needed:**
|
||||
|
||||
```bash
|
||||
mkdir -p .planning/intel/entities
|
||||
```
|
||||
|
||||
**5. Check if entity exists:**
|
||||
|
||||
```bash
|
||||
if [ -f "$ENTITY_PATH" ]; then
|
||||
ACTION="update"
|
||||
else
|
||||
ACTION="create"
|
||||
fi
|
||||
```
|
||||
|
||||
**6. Create or update entity:**
|
||||
|
||||
Use template from `~/.claude/get-shit-done/templates/entity.md`.
|
||||
|
||||
Fill fields based on what you just built:
|
||||
|
||||
| Field | Source |
|
||||
|-------|--------|
|
||||
| `path` | Absolute path to file |
|
||||
| `type` | Infer: module, component, util, config, api, hook |
|
||||
| `updated` | Today's date (YYYY-MM-DD) |
|
||||
| `status` | active (unless you're deprecating) |
|
||||
| **Purpose** | What you understand this file does |
|
||||
| **Exports** | Extract from the code you just wrote |
|
||||
| **Dependencies** | `[[slugified-path]]` for internal, plain for external |
|
||||
| **Used By** | Add callers if you know them from this session |
|
||||
| **Notes** | Gotchas, patterns, warnings discovered |
|
||||
|
||||
**If updating existing entity:**
|
||||
- Read current content first
|
||||
- Preserve Used By entries you didn't touch
|
||||
- Update sections that changed
|
||||
- Don't remove information unless it's wrong
|
||||
|
||||
**7. Write entity file:**
|
||||
|
||||
```bash
|
||||
# Write the entity content
|
||||
cat > "$ENTITY_PATH" << 'EOF'
|
||||
---
|
||||
path: {path}
|
||||
type: {type}
|
||||
updated: {today}
|
||||
status: active
|
||||
---
|
||||
|
||||
# {filename}
|
||||
|
||||
## Purpose
|
||||
|
||||
{purpose}
|
||||
|
||||
## Exports
|
||||
|
||||
{exports}
|
||||
|
||||
## Dependencies
|
||||
|
||||
{dependencies}
|
||||
|
||||
## Used By
|
||||
|
||||
{used_by}
|
||||
|
||||
## Notes
|
||||
|
||||
{notes}
|
||||
EOF
|
||||
```
|
||||
|
||||
**8. Verify entity was created/updated:**
|
||||
|
||||
```bash
|
||||
head -10 "$ENTITY_PATH"
|
||||
```
|
||||
|
||||
**9. Stage entity file:**
|
||||
|
||||
Entity files are staged along with task code files in the task commit.
|
||||
|
||||
```bash
|
||||
git add "$ENTITY_PATH"
|
||||
```
|
||||
|
||||
**Error handling:**
|
||||
- If entity creation fails: Log warning, continue to task_commit
|
||||
- Entity update is NOT blocking - a failed entity shouldn't stop code from being committed
|
||||
- Log: `"Warning: Could not update entity for {file}: {reason}"`
|
||||
|
||||
**Target size:** Keep entities concise (30-50 lines). Purpose and Exports are most valuable.
|
||||
|
||||
</update_intel_entity>
|
||||
|
||||
<tdd_plan_execution>
|
||||
## TDD Plan Execution
|
||||
|
||||
|
||||
Reference in New Issue
Block a user