knowns 0.1.5 → 0.1.6
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 +30 -0
- package/CLAUDE.md +525 -96
- package/README.md +118 -472
- package/dist/index.js +1039 -353
- package/dist/mcp/server.js +7 -2
- package/dist/ui/assets/index-B6wqA_A-.js +152 -0
- package/dist/ui/assets/index-uFwTg_PH.css +1 -0
- package/dist/ui/index.html +2 -1
- package/package.json +16 -22
- package/dist/ui/index.css +0 -3088
- package/dist/ui/main.css +0 -1
- package/dist/ui/main.js +0 -452
package/CLAUDE.md
CHANGED
|
@@ -1,12 +1,165 @@
|
|
|
1
1
|
<!-- KNOWNS GUIDELINES START -->
|
|
2
2
|
# Knowns CLI Guidelines
|
|
3
3
|
|
|
4
|
-
## Core
|
|
4
|
+
## Core Principles
|
|
5
5
|
|
|
6
|
+
### 1. CLI-Only Operations
|
|
6
7
|
**NEVER edit .md files directly. ALL operations MUST use CLI commands.**
|
|
7
8
|
|
|
8
9
|
This ensures data integrity, maintains proper change history, and prevents file corruption.
|
|
9
10
|
|
|
11
|
+
### 2. Documentation-First (For AI Agents)
|
|
12
|
+
**ALWAYS read project documentation BEFORE planning or coding.**
|
|
13
|
+
|
|
14
|
+
AI agents must understand project context, conventions, and existing patterns before making any changes. This prevents rework and ensures consistency.
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## AI Agent Guidelines
|
|
19
|
+
|
|
20
|
+
> **CRITICAL**: Before performing ANY task, AI agents MUST read documentation to understand project context.
|
|
21
|
+
|
|
22
|
+
### First-Time Initialization
|
|
23
|
+
|
|
24
|
+
When starting a new session or working on an unfamiliar project:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
# 1. List all available documentation
|
|
28
|
+
knowns doc list --plain
|
|
29
|
+
|
|
30
|
+
# 2. Read essential project docs (prioritize these)
|
|
31
|
+
knowns doc view "README" --plain # Project overview
|
|
32
|
+
knowns doc view "ARCHITECTURE" --plain # System design
|
|
33
|
+
knowns doc view "CONVENTIONS" --plain # Coding standards
|
|
34
|
+
knowns doc view "API" --plain # API specifications
|
|
35
|
+
|
|
36
|
+
# 3. Review current task backlog
|
|
37
|
+
knowns task list --plain
|
|
38
|
+
knowns task list --status in-progress --plain
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Before Taking Any Task
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
# 1. View the task details
|
|
45
|
+
knowns task view <id> --plain
|
|
46
|
+
|
|
47
|
+
# 2. Follow ALL refs in the task (see Reference System section)
|
|
48
|
+
# @.knowns/tasks/task-44 - ... → knowns task view 44 --plain
|
|
49
|
+
# @.knowns/docs/patterns/module.md → knowns doc view "patterns/module" --plain
|
|
50
|
+
|
|
51
|
+
# 3. Search for additional related documentation
|
|
52
|
+
knowns search "<keywords from task>" --type doc --plain
|
|
53
|
+
|
|
54
|
+
# 4. Read ALL related docs before planning
|
|
55
|
+
knowns doc view "<related-doc>" --plain
|
|
56
|
+
|
|
57
|
+
# 5. Check for similar completed tasks (learn from history)
|
|
58
|
+
knowns search "<keywords>" --type task --status done --plain
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Why Documentation First?
|
|
62
|
+
|
|
63
|
+
| Without Reading Docs | With Reading Docs |
|
|
64
|
+
|---------------------|-------------------|
|
|
65
|
+
| Reinvent existing patterns | Reuse established patterns |
|
|
66
|
+
| Break conventions | Follow project standards |
|
|
67
|
+
| Duplicate code | Use existing utilities |
|
|
68
|
+
| Wrong architecture decisions | Align with system design |
|
|
69
|
+
| Inconsistent naming | Match naming conventions |
|
|
70
|
+
|
|
71
|
+
### Context Checklist for Agents
|
|
72
|
+
|
|
73
|
+
Before writing ANY code, ensure you can answer:
|
|
74
|
+
|
|
75
|
+
- [ ] Have I followed ALL refs (`@.knowns/...`) in the task?
|
|
76
|
+
- [ ] Have I followed nested refs recursively?
|
|
77
|
+
- [ ] What is the project's overall architecture?
|
|
78
|
+
- [ ] What coding conventions does this project follow?
|
|
79
|
+
- [ ] Are there existing patterns/utilities I should reuse?
|
|
80
|
+
- [ ] What are the testing requirements?
|
|
81
|
+
- [ ] How should I structure my implementation?
|
|
82
|
+
|
|
83
|
+
> **Remember**: A few minutes reading docs saves hours of rework. NEVER skip this step.
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## Reference System (Refs)
|
|
88
|
+
|
|
89
|
+
Tasks and docs can contain **references** to other tasks/docs. AI agents MUST understand and follow these refs to gather complete context.
|
|
90
|
+
|
|
91
|
+
### Reference Formats
|
|
92
|
+
|
|
93
|
+
| Type | User Input | System Output | CLI Command |
|
|
94
|
+
|------|------------|---------------|-------------|
|
|
95
|
+
| **Task ref** | `@task-<id>` | `@.knowns/tasks/task-<id> - <title>.md` | `knowns task view <id> --plain` |
|
|
96
|
+
| **Doc ref** | `@doc/<path>` | `@.knowns/docs/<path>.md` | `knowns doc view "<path>" --plain` |
|
|
97
|
+
|
|
98
|
+
### How to Follow Refs
|
|
99
|
+
|
|
100
|
+
When you read a task and see refs in system output format, follow them:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
# Example: Task 42 output contains:
|
|
104
|
+
# @.knowns/tasks/task-44 - CLI Task Create Command.md
|
|
105
|
+
# @.knowns/docs/patterns/module.md
|
|
106
|
+
|
|
107
|
+
# Follow task ref (extract ID from task-<id>)
|
|
108
|
+
knowns task view 44 --plain
|
|
109
|
+
|
|
110
|
+
# Follow doc ref (extract path, remove .md)
|
|
111
|
+
knowns doc view "patterns/module" --plain
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Parsing Rules
|
|
115
|
+
|
|
116
|
+
1. **Task refs**: `@.knowns/tasks/task-<id> - ...` → extract `<id>` → `knowns task view <id> --plain`
|
|
117
|
+
2. **Doc refs**: `@.knowns/docs/<path>.md` → extract `<path>` → `knowns doc view "<path>" --plain`
|
|
118
|
+
|
|
119
|
+
### Recursive Following
|
|
120
|
+
|
|
121
|
+
Refs can be nested. Follow until complete context is gathered:
|
|
122
|
+
|
|
123
|
+
```
|
|
124
|
+
Task 42
|
|
125
|
+
→ @.knowns/docs/README.md
|
|
126
|
+
→ @.knowns/docs/patterns/module.md (found in README)
|
|
127
|
+
→ (read for full pattern details)
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### When to Follow Refs
|
|
131
|
+
|
|
132
|
+
| Situation | Action |
|
|
133
|
+
|-----------|--------|
|
|
134
|
+
| Refs in Description | ALWAYS follow - critical context |
|
|
135
|
+
| Refs in Implementation Plan | Follow if implementing related work |
|
|
136
|
+
| Refs in Notes | Optional - for historical context |
|
|
137
|
+
| Dependency mentions | Follow if marked as blocker |
|
|
138
|
+
|
|
139
|
+
### Example: Complete Ref Resolution
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
# 1. Read the task
|
|
143
|
+
$ knowns task view 42 --plain
|
|
144
|
+
|
|
145
|
+
# Output contains:
|
|
146
|
+
# @.knowns/tasks/task-44 - CLI Task Create Command.md
|
|
147
|
+
# @.knowns/docs/README.md
|
|
148
|
+
|
|
149
|
+
# 2. Follow task ref
|
|
150
|
+
$ knowns task view 44 --plain
|
|
151
|
+
|
|
152
|
+
# 3. Follow doc ref
|
|
153
|
+
$ knowns doc view "README" --plain
|
|
154
|
+
|
|
155
|
+
# 4. If README contains more refs, follow them too
|
|
156
|
+
# @.knowns/docs/patterns/module.md → knowns doc view "patterns/module" --plain
|
|
157
|
+
|
|
158
|
+
# Now you have complete context
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
> **CRITICAL**: Never assume you understand a task fully without following its refs. Refs contain essential context that may change your implementation approach.
|
|
162
|
+
|
|
10
163
|
---
|
|
11
164
|
|
|
12
165
|
## Quick Start
|
|
@@ -30,63 +183,195 @@ knowns search "query" --plain
|
|
|
30
183
|
|
|
31
184
|
---
|
|
32
185
|
|
|
33
|
-
##
|
|
186
|
+
## End-to-End Example
|
|
187
|
+
|
|
188
|
+
Here's a complete workflow for an AI agent implementing a feature:
|
|
189
|
+
|
|
190
|
+
```bash
|
|
191
|
+
# === AGENT SESSION START (Do this once per session) ===
|
|
192
|
+
|
|
193
|
+
# 0a. List all available documentation
|
|
194
|
+
$ knowns doc list --plain
|
|
195
|
+
|
|
196
|
+
# Output:
|
|
197
|
+
# DOC: README.md
|
|
198
|
+
# DOC: ARCHITECTURE.md
|
|
199
|
+
# DOC: CONVENTIONS.md
|
|
200
|
+
# DOC: security-patterns.md
|
|
201
|
+
# DOC: api-guidelines.md
|
|
202
|
+
# DOC: email-templates.md
|
|
203
|
+
|
|
204
|
+
# 0b. Read essential project docs
|
|
205
|
+
$ knowns doc view "README" --plain
|
|
206
|
+
$ knowns doc view "ARCHITECTURE" --plain
|
|
207
|
+
$ knowns doc view "CONVENTIONS" --plain
|
|
208
|
+
|
|
209
|
+
# Now the agent understands project context and conventions
|
|
210
|
+
|
|
211
|
+
# === TASK WORKFLOW ===
|
|
212
|
+
|
|
213
|
+
# 1. Create the task
|
|
214
|
+
$ knowns task create "Add password reset flow" \
|
|
215
|
+
-d "Users need ability to reset forgotten passwords via email" \
|
|
216
|
+
--ac "User can request password reset via email" \
|
|
217
|
+
--ac "Reset link expires after 1 hour" \
|
|
218
|
+
--ac "User can set new password via reset link" \
|
|
219
|
+
--ac "Unit tests cover all scenarios" \
|
|
220
|
+
--priority high \
|
|
221
|
+
-l "auth,feature"
|
|
222
|
+
|
|
223
|
+
# Output: Created task AUTH-042
|
|
224
|
+
|
|
225
|
+
# 2. Take the task and start timer
|
|
226
|
+
$ knowns task edit AUTH-042 -s in-progress -a @me
|
|
227
|
+
$ knowns time start AUTH-042
|
|
228
|
+
|
|
229
|
+
# Output: Timer started for AUTH-042
|
|
230
|
+
|
|
231
|
+
# 3. Search for related documentation
|
|
232
|
+
$ knowns search "password security" --type doc --plain
|
|
233
|
+
|
|
234
|
+
# Output:
|
|
235
|
+
# DOC: security-patterns.md (score: 0.92)
|
|
236
|
+
# DOC: email-templates.md (score: 0.78)
|
|
237
|
+
|
|
238
|
+
# 4. Read the documentation
|
|
239
|
+
$ knowns doc view "security-patterns" --plain
|
|
240
|
+
|
|
241
|
+
# 5. Create implementation plan (SHARE WITH USER, WAIT FOR APPROVAL)
|
|
242
|
+
$ knowns task edit AUTH-042 --plan $'1. Review security patterns (see [security-patterns.md](./docs/security-patterns.md))
|
|
243
|
+
2. Design token generation with 1-hour expiry
|
|
244
|
+
3. Create email template (see [email-templates.md](./docs/email-templates.md))
|
|
245
|
+
4. Implement /forgot-password endpoint
|
|
246
|
+
5. Implement /reset-password endpoint
|
|
247
|
+
6. Add unit tests
|
|
248
|
+
7. Update API documentation'
|
|
249
|
+
|
|
250
|
+
# 6. After approval, implement and check criteria as you go
|
|
251
|
+
$ knowns task edit AUTH-042 --check-ac 1
|
|
252
|
+
$ knowns task edit AUTH-042 --append-notes "✓ Implemented /forgot-password endpoint"
|
|
253
|
+
|
|
254
|
+
$ knowns task edit AUTH-042 --check-ac 2
|
|
255
|
+
$ knowns task edit AUTH-042 --append-notes "✓ Token expiry set to 1 hour"
|
|
256
|
+
|
|
257
|
+
$ knowns task edit AUTH-042 --check-ac 3
|
|
258
|
+
$ knowns task edit AUTH-042 --append-notes "✓ Implemented /reset-password endpoint"
|
|
259
|
+
|
|
260
|
+
$ knowns task edit AUTH-042 --check-ac 4
|
|
261
|
+
$ knowns task edit AUTH-042 --append-notes "✓ Added 12 unit tests, 100% coverage"
|
|
262
|
+
|
|
263
|
+
# 7. Add final implementation notes
|
|
264
|
+
$ knowns task edit AUTH-042 --notes $'## Summary
|
|
265
|
+
Implemented complete password reset flow with secure token generation.
|
|
266
|
+
|
|
267
|
+
## Changes
|
|
268
|
+
- Added POST /forgot-password endpoint
|
|
269
|
+
- Added POST /reset-password endpoint
|
|
270
|
+
- Created password_reset_tokens table
|
|
271
|
+
- Added email template for reset link
|
|
272
|
+
|
|
273
|
+
## Security
|
|
274
|
+
- Tokens use crypto.randomBytes(32)
|
|
275
|
+
- 1-hour expiry enforced at DB level
|
|
276
|
+
- Rate limiting: 3 requests per hour per email
|
|
277
|
+
|
|
278
|
+
## Tests
|
|
279
|
+
- 12 unit tests added
|
|
280
|
+
- Coverage: 100% for new code
|
|
281
|
+
|
|
282
|
+
## Documentation
|
|
283
|
+
- Updated API.md with new endpoints'
|
|
284
|
+
|
|
285
|
+
# 8. Stop timer and complete
|
|
286
|
+
$ knowns time stop
|
|
287
|
+
$ knowns task edit AUTH-042 -s done
|
|
288
|
+
|
|
289
|
+
# Output: Task AUTH-042 marked as done
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
---
|
|
293
|
+
|
|
294
|
+
## Task Workflow
|
|
34
295
|
|
|
35
296
|
### Step 1: Take Task
|
|
297
|
+
|
|
36
298
|
```bash
|
|
37
|
-
knowns task edit <id> -s in-progress -a @
|
|
299
|
+
knowns task edit <id> -s in-progress -a @me
|
|
38
300
|
```
|
|
39
301
|
|
|
302
|
+
> **Note**: `@me` is a special keyword that assigns the task to yourself. You can also use specific usernames like `@harry` or `@john`.
|
|
303
|
+
|
|
40
304
|
### Step 2: Start Time Tracking
|
|
305
|
+
|
|
41
306
|
```bash
|
|
42
307
|
knowns time start <id>
|
|
43
308
|
```
|
|
44
309
|
|
|
45
310
|
### Step 3: Read Related Documentation
|
|
311
|
+
|
|
312
|
+
> **FOR AI AGENTS**: This step is MANDATORY, not optional. You must understand the codebase before planning.
|
|
313
|
+
|
|
46
314
|
```bash
|
|
47
315
|
# Search for related docs
|
|
48
316
|
knowns search "authentication" --type doc --plain
|
|
49
317
|
|
|
50
318
|
# View relevant documents
|
|
51
319
|
knowns doc view "API Guidelines" --plain
|
|
320
|
+
knowns doc view "Security Patterns" --plain
|
|
321
|
+
|
|
322
|
+
# Also check for similar completed tasks
|
|
323
|
+
knowns search "auth" --type task --status done --plain
|
|
52
324
|
```
|
|
53
325
|
|
|
54
|
-
**CRITICAL**: ALWAYS read related documentation BEFORE planning!
|
|
326
|
+
> **CRITICAL**: ALWAYS read related documentation BEFORE planning! Understanding existing patterns and conventions prevents rework and ensures consistency.
|
|
55
327
|
|
|
56
328
|
### Step 4: Create Implementation Plan
|
|
329
|
+
|
|
57
330
|
```bash
|
|
58
|
-
|
|
59
|
-
|
|
331
|
+
knowns task edit <id> --plan $'1. Research patterns (see [security-patterns.md](./security-patterns.md))
|
|
332
|
+
2. Design middleware
|
|
333
|
+
3. Implement
|
|
334
|
+
4. Add tests
|
|
335
|
+
5. Update docs'
|
|
60
336
|
```
|
|
61
337
|
|
|
62
|
-
**CRITICAL**:
|
|
63
|
-
- Share plan with user and **WAIT for approval** before coding
|
|
64
|
-
- Include doc references using `[file.md](./path/file.md)` format
|
|
338
|
+
> **CRITICAL**:
|
|
339
|
+
> - Share plan with user and **WAIT for approval** before coding
|
|
340
|
+
> - Include doc references using `[file.md](./path/file.md)` format
|
|
65
341
|
|
|
66
342
|
### Step 5: Implement
|
|
343
|
+
|
|
67
344
|
```bash
|
|
68
345
|
# Check acceptance criteria as you complete them
|
|
69
346
|
knowns task edit <id> --check-ac 1 --check-ac 2 --check-ac 3
|
|
70
347
|
```
|
|
71
348
|
|
|
72
349
|
### Step 6: Add Implementation Notes
|
|
350
|
+
|
|
73
351
|
```bash
|
|
74
352
|
# Add comprehensive notes (suitable for PR description)
|
|
75
|
-
knowns task edit <id> --notes $'## Summary
|
|
353
|
+
knowns task edit <id> --notes $'## Summary
|
|
354
|
+
|
|
355
|
+
Implemented JWT auth.
|
|
76
356
|
|
|
77
|
-
|
|
357
|
+
## Changes
|
|
358
|
+
- Added middleware
|
|
359
|
+
- Added tests'
|
|
360
|
+
|
|
361
|
+
# OR append progressively (recommended)
|
|
78
362
|
knowns task edit <id> --append-notes "✓ Implemented middleware"
|
|
79
363
|
knowns task edit <id> --append-notes "✓ Added tests"
|
|
80
364
|
```
|
|
81
365
|
|
|
82
366
|
### Step 7: Stop Time Tracking
|
|
367
|
+
|
|
83
368
|
```bash
|
|
84
369
|
knowns time stop
|
|
85
370
|
```
|
|
86
371
|
|
|
87
372
|
### Step 8: Complete Task
|
|
373
|
+
|
|
88
374
|
```bash
|
|
89
|
-
# Mark as done (only after ALL criteria are met)
|
|
90
375
|
knowns task edit <id> -s done
|
|
91
376
|
```
|
|
92
377
|
|
|
@@ -105,11 +390,11 @@ knowns task edit <id> -t "New title"
|
|
|
105
390
|
knowns task edit <id> -d "New description"
|
|
106
391
|
knowns task edit <id> -s in-progress
|
|
107
392
|
knowns task edit <id> --priority high
|
|
108
|
-
knowns task edit <id> -a @
|
|
393
|
+
knowns task edit <id> -a @me
|
|
109
394
|
|
|
110
395
|
# Acceptance Criteria
|
|
111
396
|
knowns task edit <id> --ac "New criterion" # Add
|
|
112
|
-
knowns task edit <id> --check-ac 1 --check-ac 2 # Check
|
|
397
|
+
knowns task edit <id> --check-ac 1 --check-ac 2 # Check (1-indexed)
|
|
113
398
|
knowns task edit <id> --uncheck-ac 2 # Uncheck
|
|
114
399
|
knowns task edit <id> --remove-ac 3 # Remove
|
|
115
400
|
|
|
@@ -122,7 +407,7 @@ knowns task edit <id> --append-notes "Progress update"
|
|
|
122
407
|
knowns task view <id> --plain # ALWAYS use --plain
|
|
123
408
|
knowns task list --plain
|
|
124
409
|
knowns task list --status in-progress --plain
|
|
125
|
-
knowns task list --assignee @
|
|
410
|
+
knowns task list --assignee @me --plain
|
|
126
411
|
knowns task list --tree --plain # Tree hierarchy
|
|
127
412
|
```
|
|
128
413
|
|
|
@@ -152,11 +437,16 @@ knowns doc list --plain
|
|
|
152
437
|
knowns doc list --tag architecture --plain
|
|
153
438
|
knowns doc view "Doc Name" --plain
|
|
154
439
|
|
|
155
|
-
# Create
|
|
440
|
+
# Create (with optional folder)
|
|
156
441
|
knowns doc create "Title" -d "Description" -t "tags"
|
|
442
|
+
knowns doc create "Title" -d "Description" -t "tags" -f "folder/path"
|
|
157
443
|
|
|
158
444
|
# Edit metadata
|
|
159
445
|
knowns doc edit "Doc Name" -t "New Title" --tags "new,tags"
|
|
446
|
+
|
|
447
|
+
# Edit content
|
|
448
|
+
knowns doc edit "Doc Name" -c "New content" # Replace content
|
|
449
|
+
knowns doc edit "Doc Name" -a "Appended content" # Append to content
|
|
160
450
|
```
|
|
161
451
|
|
|
162
452
|
### Search
|
|
@@ -178,51 +468,100 @@ knowns search "bug" --status in-progress --priority high --plain
|
|
|
178
468
|
## Task Structure
|
|
179
469
|
|
|
180
470
|
### Title
|
|
471
|
+
|
|
181
472
|
Clear summary (WHAT needs to be done).
|
|
182
|
-
|
|
183
|
-
|
|
473
|
+
|
|
474
|
+
| Bad | Good |
|
|
475
|
+
|-----|------|
|
|
476
|
+
| Do auth stuff | Add JWT authentication |
|
|
477
|
+
| Fix bug | Fix login timeout on slow networks |
|
|
478
|
+
| Update docs | Document rate limiting in API.md |
|
|
184
479
|
|
|
185
480
|
### Description
|
|
481
|
+
|
|
186
482
|
Explains WHY and WHAT (not HOW). **Link related docs using `[file.md](./path/file.md)`**
|
|
187
483
|
|
|
188
|
-
```
|
|
189
|
-
We need JWT authentication because sessions don't scale.
|
|
484
|
+
```markdown
|
|
485
|
+
We need JWT authentication because sessions don't scale for our microservices architecture.
|
|
190
486
|
|
|
191
487
|
Related docs:
|
|
192
|
-
- [security-patterns.md](./security-patterns.md)
|
|
193
|
-
- [api-guidelines.md](./api-guidelines.md)
|
|
488
|
+
- [security-patterns.md](./docs/security-patterns.md)
|
|
489
|
+
- [api-guidelines.md](./docs/api-guidelines.md)
|
|
194
490
|
```
|
|
195
491
|
|
|
196
492
|
### Acceptance Criteria
|
|
197
|
-
**Outcome-oriented**, testable criteria. NOT implementation details.
|
|
198
493
|
|
|
199
|
-
-
|
|
200
|
-
|
|
201
|
-
|
|
494
|
+
**Outcome-oriented**, testable criteria. NOT implementation steps.
|
|
495
|
+
|
|
496
|
+
| Bad (Implementation details) | Good (Outcomes) |
|
|
497
|
+
|------------------------------|-----------------|
|
|
498
|
+
| Add function handleLogin() in auth.ts | User can login and receive JWT token |
|
|
499
|
+
| Use bcrypt for hashing | Passwords are securely hashed |
|
|
500
|
+
| Add try-catch blocks | Errors return appropriate HTTP status codes |
|
|
202
501
|
|
|
203
502
|
### Implementation Plan
|
|
503
|
+
|
|
204
504
|
HOW to solve. Added AFTER taking task, BEFORE coding.
|
|
205
505
|
|
|
206
|
-
```
|
|
207
|
-
1. Research JWT libraries (see [security-patterns.md](./security-patterns.md))
|
|
208
|
-
2. Design token structure
|
|
209
|
-
3. Implement middleware
|
|
210
|
-
4. Add tests
|
|
506
|
+
```markdown
|
|
507
|
+
1. Research JWT libraries (see [security-patterns.md](./docs/security-patterns.md))
|
|
508
|
+
2. Design token structure (access + refresh tokens)
|
|
509
|
+
3. Implement auth middleware
|
|
510
|
+
4. Add unit tests (aim for 90%+ coverage)
|
|
511
|
+
5. Update API.md with new endpoints
|
|
211
512
|
```
|
|
212
513
|
|
|
213
514
|
### Implementation Notes
|
|
214
|
-
Summary for PR. Added AFTER completion.
|
|
215
515
|
|
|
216
|
-
|
|
516
|
+
Summary for PR description. Added AFTER completion.
|
|
517
|
+
|
|
518
|
+
```markdown
|
|
217
519
|
## Summary
|
|
218
|
-
Implemented JWT auth using jsonwebtoken.
|
|
520
|
+
Implemented JWT auth using jsonwebtoken library.
|
|
219
521
|
|
|
220
522
|
## Changes
|
|
221
|
-
- Added middleware in src/auth.ts
|
|
222
|
-
- Added
|
|
523
|
+
- Added auth middleware in src/middleware/auth.ts
|
|
524
|
+
- Added /login and /refresh endpoints
|
|
525
|
+
- Created JWT utility functions
|
|
526
|
+
|
|
527
|
+
## Tests
|
|
528
|
+
- Added 15 unit tests
|
|
529
|
+
- Coverage: 94%
|
|
223
530
|
|
|
224
531
|
## Documentation
|
|
225
|
-
- Updated API.md
|
|
532
|
+
- Updated API.md with authentication section
|
|
533
|
+
```
|
|
534
|
+
|
|
535
|
+
---
|
|
536
|
+
|
|
537
|
+
## Error Handling
|
|
538
|
+
|
|
539
|
+
### Common Errors and Solutions
|
|
540
|
+
|
|
541
|
+
| Error | Cause | Solution |
|
|
542
|
+
|-------|-------|----------|
|
|
543
|
+
| `Error: Task not found` | Invalid task ID | Run `knowns task list --plain` to find correct ID |
|
|
544
|
+
| `Error: No active timer` | Calling `time stop` without active timer | Start timer first: `knowns time start <id>` |
|
|
545
|
+
| `Error: Timer already running` | Starting timer when one is active | Stop current: `knowns time stop` |
|
|
546
|
+
| `Error: Invalid status` | Wrong status format | Use lowercase with hyphens: `in-progress`, not `In Progress` |
|
|
547
|
+
| `Error: AC index out of range` | Checking non-existent criterion | View task first: `knowns task view <id> --plain` |
|
|
548
|
+
| `Error: Document not found` | Wrong document name | Run `knowns doc list --plain` to find correct name |
|
|
549
|
+
| `Error: Not initialized` | Running commands without init | Run `knowns init` first |
|
|
550
|
+
|
|
551
|
+
### Debugging Commands
|
|
552
|
+
|
|
553
|
+
```bash
|
|
554
|
+
# Check CLI version
|
|
555
|
+
knowns --version
|
|
556
|
+
|
|
557
|
+
# Verify project is initialized
|
|
558
|
+
knowns status
|
|
559
|
+
|
|
560
|
+
# View raw task data (for debugging)
|
|
561
|
+
knowns task view <id> --json
|
|
562
|
+
|
|
563
|
+
# Check timer status
|
|
564
|
+
knowns time status
|
|
226
565
|
```
|
|
227
566
|
|
|
228
567
|
---
|
|
@@ -232,109 +571,193 @@ Implemented JWT auth using jsonwebtoken.
|
|
|
232
571
|
A task is **Done** ONLY when **ALL** criteria are met:
|
|
233
572
|
|
|
234
573
|
### Via CLI (Required)
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
574
|
+
|
|
575
|
+
- [ ] All acceptance criteria checked: `--check-ac <index>`
|
|
576
|
+
- [ ] Implementation notes added: `--notes "..."`
|
|
577
|
+
- [ ] Timer stopped: `knowns time stop`
|
|
578
|
+
- [ ] Status set to done: `-s done`
|
|
238
579
|
|
|
239
580
|
### Via Code (Required)
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
581
|
+
|
|
582
|
+
- [ ] All tests pass
|
|
583
|
+
- [ ] Documentation updated
|
|
584
|
+
- [ ] Code reviewed (linting, formatting)
|
|
585
|
+
- [ ] No regressions introduced
|
|
586
|
+
|
|
587
|
+
---
|
|
588
|
+
|
|
589
|
+
## Status & Priority Reference
|
|
590
|
+
|
|
591
|
+
### Status Values
|
|
592
|
+
|
|
593
|
+
Use **lowercase with hyphens**:
|
|
594
|
+
|
|
595
|
+
| Status | Description | When to Use |
|
|
596
|
+
|--------|-------------|-------------|
|
|
597
|
+
| `todo` | Not started | Default for new tasks |
|
|
598
|
+
| `in-progress` | Currently working | After taking task |
|
|
599
|
+
| `in-review` | In code review | PR submitted |
|
|
600
|
+
| `blocked` | Waiting on dependency | External blocker |
|
|
601
|
+
| `done` | Completed | All criteria met |
|
|
602
|
+
|
|
603
|
+
### Priority Values
|
|
604
|
+
|
|
605
|
+
| Priority | Description |
|
|
606
|
+
|----------|-------------|
|
|
607
|
+
| `low` | Can wait, nice-to-have |
|
|
608
|
+
| `medium` | Normal priority (default) |
|
|
609
|
+
| `high` | Urgent, time-sensitive |
|
|
244
610
|
|
|
245
611
|
---
|
|
246
612
|
|
|
247
613
|
## Common Mistakes
|
|
248
614
|
|
|
249
615
|
| Wrong | Right |
|
|
250
|
-
|
|
616
|
+
|-------|-------|
|
|
251
617
|
| Edit .md files directly | Use `knowns task edit` |
|
|
252
618
|
| Change `- [ ]` to `- [x]` in file | Use `--check-ac <index>` |
|
|
253
|
-
| Start coding without reading docs | Read docs FIRST
|
|
254
|
-
|
|
|
255
|
-
|
|
|
256
|
-
|
|
|
257
|
-
|
|
|
258
|
-
|
|
|
259
|
-
|
|
|
619
|
+
| Start coding without reading docs | Read ALL related docs FIRST |
|
|
620
|
+
| Skip `knowns doc list` on new project | Always list docs when starting |
|
|
621
|
+
| Assume you know the conventions | Read CONVENTIONS/ARCHITECTURE docs |
|
|
622
|
+
| Plan without checking docs | Read docs before planning |
|
|
623
|
+
| Ignore similar completed tasks | Search done tasks for patterns |
|
|
624
|
+
| Missing doc links in description/plan | Link docs using `[file.md](./path)` |
|
|
625
|
+
| Forget `--plain` flag | Always use `--plain` for AI |
|
|
626
|
+
| Code before plan approval | Share plan, WAIT for approval |
|
|
627
|
+
| Mark done without all criteria | Check ALL criteria first |
|
|
628
|
+
| Write implementation steps in AC | Write outcome-oriented criteria |
|
|
260
629
|
| Use `"In Progress"` or `"Done"` | Use `in-progress`, `done` |
|
|
630
|
+
| Use `@yourself` | Use `@me` or specific username |
|
|
631
|
+
| Ignore refs in task description | Follow ALL refs (`@.knowns/...`) before planning |
|
|
632
|
+
| See `@.knowns/docs/...` but don't read | Use `knowns doc view "<path>" --plain` |
|
|
633
|
+
| See `@.knowns/tasks/task-X` but don't check | Use `knowns task view X --plain` for context |
|
|
634
|
+
| Follow only first-level refs | Recursively follow nested refs until complete |
|
|
261
635
|
|
|
262
636
|
---
|
|
263
637
|
|
|
264
|
-
##
|
|
265
|
-
|
|
266
|
-
### Critical Rules
|
|
267
|
-
- **ALWAYS use `--plain` flag** for AI-readable output
|
|
268
|
-
- **Read documentation BEFORE planning**: `knowns search "keyword" --type doc --plain`
|
|
269
|
-
- **Link docs in tasks**: Use `[file.md](./path/file.md)` or `[mapper.md](./patterns/mapper.md)`
|
|
270
|
-
- **Share plan before coding**: Get approval first
|
|
271
|
-
- **Start time tracking**: `knowns time start <id>` before work
|
|
272
|
-
- **Stop time tracking**: `knowns time stop` after work
|
|
273
|
-
- **Check criteria as you go**: Don't wait until end
|
|
274
|
-
- **Add notes progressively**: Use `--append-notes`
|
|
638
|
+
## Platform-Specific Notes
|
|
275
639
|
|
|
276
640
|
### Multi-line Input
|
|
277
|
-
- **Bash/Zsh**: `$'Line1\nLine2\nLine3'`
|
|
278
|
-
- **PowerShell**: `"Line1\`nLine2\`nLine3"`
|
|
279
|
-
- **Portable**: `"$(printf 'Line1\nLine2\nLine3')"`
|
|
280
641
|
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
642
|
+
Different shells handle multi-line strings differently:
|
|
643
|
+
|
|
644
|
+
**Bash / Zsh (Recommended)**
|
|
645
|
+
```bash
|
|
646
|
+
knowns task edit <id> --plan $'1. First step\n2. Second step\n3. Third step'
|
|
647
|
+
```
|
|
648
|
+
|
|
649
|
+
**PowerShell**
|
|
650
|
+
```powershell
|
|
651
|
+
knowns task edit <id> --plan "1. First step`n2. Second step`n3. Third step"
|
|
652
|
+
```
|
|
653
|
+
|
|
654
|
+
**Cross-platform (Using printf)**
|
|
655
|
+
```bash
|
|
656
|
+
knowns task edit <id> --plan "$(printf '1. First step\n2. Second step\n3. Third step')"
|
|
657
|
+
```
|
|
658
|
+
|
|
659
|
+
**Using heredoc (for long content)**
|
|
660
|
+
```bash
|
|
661
|
+
knowns task edit <id> --plan "$(cat <<EOF
|
|
662
|
+
1. First step
|
|
663
|
+
2. Second step
|
|
664
|
+
3. Third step
|
|
665
|
+
EOF
|
|
666
|
+
)"
|
|
667
|
+
```
|
|
668
|
+
|
|
669
|
+
### Path Separators
|
|
670
|
+
|
|
671
|
+
- **Unix/macOS**: Use forward slashes: `./docs/api.md`
|
|
672
|
+
- **Windows**: Both work, but prefer forward slashes for consistency
|
|
287
673
|
|
|
288
674
|
---
|
|
289
675
|
|
|
290
|
-
##
|
|
676
|
+
## Best Practices Checklist
|
|
677
|
+
|
|
678
|
+
### For AI Agents: Session Start
|
|
291
679
|
|
|
292
|
-
|
|
293
|
-
-
|
|
294
|
-
-
|
|
295
|
-
-
|
|
296
|
-
- `done` - Completed
|
|
297
|
-
- `blocked` - Waiting on dependency
|
|
680
|
+
- [ ] List all docs: `knowns doc list --plain`
|
|
681
|
+
- [ ] Read README/ARCHITECTURE docs
|
|
682
|
+
- [ ] Understand coding conventions
|
|
683
|
+
- [ ] Review current task backlog
|
|
298
684
|
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
-
|
|
302
|
-
-
|
|
685
|
+
### Before Starting Work
|
|
686
|
+
|
|
687
|
+
- [ ] Task has clear acceptance criteria
|
|
688
|
+
- [ ] ALL refs in task followed (`@.knowns/...`)
|
|
689
|
+
- [ ] Nested refs recursively followed until complete context gathered
|
|
690
|
+
- [ ] Related docs searched: `knowns search "keyword" --type doc --plain`
|
|
691
|
+
- [ ] ALL relevant docs read: `knowns doc view "Doc Name" --plain`
|
|
692
|
+
- [ ] Similar done tasks reviewed for patterns
|
|
693
|
+
- [ ] Task assigned to self: `-a @me`
|
|
694
|
+
- [ ] Status set to in-progress: `-s in-progress`
|
|
695
|
+
- [ ] Timer started: `knowns time start <id>`
|
|
696
|
+
|
|
697
|
+
### During Work
|
|
698
|
+
|
|
699
|
+
- [ ] Implementation plan created and approved
|
|
700
|
+
- [ ] Doc links included in plan: `[file.md](./path/file.md)`
|
|
701
|
+
- [ ] Criteria checked as completed: `--check-ac <index>`
|
|
702
|
+
- [ ] Progress notes appended: `--append-notes "✓ ..."`
|
|
703
|
+
|
|
704
|
+
### After Work
|
|
705
|
+
|
|
706
|
+
- [ ] All acceptance criteria checked
|
|
707
|
+
- [ ] Implementation notes added: `--notes "..."`
|
|
708
|
+
- [ ] Timer stopped: `knowns time stop`
|
|
709
|
+
- [ ] Tests passing
|
|
710
|
+
- [ ] Documentation updated
|
|
711
|
+
- [ ] Status set to done: `-s done`
|
|
303
712
|
|
|
304
713
|
---
|
|
305
714
|
|
|
306
|
-
## Quick Reference
|
|
715
|
+
## Quick Reference Card
|
|
307
716
|
|
|
308
717
|
```bash
|
|
309
|
-
#
|
|
718
|
+
# === AGENT INITIALIZATION (Once per session) ===
|
|
719
|
+
knowns doc list --plain
|
|
720
|
+
knowns doc view "README" --plain
|
|
721
|
+
knowns doc view "ARCHITECTURE" --plain
|
|
722
|
+
knowns doc view "CONVENTIONS" --plain
|
|
723
|
+
|
|
724
|
+
# === FULL WORKFLOW ===
|
|
310
725
|
knowns task create "Title" -d "Description" --ac "Criterion"
|
|
311
|
-
knowns task edit <id> -s in-progress -a @
|
|
726
|
+
knowns task edit <id> -s in-progress -a @me
|
|
312
727
|
knowns time start <id>
|
|
313
728
|
knowns search "keyword" --type doc --plain
|
|
314
729
|
knowns doc view "Doc Name" --plain
|
|
730
|
+
knowns search "keyword" --type task --status done --plain # Learn from history
|
|
315
731
|
knowns task edit <id> --plan $'1. Step (see [file.md](./file.md))\n2. Step'
|
|
316
|
-
# ... implement
|
|
732
|
+
# ... wait for approval, then implement ...
|
|
317
733
|
knowns task edit <id> --check-ac 1 --check-ac 2
|
|
318
|
-
knowns task edit <id> --append-notes "✓ Completed"
|
|
734
|
+
knowns task edit <id> --append-notes "✓ Completed feature"
|
|
319
735
|
knowns time stop
|
|
320
736
|
knowns task edit <id> -s done
|
|
321
737
|
|
|
322
|
-
#
|
|
738
|
+
# === VIEW & SEARCH ===
|
|
323
739
|
knowns task view <id> --plain
|
|
324
|
-
|
|
325
|
-
# List tasks
|
|
326
740
|
knowns task list --plain
|
|
327
|
-
knowns task list --status in-progress --assignee @
|
|
328
|
-
|
|
329
|
-
# Search
|
|
741
|
+
knowns task list --status in-progress --assignee @me --plain
|
|
330
742
|
knowns search "query" --plain
|
|
331
743
|
knowns search "bug" --type task --status in-progress --plain
|
|
744
|
+
|
|
745
|
+
# === TIME TRACKING ===
|
|
746
|
+
knowns time start <id>
|
|
747
|
+
knowns time stop
|
|
748
|
+
knowns time status
|
|
749
|
+
knowns time report --from "2025-12-01" --to "2025-12-31"
|
|
750
|
+
|
|
751
|
+
# === DOCUMENTATION ===
|
|
752
|
+
knowns doc list --plain
|
|
753
|
+
knowns doc view "path/doc-name" --plain
|
|
754
|
+
knowns doc create "Title" -d "Description" -t "tags" -f "folder"
|
|
755
|
+
knowns doc edit "doc-name" -c "New content"
|
|
756
|
+
knowns doc edit "doc-name" -a "Appended content"
|
|
332
757
|
```
|
|
333
758
|
|
|
334
759
|
---
|
|
335
760
|
|
|
336
|
-
**Last Updated**: 2025-12-26
|
|
337
|
-
**Version**: 2.1.0
|
|
338
761
|
**Maintained By**: Knowns CLI Team
|
|
339
762
|
|
|
340
763
|
<!-- KNOWNS GUIDELINES END -->
|
|
@@ -343,3 +766,9 @@ knowns search "bug" --type task --status in-progress --plain
|
|
|
343
766
|
|
|
344
767
|
|
|
345
768
|
|
|
769
|
+
|
|
770
|
+
|
|
771
|
+
|
|
772
|
+
|
|
773
|
+
|
|
774
|
+
|