@buba_71/levit 0.3.4 → 0.8.2

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.
Files changed (83) hide show
  1. package/README.md +192 -7
  2. package/dist/bin/cli.js +67 -24
  3. package/dist/src/commands/decision.js +74 -0
  4. package/dist/src/commands/feature.js +159 -0
  5. package/dist/src/commands/handoff.js +71 -0
  6. package/dist/src/commands/index.js +13 -0
  7. package/dist/src/commands/init.js +53 -39
  8. package/dist/src/commands/validate.js +84 -0
  9. package/dist/src/core/cli_args.js +35 -0
  10. package/dist/src/core/error_helper.js +93 -0
  11. package/dist/src/core/errors.js +25 -0
  12. package/dist/src/core/frontmatter.js +62 -0
  13. package/dist/src/core/ids.js +34 -0
  14. package/dist/src/core/levit_project.js +30 -0
  15. package/dist/src/core/logger.js +77 -0
  16. package/dist/src/core/table.js +63 -0
  17. package/dist/src/core/write_file.js +15 -0
  18. package/dist/src/init.js +9 -0
  19. package/dist/src/readers/decision_reader.js +47 -0
  20. package/dist/src/readers/feature_reader.js +48 -0
  21. package/dist/src/readers/handoff_reader.js +47 -0
  22. package/dist/src/services/decision_service.js +49 -0
  23. package/dist/src/services/feature_service.js +89 -0
  24. package/dist/src/services/handoff_service.js +37 -0
  25. package/dist/src/services/manifest_service.js +89 -0
  26. package/dist/src/services/project_service.js +39 -0
  27. package/dist/src/services/validation_service.js +461 -0
  28. package/dist/src/types/domain.js +2 -0
  29. package/dist/src/types/index.js +2 -0
  30. package/dist/src/types/manifest.js +26 -0
  31. package/dist/tests/cli/integration.test.js +165 -0
  32. package/dist/tests/services/decision_service.test.js +27 -0
  33. package/dist/tests/services/feature_service.test.js +42 -0
  34. package/dist/tests/services/handoff_service.test.js +28 -0
  35. package/dist/tests/services/manifest_service.test.js +189 -0
  36. package/dist/tests/services/validation_service.test.js +196 -0
  37. package/package.json +7 -2
  38. package/templates/default/.github/workflows/README.md +56 -0
  39. package/templates/default/.github/workflows/levit-validate.yml +93 -0
  40. package/templates/default/.gitlab-ci.yml +73 -0
  41. package/templates/default/.levit/AGENT_CONTRACT.md +34 -0
  42. package/templates/default/.levit/AGENT_ONBOARDING.md +29 -0
  43. package/templates/default/.levit/evals/README.md +14 -0
  44. package/templates/default/.levit/evals/conformance.eval.ts +16 -0
  45. package/templates/default/.levit/features/INTENT.md +32 -0
  46. package/templates/default/.levit/features/README.md +11 -0
  47. package/templates/default/.levit/handoff/.gitkeep +0 -0
  48. package/templates/default/.levit/prompts/global-rules.md +10 -0
  49. package/templates/default/.levit/prompts/refactoring-guidelines.md +9 -0
  50. package/templates/default/.levit/workflows/example-task.md +9 -0
  51. package/templates/default/.levit/workflows/submit-for-review.md +18 -0
  52. package/templates/default/HUMAN_AGENT_MANAGER.md +654 -0
  53. package/templates/default/MIGRATION_GUIDE.md +597 -0
  54. package/templates/default/README.md +49 -11
  55. package/templates/default/SOCIAL_CONTRACT.md +5 -0
  56. package/templates/symfony/.github/workflows/README.md +56 -0
  57. package/templates/symfony/.github/workflows/levit-validate.yml +82 -0
  58. package/templates/symfony/.gitlab-ci.yml +62 -0
  59. package/templates/symfony/.levit/AGENT_CONTRACT.md +34 -0
  60. package/templates/symfony/.levit/AGENT_ONBOARDING.md +124 -0
  61. package/templates/symfony/.levit/decisions/.gitkeep +0 -0
  62. package/templates/symfony/.levit/features/INTENT.md +32 -0
  63. package/templates/symfony/.levit/features/README.md +11 -0
  64. package/templates/symfony/.levit/handoff/.gitkeep +0 -0
  65. package/templates/symfony/.levit/prompts/global-rules.md +10 -0
  66. package/templates/symfony/.levit/prompts/refactoring-guidelines.md +9 -0
  67. package/templates/symfony/.levit/workflows/example-task.md +9 -0
  68. package/templates/symfony/.levit/workflows/submit-for-review.md +18 -0
  69. package/templates/symfony/HUMAN_AGENT_MANAGER.md +654 -0
  70. package/templates/symfony/MIGRATION_GUIDE.md +597 -0
  71. package/templates/symfony/README.md +101 -0
  72. package/templates/symfony/SOCIAL_CONTRACT.md +34 -0
  73. package/dist/tests/init.test.js +0 -58
  74. package/templates/default/features/README.md +0 -12
  75. /package/templates/default/{agents → .levit/agents}/AGENTS.md +0 -0
  76. /package/templates/default/{agents → .levit/agents}/boundaries.md +0 -0
  77. /package/templates/default/{package.json → .levit/decisions/.gitkeep} +0 -0
  78. /package/templates/default/{docs → .levit/docs}/architecture.md +0 -0
  79. /package/templates/default/{pipelines → .levit/pipelines}/README.md +0 -0
  80. /package/templates/default/{roles → .levit/roles}/README.md +0 -0
  81. /package/templates/default/{roles → .levit/roles}/devops.md +0 -0
  82. /package/templates/default/{roles → .levit/roles}/qa.md +0 -0
  83. /package/templates/default/{roles → .levit/roles}/security.md +0 -0
