sqlew 4.0.5 → 4.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1817 -1782
- package/README.md +409 -468
- package/assets/claude-md-snippets/plan-mode-integration.md +17 -6
- package/assets/config.example.toml +282 -284
- package/assets/sample-agents/README.md +36 -40
- package/assets/sample-agents/sqlew-architect.md +321 -322
- package/assets/sample-agents/sqlew-researcher.md +292 -293
- package/assets/sample-agents/sqlew-scrum-master.md +286 -287
- package/assets/sample-commands/README.md +56 -57
- package/assets/sample-skills/sqlew-plan-guidance/SKILL.md +33 -26
- package/dist/cli/hooks/check-completion.d.ts +19 -0
- package/dist/cli/hooks/check-completion.d.ts.map +1 -0
- package/dist/cli/hooks/check-completion.js +104 -0
- package/dist/cli/hooks/check-completion.js.map +1 -0
- package/dist/cli/hooks/init-hooks.d.ts +35 -0
- package/dist/cli/hooks/init-hooks.d.ts.map +1 -0
- package/dist/cli/hooks/init-hooks.js +425 -0
- package/dist/cli/hooks/init-hooks.js.map +1 -0
- package/dist/cli/hooks/mark-done.d.ts +25 -0
- package/dist/cli/hooks/mark-done.d.ts.map +1 -0
- package/dist/cli/hooks/mark-done.js +128 -0
- package/dist/cli/hooks/mark-done.js.map +1 -0
- package/dist/cli/hooks/plan-id-utils.d.ts +83 -0
- package/dist/cli/hooks/plan-id-utils.d.ts.map +1 -0
- package/dist/cli/hooks/plan-id-utils.js +183 -0
- package/dist/cli/hooks/plan-id-utils.js.map +1 -0
- package/dist/cli/hooks/save.d.ts +23 -0
- package/dist/cli/hooks/save.d.ts.map +1 -0
- package/dist/cli/hooks/save.js +90 -0
- package/dist/cli/hooks/save.js.map +1 -0
- package/dist/cli/hooks/stdin-parser.d.ts +139 -0
- package/dist/cli/hooks/stdin-parser.d.ts.map +1 -0
- package/dist/cli/hooks/stdin-parser.js +127 -0
- package/dist/cli/hooks/stdin-parser.js.map +1 -0
- package/dist/cli/hooks/suggest.d.ts +19 -0
- package/dist/cli/hooks/suggest.d.ts.map +1 -0
- package/dist/cli/hooks/suggest.js +157 -0
- package/dist/cli/hooks/suggest.js.map +1 -0
- package/dist/cli/hooks/track-plan.d.ts +36 -0
- package/dist/cli/hooks/track-plan.d.ts.map +1 -0
- package/dist/cli/hooks/track-plan.js +152 -0
- package/dist/cli/hooks/track-plan.js.map +1 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +56 -16
- package/dist/cli.js.map +1 -1
- package/dist/config/global-config.d.ts +187 -0
- package/dist/config/global-config.d.ts.map +1 -0
- package/dist/config/global-config.js +206 -0
- package/dist/config/global-config.js.map +1 -0
- package/dist/config/loader.d.ts +42 -0
- package/dist/config/loader.d.ts.map +1 -1
- package/dist/config/loader.js +96 -0
- package/dist/config/loader.js.map +1 -1
- package/dist/constants.d.ts +4 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +10 -0
- package/dist/constants.js.map +1 -1
- package/dist/database/migrations/v4/20251126000000_v4_bootstrap.js +59 -59
- package/dist/database/migrations/v4/20251126000000_v4_bootstrap.js.map +1 -1
- package/dist/database/migrations/v4/20251126000001_v4_migrate_data.js +33 -33
- package/dist/database/migrations/v4/20251126000001_v4_migrate_data.js.map +1 -1
- package/dist/database/migrations/v4/20251127000000_add_rejected_status.js +7 -7
- package/dist/database/migrations/v4/20251127000000_add_rejected_status.js.map +1 -1
- package/dist/database/migrations/v4/20251127000001_update_task_move_help.js +11 -11
- package/dist/database/migrations/v4/20251127000001_update_task_move_help.js.map +1 -1
- package/dist/database/migrations/v4/20251127000002_v4_seed_help_system.js +10 -10
- package/dist/database/migrations/v4/20251127000002_v4_seed_help_system.js.map +1 -1
- package/dist/database/migrations/v4/20251127000003_add_task_notes_column.js +7 -7
- package/dist/database/migrations/v4/20251127000003_add_task_notes_column.js.map +1 -1
- package/dist/database/migrations/v4/20251128000000_drop_all_views.js +8 -8
- package/dist/database/migrations/v4/20251128000000_drop_all_views.js.map +1 -1
- package/dist/database/operations/queries.d.ts.map +1 -1
- package/dist/database/operations/queries.js +11 -2
- package/dist/database/operations/queries.js.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/init-agents.js +0 -1
- package/dist/init-agents.js.map +1 -1
- package/dist/init-skills.d.ts +4 -3
- package/dist/init-skills.d.ts.map +1 -1
- package/dist/init-skills.js +10 -3
- package/dist/init-skills.js.map +1 -1
- package/dist/server/setup.d.ts +8 -0
- package/dist/server/setup.d.ts.map +1 -1
- package/dist/server/setup.js +141 -21
- package/dist/server/setup.js.map +1 -1
- package/dist/sync-agents.d.ts.map +1 -1
- package/dist/sync-agents.js +48 -3
- package/dist/sync-agents.js.map +1 -1
- package/dist/sync-commands.d.ts.map +1 -1
- package/dist/sync-commands.js +43 -3
- package/dist/sync-commands.js.map +1 -1
- package/dist/tools/constraints/actions/get.d.ts.map +1 -1
- package/dist/tools/constraints/actions/get.js +5 -8
- package/dist/tools/constraints/actions/get.js.map +1 -1
- package/dist/tools/constraints/help/help.d.ts.map +1 -1
- package/dist/tools/constraints/help/help.js +1 -6
- package/dist/tools/constraints/help/help.js.map +1 -1
- package/dist/tools/context/actions/get.d.ts.map +1 -1
- package/dist/tools/context/actions/get.js.map +1 -1
- package/dist/tools/context/actions/search-layer.d.ts.map +1 -1
- package/dist/tools/context/actions/search-layer.js +5 -3
- package/dist/tools/context/actions/search-layer.js.map +1 -1
- package/dist/tools/context/actions/set-from-policy.d.ts +2 -1
- package/dist/tools/context/actions/set-from-policy.d.ts.map +1 -1
- package/dist/tools/context/actions/set-from-policy.js.map +1 -1
- package/dist/tools/context/help/help.d.ts.map +1 -1
- package/dist/tools/context/help/help.js +1 -7
- package/dist/tools/context/help/help.js.map +1 -1
- package/dist/tools/context/internal/queries.d.ts.map +1 -1
- package/dist/tools/context/internal/queries.js +5 -2
- package/dist/tools/context/internal/queries.js.map +1 -1
- package/dist/tools/context/types.d.ts +1 -1
- package/dist/tools/context/types.d.ts.map +1 -1
- package/dist/tools/files/actions/get.d.ts.map +1 -1
- package/dist/tools/files/actions/get.js +4 -6
- package/dist/tools/files/actions/get.js.map +1 -1
- package/dist/tools/files/help/help.d.ts.map +1 -1
- package/dist/tools/files/help/help.js +1 -6
- package/dist/tools/files/help/help.js.map +1 -1
- package/dist/tools/suggest/help/constraint-help.d.ts.map +1 -1
- package/dist/tools/suggest/help/constraint-help.js +0 -2
- package/dist/tools/suggest/help/constraint-help.js.map +1 -1
- package/dist/tools/suggest/internal/constraint-queries.d.ts.map +1 -1
- package/dist/tools/suggest/internal/constraint-queries.js +12 -5
- package/dist/tools/suggest/internal/constraint-queries.js.map +1 -1
- package/dist/tools/suggest/internal/queries.js +2 -2
- package/dist/tools/suggest/internal/queries.js.map +1 -1
- package/dist/tools/tasks/help/help.d.ts.map +1 -1
- package/dist/tools/tasks/help/help.js +0 -6
- package/dist/tools/tasks/help/help.js.map +1 -1
- package/dist/tools/tasks/help/use-case.d.ts.map +1 -1
- package/dist/tools/tasks/help/use-case.js +0 -1
- package/dist/tools/tasks/help/use-case.js.map +1 -1
- package/dist/tools/tasks/watcher/status.d.ts.map +1 -1
- package/dist/tools/tasks/watcher/status.js +5 -1
- package/dist/tools/tasks/watcher/status.js.map +1 -1
- package/dist/types/decision/params.d.ts +7 -6
- package/dist/types/decision/params.d.ts.map +1 -1
- package/dist/types/decision/templates.d.ts +3 -2
- package/dist/types/decision/templates.d.ts.map +1 -1
- package/dist/types/view-entities.d.ts +2 -1
- package/dist/types/view-entities.d.ts.map +1 -1
- package/dist/types.d.ts +19 -11
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +4 -1
- package/dist/types.js.map +1 -1
- package/dist/utils/enum-converter.d.ts +72 -0
- package/dist/utils/enum-converter.d.ts.map +1 -0
- package/dist/utils/enum-converter.js +76 -0
- package/dist/utils/enum-converter.js.map +1 -0
- package/dist/utils/hook-queue.d.ts +81 -0
- package/dist/utils/hook-queue.d.ts.map +1 -0
- package/dist/utils/hook-queue.js +156 -0
- package/dist/utils/hook-queue.js.map +1 -0
- package/dist/utils/project-root.d.ts +9 -2
- package/dist/utils/project-root.d.ts.map +1 -1
- package/dist/utils/project-root.js +16 -2
- package/dist/utils/project-root.js.map +1 -1
- package/dist/utils/tag-parser.d.ts.map +1 -1
- package/dist/utils/tag-parser.js +6 -0
- package/dist/utils/tag-parser.js.map +1 -1
- package/dist/utils/universal-knex.js +3 -3
- package/dist/utils/universal-knex.js.map +1 -1
- package/dist/utils/validators.d.ts +1 -1
- package/dist/utils/validators.d.ts.map +1 -1
- package/dist/utils/validators.js +1 -1
- package/dist/utils/validators.js.map +1 -1
- package/dist/utils/vcs-adapter.d.ts +44 -0
- package/dist/utils/vcs-adapter.d.ts.map +1 -1
- package/dist/utils/vcs-adapter.js +88 -0
- package/dist/utils/vcs-adapter.js.map +1 -1
- package/dist/utils/view-queries.d.ts.map +1 -1
- package/dist/utils/view-queries.js +9 -19
- package/dist/utils/view-queries.js.map +1 -1
- package/dist/watcher/base-watcher.d.ts +69 -0
- package/dist/watcher/base-watcher.d.ts.map +1 -0
- package/dist/watcher/base-watcher.js +130 -0
- package/dist/watcher/base-watcher.js.map +1 -0
- package/dist/watcher/index.d.ts +3 -0
- package/dist/watcher/index.d.ts.map +1 -1
- package/dist/watcher/index.js +2 -0
- package/dist/watcher/index.js.map +1 -1
- package/dist/watcher/queue-watcher.d.ts +64 -0
- package/dist/watcher/queue-watcher.d.ts.map +1 -0
- package/dist/watcher/queue-watcher.js +187 -0
- package/dist/watcher/queue-watcher.js.map +1 -0
- package/docs/ADR_CONCEPTS.md +140 -0
- package/docs/CONFIGURATION.md +922 -925
- package/docs/CROSS_DATABASE.md +153 -0
- package/docs/DATABASE_AUTH.md +70 -356
- package/docs/HOOKS_GUIDE.md +159 -0
- package/docs/SLASH_COMMANDS.md +329 -337
- package/docs/TASK_SYSTEM_DEPRECATED.md +88 -0
- package/docs/changelogs/CHANGELOG_ARCHIVE_v3.4_and_older.md +293 -296
- package/docs/cli/DATA_EXPORT_IMPORT.md +699 -700
- package/docs/cli/README.md +276 -277
- package/package.json +123 -124
- package/docs/ACCEPTANCE_CRITERIA.md +0 -625
- package/docs/AI_AGENT_GUIDE.md +0 -299
- package/docs/ARCHITECTURE.md +0 -167
- package/docs/AUTO_FILE_TRACKING.md +0 -841
- package/docs/BATCH_VALIDATION.md +0 -617
- package/docs/BEST_PRACTICES.md +0 -168
- package/docs/CONSTRAINT_INTELLIGENCE.md +0 -339
- package/docs/DECISION_CONTEXT.md +0 -697
- package/docs/DECISION_INTELLIGENCE.md +0 -605
- package/docs/GIT_AWARE_AUTO_COMPLETE.md +0 -646
- package/docs/MIGRATION_GUIDE_V3.9.0.md +0 -371
- package/docs/SHARED_CONCEPTS.md +0 -225
- package/docs/SPECIALIZED_AGENTS.md +0 -126
- package/docs/TASK_ACTIONS.md +0 -1177
- package/docs/TASK_OVERVIEW.md +0 -452
- package/docs/TASK_PRUNING.md +0 -594
- package/docs/TOOL_REFERENCE.md +0 -1077
- package/docs/TOOL_SELECTION.md +0 -83
- package/docs/WORKFLOWS.md +0 -941
package/docs/AI_AGENT_GUIDE.md
DELETED
|
@@ -1,299 +0,0 @@
|
|
|
1
|
-
# AI Agent Guide for sqlew ADR System
|
|
2
|
-
|
|
3
|
-
**Quick Reference for Claude Code and other AI agents using sqlew (v4.0.0+)**
|
|
4
|
-
|
|
5
|
-
## What is sqlew?
|
|
6
|
-
|
|
7
|
-
sqlew is an **ADR (Architecture Decision Record) system designed for AI agents**. It enables you to create, query, and maintain structured architectural decisions in a SQL database, providing persistent context across sessions.
|
|
8
|
-
|
|
9
|
-
### Core Concept: ADR for AI
|
|
10
|
-
|
|
11
|
-
Traditional ADR uses Markdown files. sqlew brings ADR to AI agents through **RDBMS + MCP**:
|
|
12
|
-
|
|
13
|
-
**RDBMS (Relational Database)** enables efficient operations:
|
|
14
|
-
- **Indexed queries** – Find decisions by tags/layers in milliseconds
|
|
15
|
-
- **JOIN operations** – Query related decisions, constraints, and tasks together
|
|
16
|
-
- **Transaction safety** – ACID guarantees prevent data corruption
|
|
17
|
-
- **Scalability** – Handle thousands of ADRs without slowdown
|
|
18
|
-
|
|
19
|
-
**MCP (Model Context Protocol)** provides AI-native access:
|
|
20
|
-
- **Native tool calls** – AI agents use ADR as built-in functions
|
|
21
|
-
- **Structured parameters** – Type-safe, validated inputs prevent errors
|
|
22
|
-
- **Token efficiency** – Retrieve only required data (60-75% reduction)
|
|
23
|
-
- **Session persistence** – ADRs survive beyond individual conversations
|
|
24
|
-
|
|
25
|
-
**Result**: AI agents query ADRs like database operations, not file reads.
|
|
26
|
-
|
|
27
|
-
---
|
|
28
|
-
|
|
29
|
-
## Most Important Rule
|
|
30
|
-
|
|
31
|
-
**ALWAYS include the `action` parameter in EVERY tool call.** This is the #1 cause of errors.
|
|
32
|
-
|
|
33
|
-
```javascript
|
|
34
|
-
// WRONG - Missing action
|
|
35
|
-
{
|
|
36
|
-
key: "auth_method",
|
|
37
|
-
value: "jwt"
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// CORRECT - action parameter present
|
|
41
|
-
{
|
|
42
|
-
action: "set",
|
|
43
|
-
key: "auth_method",
|
|
44
|
-
value: "jwt"
|
|
45
|
-
}
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
---
|
|
49
|
-
|
|
50
|
-
## Quick Start: Creating Your First ADR
|
|
51
|
-
|
|
52
|
-
### Basic ADR Workflow
|
|
53
|
-
|
|
54
|
-
```javascript
|
|
55
|
-
// 1. Record an architectural decision
|
|
56
|
-
{
|
|
57
|
-
action: "set",
|
|
58
|
-
key: "auth_method",
|
|
59
|
-
value: "We chose JWT authentication over session-based auth. JWT enables stateless API design and better horizontal scaling. Session-based auth was rejected due to scaling concerns with shared session stores.",
|
|
60
|
-
layer: "business",
|
|
61
|
-
tags: ["security", "authentication", "api"]
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// 2. Retrieve the decision
|
|
65
|
-
{
|
|
66
|
-
action: "get",
|
|
67
|
-
key: "auth_method"
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
// 3. Search for related decisions
|
|
71
|
-
{
|
|
72
|
-
action: "list",
|
|
73
|
-
tags: ["authentication"],
|
|
74
|
-
status: "active"
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
// 4. Add architectural constraint
|
|
78
|
-
{
|
|
79
|
-
action: "add",
|
|
80
|
-
category: "security",
|
|
81
|
-
constraint_text: "All authentication must use JWT with RS256 signing algorithm",
|
|
82
|
-
layer: "business"
|
|
83
|
-
}
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
---
|
|
87
|
-
|
|
88
|
-
## When to Use Each Tool
|
|
89
|
-
|
|
90
|
-
### Core ADR Tools
|
|
91
|
-
|
|
92
|
-
| Tool | ADR Purpose | Key Feature |
|
|
93
|
-
|------|-------------|-------------|
|
|
94
|
-
| **decision** | Record architectural decisions | Full version history, alternatives tracking |
|
|
95
|
-
| **constraint** | Define architectural principles | Category-based rules, validation support |
|
|
96
|
-
| **task** | Track decision implementation | Links to decisions, status tracking |
|
|
97
|
-
| **file** | Document impacted code | Shows which files implement decisions |
|
|
98
|
-
| **suggest** | Find similar decisions | Prevent duplicate ADRs, detect conflicts |
|
|
99
|
-
|
|
100
|
-
### Utility Tools
|
|
101
|
-
|
|
102
|
-
| Tool | Purpose | When to Use |
|
|
103
|
-
|------|---------|-------------|
|
|
104
|
-
| **help** | Query action parameters | Need to check available parameters for an action |
|
|
105
|
-
| **example** | Browse code examples | Want to see working code snippets |
|
|
106
|
-
| **use_case** | Learn complete workflows | Need end-to-end multi-step scenarios |
|
|
107
|
-
|
|
108
|
-
> **Note**: Utility tools provide documentation and examples without affecting your ADR data.
|
|
109
|
-
|
|
110
|
-
### Understanding the ADR Data Model
|
|
111
|
-
|
|
112
|
-
| Concept | ADR Equivalent | Example |
|
|
113
|
-
|---------|----------------|---------|
|
|
114
|
-
| **Decision** | Architecture Decision Record | "We chose PostgreSQL over MongoDB for ACID compliance" |
|
|
115
|
-
| **Constraint** | Architectural Principle/Rule | "All database queries must use prepared statements" |
|
|
116
|
-
| **Task** | Implementation Action | "Migrate user authentication to JWT" |
|
|
117
|
-
| **File** | Impacted Component | "Modified auth.ts to implement JWT" |
|
|
118
|
-
|
|
119
|
-
### Complete ADR Workflow Example
|
|
120
|
-
|
|
121
|
-
```javascript
|
|
122
|
-
// 1. Record decision with full context
|
|
123
|
-
{
|
|
124
|
-
action: "set",
|
|
125
|
-
key: "database_choice",
|
|
126
|
-
value: "PostgreSQL selected for production database. Alternatives considered: MongoDB (rejected: no ACID), MySQL (rejected: weaker JSON support). PostgreSQL chosen for ACID compliance, mature ecosystem, and superior JSON handling.",
|
|
127
|
-
layer: "data",
|
|
128
|
-
tags: ["database", "postgresql", "architecture"]
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
// 2. Define constraints based on decision
|
|
132
|
-
{
|
|
133
|
-
action: "add",
|
|
134
|
-
category: "database",
|
|
135
|
-
constraint_text: "All database operations must use connection pooling with max 20 connections",
|
|
136
|
-
layer: "data"
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
// 3. Create implementation task
|
|
140
|
-
{
|
|
141
|
-
action: "create",
|
|
142
|
-
title: "Set up PostgreSQL connection pool",
|
|
143
|
-
description: "Implement connection pooling as per database_choice ADR",
|
|
144
|
-
layer: "data",
|
|
145
|
-
tags: ["database", "postgresql"]
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
// 4. Track file changes
|
|
149
|
-
{
|
|
150
|
-
action: "set",
|
|
151
|
-
path: "src/db/connection.ts",
|
|
152
|
-
description: "PostgreSQL connection pool implementation",
|
|
153
|
-
layer: "data"
|
|
154
|
-
}
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
---
|
|
158
|
-
|
|
159
|
-
## Common Errors & Solutions
|
|
160
|
-
|
|
161
|
-
### Error: "Unknown action: undefined"
|
|
162
|
-
|
|
163
|
-
**Cause**: Missing `action` parameter
|
|
164
|
-
|
|
165
|
-
```javascript
|
|
166
|
-
// WRONG
|
|
167
|
-
{ key: "some_key", value: "some value" }
|
|
168
|
-
|
|
169
|
-
// CORRECT
|
|
170
|
-
{ action: "set", key: "some_key", value: "some value" }
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
### Error: "Invalid layer"
|
|
174
|
-
|
|
175
|
-
**Valid layers** (9 total):
|
|
176
|
-
- `presentation`, `business`, `data`, `infrastructure`, `cross-cutting`
|
|
177
|
-
- `documentation`, `planning`, `coordination`, `review`
|
|
178
|
-
|
|
179
|
-
### Error: "Invalid status"
|
|
180
|
-
|
|
181
|
-
**Valid decision statuses**: `active`, `deprecated`, `draft`
|
|
182
|
-
|
|
183
|
-
**Valid task statuses**: `pending`, `in_progress`, `blocked`, `on_hold`, `completed`
|
|
184
|
-
|
|
185
|
-
### Error: "Batch operations are limited to 50 items maximum"
|
|
186
|
-
|
|
187
|
-
**Solution**: Split into multiple batches of ≤50 items each
|
|
188
|
-
|
|
189
|
-
---
|
|
190
|
-
|
|
191
|
-
## Key Parameters Quick Reference
|
|
192
|
-
|
|
193
|
-
### decision tool
|
|
194
|
-
|
|
195
|
-
| Action | Required | Optional |
|
|
196
|
-
|--------|----------|----------|
|
|
197
|
-
| **set** | action, key, value, layer | version, status, tags, scopes |
|
|
198
|
-
| **get** | action, key | version |
|
|
199
|
-
| **list** | action | status, layer, tags, limit |
|
|
200
|
-
|
|
201
|
-
### task tool
|
|
202
|
-
|
|
203
|
-
| Action | Required | Optional |
|
|
204
|
-
|--------|----------|----------|
|
|
205
|
-
| **create** | action, title | description, priority, layer, tags, status |
|
|
206
|
-
| **move** | action, task_id, status | - |
|
|
207
|
-
| **list** | action | status, layer, tags, limit |
|
|
208
|
-
|
|
209
|
-
### constraint tool
|
|
210
|
-
|
|
211
|
-
| Action | Required | Optional |
|
|
212
|
-
|--------|----------|----------|
|
|
213
|
-
| **add** | action, category, constraint_text | priority, layer, tags |
|
|
214
|
-
| **get** | action | category, layer, active_only |
|
|
215
|
-
|
|
216
|
-
> **Full parameter reference**: See [TOOL_REFERENCE.md](TOOL_REFERENCE.md)
|
|
217
|
-
|
|
218
|
-
---
|
|
219
|
-
|
|
220
|
-
## ADR Best Practices for AI Agents
|
|
221
|
-
|
|
222
|
-
### Writing Good ADRs
|
|
223
|
-
|
|
224
|
-
1. **Include rationale** - Explain WHY, not just WHAT
|
|
225
|
-
```javascript
|
|
226
|
-
// BAD: "Use PostgreSQL"
|
|
227
|
-
// GOOD: "Use PostgreSQL for ACID compliance (rejected MongoDB for lack of transactions)"
|
|
228
|
-
```
|
|
229
|
-
|
|
230
|
-
2. **Document alternatives** - Show what was considered and rejected
|
|
231
|
-
```javascript
|
|
232
|
-
value: "JWT chosen. Alternatives: session-based (rejected: scaling), OAuth (overkill for internal API)"
|
|
233
|
-
```
|
|
234
|
-
|
|
235
|
-
3. **Use descriptive keys** - Make decisions discoverable
|
|
236
|
-
```javascript
|
|
237
|
-
// BAD: key: "db"
|
|
238
|
-
// GOOD: key: "database_postgresql_production"
|
|
239
|
-
```
|
|
240
|
-
|
|
241
|
-
4. **Tag comprehensively** - Enable efficient searching
|
|
242
|
-
```javascript
|
|
243
|
-
tags: ["database", "postgresql", "production", "acid", "scalability"]
|
|
244
|
-
```
|
|
245
|
-
|
|
246
|
-
5. **Link related entities** - Connect decisions to implementation
|
|
247
|
-
```javascript
|
|
248
|
-
// Record decision → Create constraint → Make task → Track files
|
|
249
|
-
```
|
|
250
|
-
|
|
251
|
-
### Technical Best Practices
|
|
252
|
-
|
|
253
|
-
1. **Always include `action` parameter** - #1 error source
|
|
254
|
-
2. **Always specify `layer`** - Required for architectural organization
|
|
255
|
-
3. **Use `atomic: false` for batch operations** - Avoid all-or-nothing failures
|
|
256
|
-
4. **Check for duplicates first** - Use `suggest` tool before creating decisions
|
|
257
|
-
5. **Version important changes** - Increment version for significant updates
|
|
258
|
-
|
|
259
|
-
> **Detailed best practices**: See [BEST_PRACTICES.md](BEST_PRACTICES.md)
|
|
260
|
-
|
|
261
|
-
---
|
|
262
|
-
|
|
263
|
-
## Built-In Documentation
|
|
264
|
-
|
|
265
|
-
All tools provide built-in help with zero token cost:
|
|
266
|
-
|
|
267
|
-
```javascript
|
|
268
|
-
// Get detailed help for any tool
|
|
269
|
-
{ action: "help" }
|
|
270
|
-
|
|
271
|
-
// Get comprehensive examples
|
|
272
|
-
{ action: "example" }
|
|
273
|
-
```
|
|
274
|
-
|
|
275
|
-
---
|
|
276
|
-
|
|
277
|
-
## Related Documentation
|
|
278
|
-
|
|
279
|
-
| Document | Content |
|
|
280
|
-
|----------|---------|
|
|
281
|
-
| [TOOL_REFERENCE.md](TOOL_REFERENCE.md) | Complete parameter reference |
|
|
282
|
-
| [WORKFLOWS.md](WORKFLOWS.md) | Multi-step workflow examples |
|
|
283
|
-
| [BEST_PRACTICES.md](BEST_PRACTICES.md) | Detailed best practices |
|
|
284
|
-
| [DECISION_INTELLIGENCE.md](DECISION_INTELLIGENCE.md) | Decision duplicate detection |
|
|
285
|
-
| [CONSTRAINT_INTELLIGENCE.md](CONSTRAINT_INTELLIGENCE.md) | Constraint duplicate detection |
|
|
286
|
-
| [BATCH_VALIDATION.md](BATCH_VALIDATION.md) | Batch operations guide |
|
|
287
|
-
| [ARCHITECTURE.md](ARCHITECTURE.md) | System architecture |
|
|
288
|
-
|
|
289
|
-
---
|
|
290
|
-
|
|
291
|
-
## Most Common Mistakes
|
|
292
|
-
|
|
293
|
-
1. **Missing `action` parameter** ← #1 error!
|
|
294
|
-
2. Invalid layer/status values
|
|
295
|
-
3. Forgetting to specify `layer` when setting decisions
|
|
296
|
-
4. Using `atomic: true` by default in batch operations
|
|
297
|
-
5. Using `new_status` instead of `status` for task.move
|
|
298
|
-
|
|
299
|
-
**When in doubt**: Call `{action: "help"}` or `{action: "example"}`!
|
package/docs/ARCHITECTURE.md
DELETED
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
# sqlew Architecture Documentation
|
|
2
|
-
|
|
3
|
-
## Overview
|
|
4
|
-
|
|
5
|
-
sqlew (SQL Efficient Workflow) is an MCP server designed to achieve **72% token reduction** in context sharing between Claude Code agents through intelligent database design and metadata-driven architecture. **Version 4.0.0** introduces a major schema refactoring with unified v4_ table prefix and action-based MCP tool architecture.
|
|
6
|
-
|
|
7
|
-
## Core Design Principles
|
|
8
|
-
|
|
9
|
-
### 1. Token Efficiency Strategy
|
|
10
|
-
|
|
11
|
-
The 72% token reduction is achieved through five key strategies:
|
|
12
|
-
|
|
13
|
-
| Strategy | Description | Savings |
|
|
14
|
-
|----------|-------------|---------|
|
|
15
|
-
| **ID-Based Normalization** | Store strings once in master tables, reference by integer IDs | ~50% |
|
|
16
|
-
| **Integer Enums** | Replace string values with integers (status, priority, etc.) | 70-75% |
|
|
17
|
-
| **Pre-Aggregated Views** | Eliminate need for multiple joins in client code | ~85% |
|
|
18
|
-
| **Type-Based Separation** | Separate tables for numeric vs string values | ~50% |
|
|
19
|
-
| **Automatic Cleanup** | Prevent database bloat via triggers | N/A |
|
|
20
|
-
|
|
21
|
-
### 2. Metadata-Driven Classification
|
|
22
|
-
|
|
23
|
-
sqlew organizes data through five metadata dimensions:
|
|
24
|
-
|
|
25
|
-
| Dimension | Purpose | Example |
|
|
26
|
-
|-----------|---------|---------|
|
|
27
|
-
| **Tags** | Flexible cross-cutting categorization | authentication, security, api |
|
|
28
|
-
| **Layers** | Architecture layer organization (9 layers) | business, data, infrastructure |
|
|
29
|
-
| **Scopes** | Module/component-level organization | user-service, api-gateway |
|
|
30
|
-
| **Versions** | Automatic version history tracking | 1.0.0, 1.1.0 |
|
|
31
|
-
| **Priority** | Importance levels (1-4) | low, medium, high, critical |
|
|
32
|
-
|
|
33
|
-
### 3. Layer System (v4.0)
|
|
34
|
-
|
|
35
|
-
9 layers organized by file requirement:
|
|
36
|
-
|
|
37
|
-
**FILE_REQUIRED (6 layers):**
|
|
38
|
-
- presentation, business, data, infrastructure, cross-cutting, documentation
|
|
39
|
-
|
|
40
|
-
**FILE_OPTIONAL (3 layers):**
|
|
41
|
-
- planning, coordination, review
|
|
42
|
-
|
|
43
|
-
### 4. Data Integrity
|
|
44
|
-
|
|
45
|
-
- **Foreign Key Constraints**: All relationships enforced via SQLite
|
|
46
|
-
- **Transaction Guarantees**: ACID properties, WAL mode for concurrency
|
|
47
|
-
- **Auto-Registration Pattern**: Master records auto-created on first use
|
|
48
|
-
|
|
49
|
-
## Database Schema (v4.0)
|
|
50
|
-
|
|
51
|
-
All tables use unified `v4_` prefix. For detailed schema, see `src/database/migrations/v4/`.
|
|
52
|
-
|
|
53
|
-
### Master Tables (Normalization)
|
|
54
|
-
|
|
55
|
-
| Table | Purpose |
|
|
56
|
-
|-------|---------|
|
|
57
|
-
| `v4_files` | Normalize file paths |
|
|
58
|
-
| `v4_context_keys` | Normalize decision keys |
|
|
59
|
-
| `v4_layers` | Architecture layers (9 seeded) |
|
|
60
|
-
| `v4_tags` | Categorization tags (10 seeded, auto-expandable) |
|
|
61
|
-
| `v4_scopes` | Module/component scopes |
|
|
62
|
-
| `v4_constraint_categories` | Constraint types (performance, architecture, security) |
|
|
63
|
-
| `v4_task_statuses` | Task status types (pending, in_progress, completed, blocked, on_hold) |
|
|
64
|
-
| `v4_config` | Configuration storage |
|
|
65
|
-
|
|
66
|
-
### Transaction Tables (Core Data)
|
|
67
|
-
|
|
68
|
-
| Table | Purpose |
|
|
69
|
-
|-------|---------|
|
|
70
|
-
| `v4_decisions` | Store decisions with layer, status, version |
|
|
71
|
-
| `v4_decision_history` | Version history for all decision changes |
|
|
72
|
-
| `v4_decision_context` | Decision context (rationale, alternatives, tradeoffs) |
|
|
73
|
-
| `v4_file_changes` | Track file modifications with layer |
|
|
74
|
-
| `v4_constraints` | Project constraints with priority |
|
|
75
|
-
| `v4_tasks` | Task management with kanban-style status |
|
|
76
|
-
|
|
77
|
-
### Relationship Tables
|
|
78
|
-
|
|
79
|
-
| Table | Purpose |
|
|
80
|
-
|-------|---------|
|
|
81
|
-
| `v4_decision_tags` | Decision ↔ Tags (many-to-many) |
|
|
82
|
-
| `v4_decision_scopes` | Decision ↔ Scopes (many-to-many) |
|
|
83
|
-
| `v4_task_file_links` | Task ↔ Files with action types |
|
|
84
|
-
| `v4_task_dependencies` | Task dependencies with circular detection |
|
|
85
|
-
|
|
86
|
-
### Pre-Aggregated Views
|
|
87
|
-
|
|
88
|
-
| View | Purpose |
|
|
89
|
-
|------|---------|
|
|
90
|
-
| `v4_tagged_decisions` | Decisions with all metadata (tags, layers, scopes) |
|
|
91
|
-
| `v4_layer_summary` | Per-layer aggregated statistics |
|
|
92
|
-
| `v4_recent_file_changes` | Recent file changes with metadata |
|
|
93
|
-
| `v4_tagged_constraints` | Constraints with category and layer |
|
|
94
|
-
| `v4_task_board` | Kanban-style task view with dependencies |
|
|
95
|
-
|
|
96
|
-
## MCP Tool Architecture
|
|
97
|
-
|
|
98
|
-
### Action-Based Tool System (v4.0)
|
|
99
|
-
|
|
100
|
-
6 consolidated action-based MCP tools:
|
|
101
|
-
|
|
102
|
-
| Tool | Purpose | Key Actions |
|
|
103
|
-
|------|---------|-------------|
|
|
104
|
-
| **decision** | Decision context management | set, get, list, search, versions |
|
|
105
|
-
| **file** | File change tracking | record, get, check_lock |
|
|
106
|
-
| **constraint** | Constraint management | add, get, deactivate |
|
|
107
|
-
| **task** | Task management with dependencies | create, update, move, link, list |
|
|
108
|
-
| **help** | Documentation queries | query_action, query_tool, workflow_hints |
|
|
109
|
-
| **suggest** | Decision intelligence | by_key, by_tags, check_duplicate |
|
|
110
|
-
|
|
111
|
-
All tools support `action: "help"` for in-tool documentation.
|
|
112
|
-
|
|
113
|
-
## Performance Characteristics
|
|
114
|
-
|
|
115
|
-
### Query Performance
|
|
116
|
-
|
|
117
|
-
| Operation | Avg Time |
|
|
118
|
-
|-----------|----------|
|
|
119
|
-
| decision.set | 2-5 ms |
|
|
120
|
-
| decision.get | 5-15 ms |
|
|
121
|
-
| file.record | 2-4 ms |
|
|
122
|
-
| task.create | 3-7 ms |
|
|
123
|
-
|
|
124
|
-
### Database Size
|
|
125
|
-
|
|
126
|
-
- **Empty:** ~28 KB (schema + seed data)
|
|
127
|
-
- **Growth Rate:** ~140 bytes/decision (linear)
|
|
128
|
-
|
|
129
|
-
### Concurrent Access
|
|
130
|
-
|
|
131
|
-
- **WAL Mode:** Enabled for read/write concurrency
|
|
132
|
-
- **Busy Timeout:** 5000ms
|
|
133
|
-
|
|
134
|
-
## File Structure
|
|
135
|
-
|
|
136
|
-
| Component | Location |
|
|
137
|
-
|-----------|----------|
|
|
138
|
-
| MCP Server | `src/index.ts` |
|
|
139
|
-
| Database Init | `src/database/initialization/` |
|
|
140
|
-
| Migrations | `src/database/migrations/v4/` |
|
|
141
|
-
| Tool Implementations | `src/tools/` |
|
|
142
|
-
| Types | `src/types.ts` |
|
|
143
|
-
| Constants | `src/constants.ts` |
|
|
144
|
-
|
|
145
|
-
## Known Limitations
|
|
146
|
-
|
|
147
|
-
1. **No Semantic Search:** Delegated to specialized tools like Serena
|
|
148
|
-
2. **Single Project Scope:** Not multi-tenant
|
|
149
|
-
3. **No Authentication:** Trust-based (local MCP server)
|
|
150
|
-
4. **No Network Access:** Offline-only operation
|
|
151
|
-
|
|
152
|
-
## Version History
|
|
153
|
-
|
|
154
|
-
| Version | Key Changes |
|
|
155
|
-
|---------|-------------|
|
|
156
|
-
| **v4.0.0** | Unified v4_ prefix, agent system removed, 6 action-based tools, 9 layers |
|
|
157
|
-
| v3.9.0 | Decision Intelligence System, suggestion policies |
|
|
158
|
-
| v3.8.0 | Layer expansion (5→9), file_actions parameter |
|
|
159
|
-
| v3.0.0 | Kanban task system, 7-tool consolidation |
|
|
160
|
-
| v2.0 | Action-based API, 96% token reduction |
|
|
161
|
-
|
|
162
|
-
## Related Documentation
|
|
163
|
-
|
|
164
|
-
- [SHARED_CONCEPTS.md](SHARED_CONCEPTS.md) - Common concepts across tools
|
|
165
|
-
- [TOOL_REFERENCE.md](TOOL_REFERENCE.md) - Complete tool parameter reference
|
|
166
|
-
- [CONFIGURATION.md](CONFIGURATION.md) - Configuration options
|
|
167
|
-
- [TASK_OVERVIEW.md](TASK_OVERVIEW.md) - Task management overview
|