@@ -0,0 +1,654 @@
1
+ # Human-Agent Manager Guide
2
+
3
+ > **For Human Developers**: This guide teaches you how to effectively manage AI agents in your levit-kit project.
4
+
5
+ ---
6
+
7
+ ## Table of Contents
8
+
9
+ 1. [Understanding the Partnership](#understanding-the-partnership)
10
+ 2. [Setting Up for Success](#setting-up-for-success)
11
+ 3. [The Intent-First Workflow](#the-intent-first-workflow)
12
+ 4. [Creating Effective Features](#creating-effective-features)
13
+ 5. [Making Decisions Together](#making-decisions-together)
14
+ 6. [Handoffs That Work](#handoffs-that-work)
15
+ 7. [Reviewing Agent Work](#reviewing-agent-work)
16
+ 8. [Best Practices](#best-practices)
17
+ 9. [Anti-Patterns to Avoid](#anti-patterns-to-avoid)
18
+ 10. [Troubleshooting](#troubleshooting)
19
+
20
+ ---
21
+
22
+ ## Understanding the Partnership
23
+
24
+ ### The Human-AI Collaboration Model
25
+
26
+ In a levit-kit project, you and your AI agent have distinct but complementary roles:
27
+
28
+ **Your Role (Human)**:
29
+ - **Vision**: Define *what* needs to be built and *why*
30
+ - **Decisions**: Make architectural and business choices
31
+ - **Validation**: Review and approve agent work
32
+ - **Boundaries**: Set clear limits on what's in and out of scope
33
+
34
+ **Agent Role (AI)**:
35
+ - **Execution**: Implement the *how* based on your specifications
36
+ - **Suggestions**: Propose technical solutions and improvements
37
+ - **Consistency**: Maintain code quality and project standards
38
+ - **Documentation**: Keep technical records up to date
39
+
40
+ ### Why This Matters
41
+
42
+ Clear role separation prevents:
43
+ - ❌ Agents making business decisions
44
+ - ❌ You micromanaging implementation details
45
+ - ❌ Scope creep and feature drift
46
+ - ❌ Miscommunication and rework
47
+
48
+ ---
49
+
50
+ ## Setting Up for Success
51
+
52
+ ### Day One: Project Initialization
53
+
54
+ When you initialize a new project with `levit init`, you get a structure designed for AI collaboration. Your first steps:
55
+
56
+ 1. **Review the Social Contract**
57
+ - Open `SOCIAL_CONTRACT.md`
58
+ - Adjust principles to match your team's values
59
+ - This document sets the foundation for all AI interactions
60
+
61
+ 2. **Configure Agent Rules**
62
+ - Edit `.levit/prompts/global-rules.md`
63
+ - Define coding standards, language preferences, style guides
64
+ - Set technical constraints (dependencies, patterns, file sizes)
65
+
66
+ 3. **Define Project Roles**
67
+ - Customize `.levit/roles/` if needed
68
+ - Roles help agents understand context (developer, QA, security, etc.)
69
+
70
+ ### Ongoing: Maintain Your Governance
71
+
72
+ - **Keep `levit.json` updated**: This manifest is the machine-readable contract
73
+ - **Update constraints as needed**: Add forbidden patterns, dependency limits
74
+ - **Review and refine prompts**: Adjust `.levit/prompts/` based on experience
75
+
76
+ ---
77
+
78
+ ## The Intent-First Workflow
79
+
80
+ ### The Golden Rule
81
+
82
+ > **Never start with code. Always start with intent.**
83
+
84
+ ### The Complete Flow
85
+
86
+ ```
87
+ 1. Define Intent (levit feature new)
88
+
89
+ 2. Refine Boundaries (edit feature file)
90
+
91
+ 3. Make Technical Decisions (levit decision new)
92
+
93
+ 4. Create Handoff (levit handoff new)
94
+
95
+ 5. Agent Implements
96
+
97
+ 6. Review & Validate (levit validate)
98
+
99
+ 7. Iterate or Complete
100
+ ```
101
+
102
+ ### Why Intent-First?
103
+
104
+ Starting with code leads to:
105
+ - ❌ Unclear requirements
106
+ - ❌ Scope creep
107
+ - ❌ Technical debt
108
+ - ❌ Rework and frustration
109
+
110
+ Starting with intent leads to:
111
+ - ✅ Clear expectations
112
+ - ✅ Focused implementation
113
+ - ✅ Better quality
114
+ - ✅ Faster delivery
115
+
116
+ ---
117
+
118
+ ## Creating Effective Features
119
+
120
+ ### What Makes a Good Feature Specification?
121
+
122
+ A well-written feature in `.levit/features/` should answer:
123
+
124
+ 1. **Vision (The "Why")**
125
+ - What problem does this solve?
126
+ - Who benefits?
127
+ - What's the user story?
128
+
129
+ 2. **Success Criteria (The "What")**
130
+ - How do we know it's done?
131
+ - What are the acceptance criteria?
132
+ - What tests prove it works?
133
+
134
+ 3. **Boundaries (The "No")**
135
+ - What's explicitly out of scope?
136
+ - What won't we build?
137
+ - What assumptions are we making?
138
+
139
+ 4. **Technical Constraints**
140
+ - Dependencies allowed/forbidden
141
+ - Performance requirements
142
+ - Security considerations
143
+
144
+ 5. **Agent Task**
145
+ - Specific instructions for the AI
146
+ - Implementation hints
147
+ - Code patterns to follow
148
+
149
+ ### Example: Good vs. Bad Feature
150
+
151
+ **❌ Bad Feature**:
152
+ ```markdown
153
+ # INTENT: Add login
154
+
155
+ Build a login page.
156
+ ```
157
+
158
+ **✅ Good Feature**:
159
+ ```markdown
160
+ # INTENT: User Authentication
161
+
162
+ ## 1. Vision (The "Why")
163
+ - **User Story**: As a user, I want to authenticate with email/password so I can access my account securely.
164
+ - **Priority**: High - blocks all user-facing features
165
+
166
+ ## 2. Success Criteria (The "What")
167
+ - [ ] User can register with email and password
168
+ - [ ] User can login with valid credentials
169
+ - [ ] Invalid credentials show clear error messages
170
+ - [ ] Session persists across page refreshes
171
+ - [ ] Password requirements enforced (min 8 chars, complexity)
172
+
173
+ ## 3. Boundaries (The "No")
174
+ - **Not in scope**: OAuth providers (Google, GitHub) - future feature
175
+ - **Not in scope**: Password reset flow - separate feature
176
+ - **Not in scope**: Two-factor authentication - future feature
177
+ - **Assumption**: Email verification happens asynchronously
178
+
179
+ ## 4. Technical Constraints
180
+ - Use JWT for session tokens (already decided in ADR-002)
181
+ - Store passwords with bcrypt (security requirement)
182
+ - Follow existing API patterns in `/api/auth/`
183
+ - Maximum response time: 200ms for login endpoint
184
+
185
+ ## 5. Agent Task
186
+ - Implement `/api/auth/register` and `/api/auth/login` endpoints
187
+ - Create user model with email, password_hash, created_at fields
188
+ - Add validation middleware for email format and password strength
189
+ - Write integration tests for happy path and error cases
190
+ - Update API documentation
191
+ ```
192
+
193
+ ### Tips for Writing Features
194
+
195
+ - **Be specific**: "Add validation" is vague. "Validate email format and password strength" is clear.
196
+ - **Set boundaries**: Explicitly state what you're NOT building prevents scope creep.
197
+ - **Link decisions**: Reference ADRs when technical choices are already made.
198
+ - **Update status**: Use `levit feature status <id> <status>` to track progress.
199
+
200
+ ---
201
+
202
+ ## Making Decisions Together
203
+
204
+ ### When to Create an ADR
205
+
206
+ Create an Architecture Decision Record (`levit decision new`) when:
207
+ - ✅ Choosing a technology (database, framework, library)
208
+ - ✅ Defining an architectural pattern
209
+ - ✅ Setting a coding standard or convention
210
+ - ✅ Making a trade-off that affects multiple features
211
+
212
+ **Don't create an ADR for**:
213
+ - ❌ Implementation details (which function name to use)
214
+ - ❌ Temporary choices (quick fixes)
215
+ - ❌ Obvious decisions (using existing patterns)
216
+
217
+ ### The Decision Process
218
+
219
+ 1. **Identify the Need**: You or the agent notices a decision is needed
220
+ 2. **Create ADR**: `levit decision new --title "Use PostgreSQL" --feature .levit/features/001-auth.md`
221
+ 3. **Document Context**: Why this decision? What alternatives were considered?
222
+ 4. **Make the Choice**: Human makes the final decision
223
+ 5. **Link to Features**: Reference the ADR in relevant features
224
+
225
+ ### Example ADR Structure
226
+
227
+ ```markdown
228
+ # ADR-001: Use PostgreSQL for User Data
229
+
230
+ ## Context
231
+ We need persistent storage for user accounts. Options considered:
232
+ - PostgreSQL (relational, ACID, mature)
233
+ - MongoDB (NoSQL, flexible schema)
234
+ - SQLite (file-based, simple)
235
+
236
+ ## Decision
237
+ Use PostgreSQL because:
238
+ - ACID guarantees for financial data
239
+ - Strong ecosystem and tooling
240
+ - Team familiarity
241
+
242
+ ## Consequences
243
+ - Need to set up PostgreSQL instance
244
+ - ORM required (choose in separate ADR)
245
+ - Migration strategy needed
246
+ ```
247
+
248
+ ---
249
+
250
+ ## Handoffs That Work
251
+
252
+ ### What is a Handoff?
253
+
254
+ A handoff (created with `levit handoff new`) packages context for an AI agent. It's like a briefing document that tells the agent:
255
+ - What to work on
256
+ - What to read first
257
+ - What boundaries to respect
258
+ - How to deliver results
259
+
260
+ ### Creating Effective Handoffs
261
+
262
+ **Good handoff includes**:
263
+ - ✅ Clear feature reference
264
+ - ✅ Specific role (developer, QA, security)
265
+ - ✅ Context about current state
266
+ - ✅ Expected deliverables
267
+ - ✅ Review criteria
268
+
269
+ **Example handoff creation**:
270
+ ```bash
271
+ levit handoff new \
272
+ --feature .levit/features/001-user-authentication.md \
273
+ --role developer \
274
+ --yes
275
+ ```
276
+
277
+ This creates a file in `.levit/handoff/` with:
278
+ - Link to the feature
279
+ - Instructions to read onboarding docs
280
+ - Boundaries from the feature
281
+ - Review protocol
282
+
283
+ ### When to Create a Handoff
284
+
285
+ - **Starting a new feature**: Give the agent clear context
286
+ - **Switching agents**: Hand off from one AI session to another
287
+ - **Complex tasks**: Break down large features into focused handoffs
288
+ - **Different roles**: Create separate handoffs for developer vs. QA vs. security
289
+
290
+ ### Tips for Handoffs
291
+
292
+ - **One feature per handoff**: Keep focus narrow
293
+ - **Update handoffs**: If requirements change, update the handoff file
294
+ - **Close handoffs**: Mark as completed when done
295
+
296
+ ---
297
+
298
+ ## Reviewing Agent Work
299
+
300
+ ### The Review Checklist
301
+
302
+ When an agent submits work, check:
303
+
304
+ 1. **✅ Matches Intent**
305
+ - Does the implementation match the feature specification?
306
+ - Are boundaries respected?
307
+ - Is scope creep avoided?
308
+
309
+ 2. **✅ Follows Decisions**
310
+ - Are ADRs followed?
311
+ - Are technical constraints respected?
312
+ - Are coding standards met?
313
+
314
+ 3. **✅ Quality Standards**
315
+ - Are tests included?
316
+ - Does `levit validate` pass?
317
+ - Is code readable and maintainable?
318
+
319
+ 4. **✅ Documentation**
320
+ - Are changes traceable to features?
321
+ - Are new decisions documented?
322
+ - Is handoff updated?
323
+
324
+ ### Review Workflow
325
+
326
+ 1. **Read the Handoff Summary**
327
+ - Agent should provide: what changed, how tested, next steps, open questions
328
+
329
+ 2. **Run Validation**
330
+ ```bash
331
+ levit validate
332
+ ```
333
+ - Checks project structure
334
+ - Validates dependencies
335
+ - Verifies constraints
336
+
337
+ 3. **Check Feature Status**
338
+ ```bash
339
+ levit feature list
340
+ ```
341
+ - Verify feature status is updated
342
+ - Check if work is complete
343
+
344
+ 4. **Code Review**
345
+ - Read the actual code changes
346
+ - Verify tests pass
347
+ - Check for anti-patterns
348
+
349
+ 5. **Provide Feedback**
350
+ - Be specific: "Add error handling for network failures"
351
+ - Reference standards: "Follow ADR-003 for error responses"
352
+ - Set expectations: "Update feature status when done"
353
+
354
+ ### Common Review Scenarios
355
+
356
+ **Scenario 1: Agent Did Too Much**
357
+ - **Problem**: Agent added features not in scope
358
+ - **Solution**: Point to boundaries section, ask to revert extras
359
+ - **Prevention**: Be explicit about what's NOT included
360
+
361
+ **Scenario 2: Agent Didn't Follow ADR**
362
+ - **Problem**: Agent used different technology than decided
363
+ - **Solution**: Reference the ADR, ask to align
364
+ - **Prevention**: Link ADRs in feature specifications
365
+
366
+ **Scenario 3: Agent Broke Tests**
367
+ - **Problem**: Existing tests fail after changes
368
+ - **Solution**: Ask agent to fix before review
369
+ - **Prevention**: Emphasize "tests first" in prompts
370
+
371
+ ---
372
+
373
+ ## Best Practices
374
+
375
+ ### 1. Start Small, Iterate
376
+
377
+ - ✅ Begin with minimal features
378
+ - ✅ Get feedback early
379
+ - ✅ Expand based on learnings
380
+
381
+ ### 2. Be Explicit About Boundaries
382
+
383
+ - ✅ State what's out of scope
384
+ - ✅ Set clear "no" sections
385
+ - ✅ Reference existing decisions
386
+
387
+ ### 3. Keep Features Focused
388
+
389
+ - ✅ One feature = one clear goal
390
+ - ✅ Avoid "and also" features
391
+ - ✅ Split large features into smaller ones
392
+
393
+ ### 4. Document Decisions Early
394
+
395
+ - ✅ Create ADRs before implementation
396
+ - ✅ Link ADRs to features
397
+ - ✅ Update ADRs when context changes
398
+
399
+ ### 5. Validate Frequently
400
+
401
+ - ✅ Run `levit validate` after agent work
402
+ - ✅ Check feature status regularly
403
+ - ✅ Review handoffs before starting
404
+
405
+ ### 6. Maintain the Manifest
406
+
407
+ - ✅ Keep `levit.json` in sync
408
+ - ✅ Update constraints as project evolves
409
+ - ✅ Review governance periodically
410
+
411
+ ### 7. Communicate Clearly
412
+
413
+ - ✅ Use precise language in features
414
+ - ✅ Provide examples when helpful
415
+ - ✅ Reference existing patterns
416
+
417
+ ---
418
+
419
+ ## Anti-Patterns to Avoid
420
+
421
+ ### ❌ Anti-Pattern 1: Code-First Development
422
+
423
+ **Problem**: Starting with code before defining intent
424
+ ```bash
425
+ # Bad: Agent, add a login form
426
+ # (No feature spec, no boundaries, no decisions)
427
+ ```
428
+
429
+ **Solution**: Always create feature first
430
+ ```bash
431
+ levit feature new --title "User Authentication"
432
+ # Then refine the spec, then handoff
433
+ ```
434
+
435
+ ### ❌ Anti-Pattern 2: Vague Boundaries
436
+
437
+ **Problem**: Not being explicit about what's excluded
438
+ ```markdown
439
+ ## Boundaries
440
+ - Keep it simple
441
+ ```
442
+
443
+ **Solution**: Be specific
444
+ ```markdown
445
+ ## Boundaries
446
+ - Not in scope: OAuth providers (Google, GitHub)
447
+ - Not in scope: Password reset (separate feature)
448
+ - Not in scope: Two-factor authentication
449
+ ```
450
+
451
+ ### ❌ Anti-Pattern 3: Skipping Decisions
452
+
453
+ **Problem**: Letting agent choose technology without ADR
454
+ ```bash
455
+ # Bad: Agent picks database, framework, etc. without human decision
456
+ ```
457
+
458
+ **Solution**: Create ADRs for significant choices
459
+ ```bash
460
+ levit decision new --title "Use PostgreSQL" --feature .levit/features/001-auth.md
461
+ ```
462
+
463
+ ### ❌ Anti-Pattern 4: Ignoring Validation
464
+
465
+ **Problem**: Not running `levit validate` after changes
466
+ ```bash
467
+ # Bad: Accept agent work without validation
468
+ ```
469
+
470
+ **Solution**: Always validate
471
+ ```bash
472
+ levit validate
473
+ # Fix issues before accepting
474
+ ```
475
+
476
+ ### ❌ Anti-Pattern 5: Feature Drift
477
+
478
+ **Problem**: Feature scope expands during implementation
479
+ ```markdown
480
+ # Feature says: "User login"
481
+ # Agent builds: "User login + password reset + email verification"
482
+ ```
483
+
484
+ **Solution**: Reference boundaries, reject extras
485
+ ```markdown
486
+ # Point agent to "Boundaries" section
487
+ # Ask to revert out-of-scope changes
488
+ ```
489
+
490
+ ### ❌ Anti-Pattern 6: No Handoffs
491
+
492
+ **Problem**: Starting agent work without context
493
+ ```bash
494
+ # Bad: "Agent, work on feature 001" (no handoff)
495
+ ```
496
+
497
+ **Solution**: Always create handoff
498
+ ```bash
499
+ levit handoff new --feature .levit/features/001-auth.md --role developer
500
+ ```
501
+
502
+ ### ❌ Anti-Pattern 7: Micromanaging Implementation
503
+
504
+ **Problem**: Specifying exact code structure in features
505
+ ```markdown
506
+ ## Agent Task
507
+ - Create function `validateEmail()` with regex `^[a-z]+@[a-z]+\.[a-z]+$`
508
+ - Use if/else structure, not switch
509
+ ```
510
+
511
+ **Solution**: Focus on what, not how
512
+ ```markdown
513
+ ## Agent Task
514
+ - Validate email format according to RFC 5322
515
+ - Follow existing validation patterns in the codebase
516
+ ```
517
+
518
+ ---
519
+
520
+ ## Troubleshooting
521
+
522
+ ### Problem: Agent Doesn't Follow Boundaries
523
+
524
+ **Symptoms**: Agent implements features not in scope
525
+
526
+ **Solutions**:
527
+ 1. Check if boundaries are explicit in feature file
528
+ 2. Reference boundaries section in handoff
529
+ 3. Ask agent to read feature file again
530
+ 4. Update `.levit/prompts/global-rules.md` to emphasize boundaries
531
+
532
+ ### Problem: Agent Makes Technical Decisions
533
+
534
+ **Symptoms**: Agent chooses technology without ADR
535
+
536
+ **Solutions**:
537
+ 1. Create ADR for the decision
538
+ 2. Link ADR to feature
539
+ 3. Update prompts to require ADR reference
540
+ 4. Review agent work before accepting
541
+
542
+ ### Problem: Agent Breaks Existing Code
543
+
544
+ **Symptoms**: Tests fail, validation errors after agent work
545
+
546
+ **Solutions**:
547
+ 1. Run `levit validate` before accepting work
548
+ 2. Ask agent to run tests before submitting
549
+ 3. Update prompts to emphasize "tests first"
550
+ 4. Review changes more carefully
551
+
552
+ ### Problem: Feature Scope Creeps
553
+
554
+ **Symptoms**: Feature grows beyond original intent
555
+
556
+ **Solutions**:
557
+ 1. Split feature into smaller ones
558
+ 2. Create new feature for extras
559
+ 3. Update original feature boundaries
560
+ 4. Reject out-of-scope changes
561
+
562
+ ### Problem: Agent Doesn't Update Status
563
+
564
+ **Symptoms**: Feature status not updated after completion
565
+
566
+ **Solutions**:
567
+ 1. Remind agent to update status in handoff protocol
568
+ 2. Use `levit feature status <id> completed` manually
569
+ 3. Add status update to review checklist
570
+ 4. Update prompts to emphasize status tracking
571
+
572
+ ### Problem: Handoffs Are Unclear
573
+
574
+ **Symptoms**: Agent asks many clarifying questions
575
+
576
+ **Solutions**:
577
+ 1. Review handoff template
578
+ 2. Add more context to feature file
579
+ 3. Link relevant ADRs in handoff
580
+ 4. Provide examples in feature specification
581
+
582
+ ### Problem: Validation Fails Frequently
583
+
584
+ **Symptoms**: `levit validate` shows many errors
585
+
586
+ **Solutions**:
587
+ 1. Review validation errors carefully
588
+ 2. Fix structural issues first
589
+ 3. Update constraints if too strict
590
+ 4. Train agent on validation requirements
591
+
592
+ ---
593
+
594
+ ## Quick Reference
595
+
596
+ ### Essential Commands
597
+
598
+ ```bash
599
+ # Create a feature
600
+ levit feature new --title "Feature Name" --slug feature-name
601
+
602
+ # List all features
603
+ levit feature list
604
+
605
+ # Update feature status
606
+ levit feature status <id> <active|draft|deprecated|completed>
607
+
608
+ # Create a decision
609
+ levit decision new --title "Decision Title" --feature .levit/features/001-feature.md
610
+
611
+ # Create a handoff
612
+ levit handoff new --feature .levit/features/001-feature.md --role developer
613
+
614
+ # Validate project
615
+ levit validate
616
+ ```
617
+
618
+ ### Key Files
619
+
620
+ - `SOCIAL_CONTRACT.md`: Project philosophy and principles
621
+ - `.levit/AGENT_ONBOARDING.md`: Agent's operating manual
622
+ - `.levit/features/`: Your project roadmap
623
+ - `.levit/decisions/`: Technical decision history
624
+ - `.levit/handoff/`: Agent briefings
625
+ - `levit.json`: Machine-readable project contract
626
+
627
+ ### Workflow Checklist
628
+
629
+ - [ ] Feature created with `levit feature new`
630
+ - [ ] Boundaries explicitly defined
631
+ - [ ] ADRs created for technical decisions
632
+ - [ ] Handoff created with `levit handoff new`
633
+ - [ ] Agent work reviewed
634
+ - [ ] `levit validate` passes
635
+ - [ ] Feature status updated
636
+ - [ ] Documentation updated
637
+
638
+ ---
639
+
640
+ ## Conclusion
641
+
642
+ Managing AI agents effectively requires:
643
+ - **Clear intent** before implementation
644
+ - **Explicit boundaries** to prevent drift
645
+ - **Documented decisions** for consistency
646
+ - **Structured handoffs** for context
647
+ - **Regular validation** for quality
648
+
649
+ Remember: **You define the what and why. The agent handles the how.**
650
+
651
+ ---
652
+
653
+ *This guide is part of levit-kit v0.8.0. For updates, see the [changelog](../changelog.md).*
654
+