kata-context 0.1.0 → 0.2.0

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 (108) hide show
  1. package/.claude/hooks/kata-statusline.js +96 -0
  2. package/.env.example +6 -0
  3. package/.github/workflows/ci.yml +33 -0
  4. package/.github/workflows/claude-code-review.yml +44 -0
  5. package/.github/workflows/claude.yml +50 -0
  6. package/.github/workflows/release.yml +1 -1
  7. package/.husky/pre-commit +1 -0
  8. package/.planning/MILESTONES.md +53 -0
  9. package/.planning/PROJECT.md +70 -37
  10. package/.planning/STATE.md +32 -23
  11. package/.planning/codebase/ARCHITECTURE.md +153 -0
  12. package/.planning/codebase/CONCERNS.md +247 -0
  13. package/.planning/codebase/CONVENTIONS.md +178 -0
  14. package/.planning/codebase/INTEGRATIONS.md +127 -0
  15. package/.planning/codebase/STACK.md +86 -0
  16. package/.planning/codebase/STRUCTURE.md +197 -0
  17. package/.planning/codebase/TESTING.md +248 -0
  18. package/.planning/milestones/v0.1.0-MILESTONE-AUDIT.md +208 -0
  19. package/.planning/{REQUIREMENTS.md → milestones/v0.1.0-REQUIREMENTS.md} +28 -12
  20. package/.planning/{ROADMAP.md → milestones/v0.1.0-ROADMAP.md} +40 -17
  21. package/.planning/milestones/v0.2.0-MILESTONE-AUDIT.md +119 -0
  22. package/.planning/milestones/v0.2.0-REQUIREMENTS.md +89 -0
  23. package/.planning/milestones/v0.2.0-ROADMAP.md +100 -0
  24. package/.planning/phases/02-automation-and-deployment/02-01-PLAN.md +187 -0
  25. package/.planning/phases/02-automation-and-deployment/02-01-SUMMARY.md +116 -0
  26. package/.planning/phases/02-automation-and-deployment/02-02-PLAN.md +340 -0
  27. package/.planning/phases/02-automation-and-deployment/02-02-SUMMARY.md +111 -0
  28. package/.planning/phases/02-automation-and-deployment/02-RESEARCH.md +362 -0
  29. package/.planning/phases/02-automation-and-deployment/02-UAT.md +37 -0
  30. package/.planning/phases/02-automation-and-deployment/02-VERIFICATION.md +402 -0
  31. package/.planning/phases/03-database-foundation/03-01-PLAN.md +289 -0
  32. package/.planning/phases/03-database-foundation/03-01-SUMMARY.md +155 -0
  33. package/.planning/phases/03-database-foundation/03-02-PLAN.md +291 -0
  34. package/.planning/phases/03-database-foundation/03-02-SUMMARY.md +175 -0
  35. package/.planning/phases/03-database-foundation/03-UAT.md +22 -0
  36. package/.planning/phases/03-database-foundation/03-VERIFICATION.md +229 -0
  37. package/.planning/phases/04-repository-layer/04-01-PLAN.md +442 -0
  38. package/.planning/phases/04-repository-layer/04-01-SUMMARY.md +156 -0
  39. package/.planning/phases/04-repository-layer/04-02-PLAN.md +668 -0
  40. package/.planning/phases/04-repository-layer/04-02-SUMMARY.md +162 -0
  41. package/.planning/phases/04-repository-layer/04-RESEARCH.md +577 -0
  42. package/.planning/phases/04-repository-layer/04-UAT.md +40 -0
  43. package/.planning/phases/04-repository-layer/04-VERIFICATION.md +195 -0
  44. package/.planning/phases/05-api-testing-layer/05-01-PLAN.md +159 -0
  45. package/.planning/phases/05-api-testing-layer/05-01-SUMMARY.md +118 -0
  46. package/.planning/phases/05-api-testing-layer/05-02-PLAN.md +173 -0
  47. package/.planning/phases/05-api-testing-layer/05-02-SUMMARY.md +116 -0
  48. package/.planning/phases/05-api-testing-layer/05-03-PLAN.md +181 -0
  49. package/.planning/phases/05-api-testing-layer/05-03-SUMMARY.md +119 -0
  50. package/.planning/phases/05-api-testing-layer/05-04-PLAN.md +248 -0
  51. package/.planning/phases/05-api-testing-layer/05-04-SUMMARY.md +151 -0
  52. package/.planning/phases/05-api-testing-layer/05-RESEARCH.md +529 -0
  53. package/.planning/phases/05-api-testing-layer/05-UAT.md +52 -0
  54. package/.planning/phases/05-api-testing-layer/05-VERIFICATION.md +183 -0
  55. package/.planning/research/ARCHITECTURE.md +538 -465
  56. package/.planning/research/FEATURES.md +343 -190
  57. package/.planning/research/PITFALLS.md +277 -240
  58. package/.planning/research/STACK.md +195 -217
  59. package/.planning/research/SUMMARY.md +391 -323
  60. package/.planning/todos/review-suggestions.md +32 -0
  61. package/CHANGELOG.md +44 -0
  62. package/CLAUDE.md +90 -0
  63. package/README.md +46 -19
  64. package/api/health.ts +61 -0
  65. package/api/v1/contexts/[id]/index.ts +61 -0
  66. package/api/v1/contexts/[id]/messages.ts +85 -0
  67. package/api/v1/contexts/[id]/window.ts +51 -0
  68. package/api/v1/contexts/index.ts +46 -0
  69. package/drizzle.config.ts +12 -0
  70. package/kata-context.code-workspace +8 -0
  71. package/package.json +39 -4
  72. package/public/index.json +1 -0
  73. package/scripts/dev-server.ts +69 -0
  74. package/src/api/__tests__/contexts.integration.test.ts +226 -0
  75. package/src/api/__tests__/contexts.unit.test.ts +323 -0
  76. package/src/api/__tests__/errors.test.ts +45 -0
  77. package/src/api/__tests__/health.test.ts +92 -0
  78. package/src/api/__tests__/helpers.test.ts +104 -0
  79. package/src/api/__tests__/messages.integration.test.ts +408 -0
  80. package/src/api/__tests__/messages.unit.test.ts +446 -0
  81. package/src/api/__tests__/responses.test.ts +16 -0
  82. package/src/api/__tests__/schemas.test.ts +87 -0
  83. package/src/api/errors.ts +52 -0
  84. package/src/api/helpers.ts +70 -0
  85. package/src/api/index.ts +19 -0
  86. package/src/api/responses.ts +18 -0
  87. package/src/api/validation/schemas.ts +61 -0
  88. package/src/db/client.ts +53 -0
  89. package/src/db/migrations/0000_adorable_nuke.sql +33 -0
  90. package/src/db/migrations/0001_majestic_maddog.sql +8 -0
  91. package/src/db/migrations/meta/0000_snapshot.json +248 -0
  92. package/src/db/migrations/meta/0001_snapshot.json +255 -0
  93. package/src/db/migrations/meta/_journal.json +20 -0
  94. package/src/db/schema/contexts.ts +29 -0
  95. package/src/db/schema/index.ts +2 -0
  96. package/src/db/schema/messages.ts +50 -0
  97. package/src/repositories/__tests__/helpers.test.ts +74 -0
  98. package/src/repositories/context.repository.test.ts +109 -0
  99. package/src/repositories/context.repository.ts +99 -0
  100. package/src/repositories/helpers.ts +52 -0
  101. package/src/repositories/index.ts +4 -0
  102. package/src/repositories/message.repository.test.ts +421 -0
  103. package/src/repositories/message.repository.ts +215 -0
  104. package/src/repositories/types.ts +47 -0
  105. package/tsconfig.json +3 -2
  106. package/vercel.json +5 -0
  107. package/vitest.config.ts +17 -0
  108. package/vitest.setup.ts +32 -0
@@ -0,0 +1,96 @@
1
+ #!/usr/bin/env node
2
+ // Claude Code Statusline - Kata Plugin Edition
3
+ // Shows: model | current task | directory | context usage
4
+
5
+ import fs from "fs";
6
+ import os from "os";
7
+ import path from "path";
8
+
9
+ // Read JSON from stdin
10
+ let input = "";
11
+ process.stdin.setEncoding("utf8");
12
+ process.stdin.on("data", (chunk) => (input += chunk));
13
+ process.stdin.on("end", () => {
14
+ try {
15
+ const data = JSON.parse(input);
16
+ const model = data.model?.display_name || "Claude";
17
+ const dir = data.workspace?.current_dir || process.cwd();
18
+ const session = data.session_id || "";
19
+ const remaining = data.context_window?.remaining_percentage;
20
+
21
+ // Context window display (shows USED percentage)
22
+ let ctx = "";
23
+ if (remaining != null) {
24
+ const rem = Math.round(remaining);
25
+ const used = 100 - rem;
26
+
27
+ // Build progress bar (10 segments)
28
+ const filled = Math.floor(used / 10);
29
+ const bar = "\u2588".repeat(filled) + "\u2591".repeat(10 - filled);
30
+
31
+ // Color based on usage
32
+ if (used < 50) {
33
+ ctx = ` \x1b[32m${bar} ${used}%\x1b[0m`;
34
+ } else if (used < 65) {
35
+ ctx = ` \x1b[33m${bar} ${used}%\x1b[0m`;
36
+ } else if (used < 80) {
37
+ ctx = ` \x1b[38;5;208m${bar} ${used}%\x1b[0m`;
38
+ } else {
39
+ ctx = ` \x1b[5;31m\u{1F480} ${bar} ${used}%\x1b[0m`;
40
+ }
41
+ }
42
+
43
+ // Current task from todos
44
+ let task = "";
45
+ const homeDir = os.homedir();
46
+ const todosDir = path.join(homeDir, ".claude", "todos");
47
+ if (session && fs.existsSync(todosDir)) {
48
+ const files = fs
49
+ .readdirSync(todosDir)
50
+ .filter((f) => f.startsWith(session) && f.includes("-agent-") && f.endsWith(".json"))
51
+ .map((f) => ({ name: f, mtime: fs.statSync(path.join(todosDir, f)).mtime }))
52
+ .sort((a, b) => b.mtime - a.mtime);
53
+
54
+ if (files.length > 0) {
55
+ try {
56
+ const todos = JSON.parse(fs.readFileSync(path.join(todosDir, files[0].name), "utf8"));
57
+ const inProgress = todos.find((t) => t.status === "in_progress");
58
+ if (inProgress) task = inProgress.activeForm || "";
59
+ } catch (e) {}
60
+ }
61
+ }
62
+
63
+ // Kata update available?
64
+ let kataUpdate = "";
65
+ const currentDir = dir;
66
+
67
+ // For plugin installs, check the project-local cache
68
+ const cacheFile = path.join(currentDir, ".claude", "kata", "cache", "update-check.json");
69
+
70
+ if (fs.existsSync(cacheFile)) {
71
+ try {
72
+ const cache = JSON.parse(fs.readFileSync(cacheFile, "utf8"));
73
+
74
+ if (cache.update_available) {
75
+ // Plugin update message with version and both update methods
76
+ const latest = cache.latest || "new";
77
+ kataUpdate = `\x1b[33m⬆ v${latest}: /plugin (CC) or claude plugin update kata@kata-marketplace (term)\x1b[0m \u2502 `;
78
+ }
79
+ } catch (e) {}
80
+ }
81
+
82
+ // Output
83
+ const dirname = path.basename(dir);
84
+ if (task) {
85
+ process.stdout.write(
86
+ `${kataUpdate}\x1b[2m${model}\x1b[0m \u2502 \x1b[1m${task}\x1b[0m \u2502 \x1b[2m${dirname}\x1b[0m${ctx}`,
87
+ );
88
+ } else {
89
+ process.stdout.write(
90
+ `${kataUpdate}\x1b[2m${model}\x1b[0m \u2502 \x1b[2m${dirname}\x1b[0m${ctx}`,
91
+ );
92
+ }
93
+ } catch (e) {
94
+ // Silent fail - don't break statusline on parse errors
95
+ }
96
+ });
package/.env.example ADDED
@@ -0,0 +1,6 @@
1
+ # Database connection (use pooled endpoint with -pooler hostname)
2
+ # Format: postgresql://user:password@ep-xxx-pooler.region.aws.neon.tech/dbname?sslmode=require
3
+ DATABASE_URL=
4
+
5
+ # Enable corepack for pnpm 10 in Vercel
6
+ ENABLE_EXPERIMENTAL_COREPACK=1
@@ -0,0 +1,33 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ env:
10
+ HUSKY: 0 # Disable husky in CI (hooks not needed)
11
+
12
+ jobs:
13
+ lint-test:
14
+ runs-on: ubuntu-latest
15
+ timeout-minutes: 10
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+
19
+ - uses: pnpm/action-setup@v4
20
+
21
+ - uses: actions/setup-node@v4
22
+ with:
23
+ node-version: '24'
24
+ cache: 'pnpm'
25
+
26
+ - name: Install dependencies
27
+ run: pnpm install --frozen-lockfile
28
+
29
+ - name: Lint
30
+ run: pnpm run lint
31
+
32
+ - name: Test
33
+ run: pnpm run test:coverage
@@ -0,0 +1,44 @@
1
+ name: Claude Code Review
2
+
3
+ on:
4
+ pull_request:
5
+ types: [opened, synchronize, ready_for_review, reopened]
6
+ # Optional: Only run on specific file changes
7
+ # paths:
8
+ # - "src/**/*.ts"
9
+ # - "src/**/*.tsx"
10
+ # - "src/**/*.js"
11
+ # - "src/**/*.jsx"
12
+
13
+ jobs:
14
+ claude-review:
15
+ # Optional: Filter by PR author
16
+ # if: |
17
+ # github.event.pull_request.user.login == 'external-contributor' ||
18
+ # github.event.pull_request.user.login == 'new-developer' ||
19
+ # github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR'
20
+
21
+ runs-on: ubuntu-latest
22
+ permissions:
23
+ contents: read
24
+ pull-requests: read
25
+ issues: read
26
+ id-token: write
27
+
28
+ steps:
29
+ - name: Checkout repository
30
+ uses: actions/checkout@v4
31
+ with:
32
+ fetch-depth: 1
33
+
34
+ - name: Run Claude Code Review
35
+ id: claude-review
36
+ uses: anthropics/claude-code-action@v1
37
+ with:
38
+ claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
39
+ plugin_marketplaces: 'https://github.com/anthropics/claude-code.git'
40
+ plugins: 'code-review@claude-code-plugins'
41
+ prompt: '/code-review:code-review ${{ github.repository }}/pull/${{ github.event.pull_request.number }}'
42
+ # See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
43
+ # or https://code.claude.com/docs/en/cli-reference for available options
44
+
@@ -0,0 +1,50 @@
1
+ name: Claude Code
2
+
3
+ on:
4
+ issue_comment:
5
+ types: [created]
6
+ pull_request_review_comment:
7
+ types: [created]
8
+ issues:
9
+ types: [opened, assigned]
10
+ pull_request_review:
11
+ types: [submitted]
12
+
13
+ jobs:
14
+ claude:
15
+ if: |
16
+ (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
17
+ (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
18
+ (github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
19
+ (github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
20
+ runs-on: ubuntu-latest
21
+ permissions:
22
+ contents: read
23
+ pull-requests: read
24
+ issues: read
25
+ id-token: write
26
+ actions: read # Required for Claude to read CI results on PRs
27
+ steps:
28
+ - name: Checkout repository
29
+ uses: actions/checkout@v4
30
+ with:
31
+ fetch-depth: 1
32
+
33
+ - name: Run Claude Code
34
+ id: claude
35
+ uses: anthropics/claude-code-action@v1
36
+ with:
37
+ claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
38
+
39
+ # This is an optional setting that allows Claude to read CI results on PRs
40
+ additional_permissions: |
41
+ actions: read
42
+
43
+ # Optional: Give a custom prompt to Claude. If this is not specified, Claude will perform the instructions specified in the comment that tagged it.
44
+ # prompt: 'Update the pull request description to include a summary of changes.'
45
+
46
+ # Optional: Add claude_args to customize behavior and configuration
47
+ # See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
48
+ # or https://code.claude.com/docs/en/cli-reference for available options
49
+ # claude_args: '--allowed-tools Bash(gh pr:*)'
50
+
@@ -54,7 +54,7 @@ jobs:
54
54
 
55
55
  - name: Publish to npm
56
56
  if: steps.check.outputs.should_publish == 'true'
57
- run: npm publish --access public
57
+ run: npm publish --access public --ignore-scripts
58
58
  env:
59
59
  NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
60
60
 
@@ -0,0 +1 @@
1
+ pnpm exec lint-staged
@@ -0,0 +1,53 @@
1
+ # Project Milestones: Kata Context
2
+
3
+ ## v0.2.0 Database + Storage Layer (Shipped: 2026-02-04)
4
+
5
+ **Delivered:** PostgreSQL storage foundation with Drizzle ORM, repository abstraction, REST API, and 87 tests at 100% coverage.
6
+
7
+ **Phases completed:** 3-5 (8 plans total)
8
+
9
+ **Key accomplishments:**
10
+ - PostgreSQL on Neon with pgvector, Drizzle ORM, serverless connection pooling
11
+ - Type-safe schema for contexts (soft-delete, fork tracking) and messages (versioned, vector-ready)
12
+ - Repository layer: ContextRepository and MessageRepository with token-budgeted windowing
13
+ - REST API: 6 endpoints with Zod validation and RFC 9457 error format
14
+ - 87 tests (40 repository + 26 unit + 21 integration) with 100% coverage enforcement
15
+ - PGlite in-memory testing (no external database dependency)
16
+
17
+ **Stats:**
18
+ - 93 files created/modified
19
+ - 4,279 lines of TypeScript
20
+ - 3 phases, 8 plans, 23 requirements
21
+ - 6 days from v0.1.0 to ship (Jan 29 - Feb 3)
22
+
23
+ **Git range:** `v0.1.0` -> `8a50531`
24
+
25
+ **What's next:** Policy engine with compaction, context forking, and semantic retrieval (v0.3.0)
26
+
27
+ ---
28
+
29
+ ## v0.1.0 Core Setup (Shipped: 2026-01-29)
30
+
31
+ **Delivered:** TypeScript/Vercel project foundation with linting, testing, CI, and serverless infrastructure.
32
+
33
+ **Phases completed:** 1-2 (4 plans total)
34
+
35
+ **Key accomplishments:**
36
+ - TypeScript 5.9 with strict mode and NodeNext module resolution
37
+ - Biome 2.3 for linting and formatting with recommended rules
38
+ - Vitest 4 for testing with passWithNoTests for clean CI
39
+ - Husky v9 pre-commit hooks with lint-staged for automatic code validation
40
+ - GitHub Actions CI pipeline running lint and test on push/PR
41
+ - Vercel serverless health endpoint at `/api/health`
42
+
43
+ **Stats:**
44
+ - 39 files created/modified
45
+ - 39 lines of TypeScript
46
+ - 2 phases, 4 plans
47
+ - 1 day from start to ship
48
+
49
+ **Git range:** Initial commit -> `0fdbd5c`
50
+
51
+ **What's next:** Database schema and context engine (v0.2.0)
52
+
53
+ ---
@@ -2,45 +2,63 @@
2
2
 
3
3
  ## What This Is
4
4
 
5
- A standalone context policy engine for AI agents. Manages what goes in and out of the LLM context window compaction, summarization, retrieval, and budget-aware windowing. Framework-agnostic infrastructure: works with any agent system, or none.
5
+ A standalone context policy engine for AI agents. Manages what goes in and out of the LLM context window with policy-based compaction, summarization, retrieval, and budget-aware windowing. Framework-agnostic infrastructure backed by PostgreSQL with pgvector. Works with any agent system, or none.
6
6
 
7
7
  ## Core Value
8
8
 
9
9
  Given messages and a context budget, determine the optimal window to send to the model. Policy, not storage.
10
10
 
11
- ## Current Milestone: v0.1.0 Core Setup
11
+ ## Current State
12
12
 
13
- **Goal:** Establish project foundation with TypeScript/Vercel scaffolding, linting, and testing infrastructure.
13
+ **Shipped:** v0.2.0 Database + Storage Layer (2026-02-04)
14
+ - PostgreSQL on Neon with pgvector, Drizzle ORM, serverless connection pooling
15
+ - Type-safe schema for contexts (soft-delete, fork tracking) and messages (versioned, vector-ready)
16
+ - Repository layer: ContextRepository and MessageRepository with token-budgeted windowing
17
+ - REST API: 6 endpoints with Zod validation and RFC 9457 error format
18
+ - 87 tests with 100% coverage enforcement
19
+ - 4,279 lines of TypeScript across 93 files
14
20
 
15
- **Target features:**
16
- - TypeScript project structure for Vercel serverless
17
- - Linting configuration (ESLint, Prettier)
18
- - Testing setup (Vitest or similar)
19
- - Development workflow (scripts, environment)
21
+ **Previous:** v0.1.0 Core Setup (2026-01-29)
22
+ - TypeScript/Vercel project foundation
23
+ - Biome linting, Vitest testing, Husky pre-commit hooks
24
+ - GitHub Actions CI pipeline
25
+ - Vercel serverless health endpoint
20
26
 
21
27
  ## Requirements
22
28
 
23
29
  ### Validated
24
30
 
25
- (None yet ship to validate)
31
+ - TypeScript with strict mode and NodeNext -- v0.1.0
32
+ - pnpm with lockfile -- v0.1.0
33
+ - Build, test, lint, format scripts -- v0.1.0
34
+ - Biome for linting/formatting -- v0.1.0
35
+ - Vitest for testing -- v0.1.0
36
+ - Pre-commit hooks with Husky -- v0.1.0
37
+ - GitHub Actions CI -- v0.1.0
38
+ - Vercel serverless structure -- v0.1.0
39
+ - PostgreSQL with pgvector on Neon -- v0.2.0
40
+ - Drizzle ORM with type-safe schema -- v0.2.0
41
+ - Database migration workflow -- v0.2.0
42
+ - Serverless connection pooling -- v0.2.0
43
+ - Context CRUD operations (create, read, soft delete) -- v0.2.0
44
+ - Message append with batch insert and versioning -- v0.2.0
45
+ - Cursor-based message pagination -- v0.2.0
46
+ - Token-budgeted windowing -- v0.2.0
47
+ - REST API with Zod validation -- v0.2.0
48
+ - 100% test coverage enforcement -- v0.2.0
26
49
 
27
50
  ### Active
28
51
 
29
52
  **Core Engine:**
30
53
  - [ ] Versioned context storage with full history
31
54
  - [ ] Basic compaction policy (configurable aggressiveness)
32
- - [ ] Budget-aware windowing (fit within token limit)
33
55
  - [ ] Context forking for exploration paths
34
56
  - [ ] Time-travel (jump to any version)
35
57
 
36
58
  **API & SDKs:**
37
- - [ ] Framework-agnostic REST API
38
59
  - [ ] Python SDK
39
60
  - [ ] TypeScript SDK
40
61
 
41
- **Storage:**
42
- - [ ] PostgreSQL with pgvector
43
-
44
62
  **Commercial MVP (1.0):**
45
63
  - [ ] Hosted API on Vercel (serverless)
46
64
  - [ ] Stripe integration for SaaS billing
@@ -54,34 +72,37 @@ Given messages and a context budget, determine the optimal window to send to the
54
72
 
55
73
  ### Out of Scope
56
74
 
57
- - **Full agent framework** We're infrastructure (Postgres), not framework (Rails). Use with any agent system.
58
- - **Tool execution/sandboxing** Orthogonal concern. Use whatever tool layer you want.
59
- - **Agent orchestration** Kata Orchestrator handles this. We're the context layer beneath it.
60
- - **Opinionated agent patterns** No opinion on how you build agents.
61
- - **Letta fork/rebrand** Fresh codebase. Study Letta for learnings, don't import code.
75
+ - **Full agent framework** -- Infrastructure (Postgres), not framework (Rails). Use with any agent system.
76
+ - **Tool execution/sandboxing** -- Orthogonal concern. Use whatever tool layer you want.
77
+ - **Agent orchestration** -- Kata Orchestrator handles this. We're the context layer beneath it.
78
+ - **Opinionated agent patterns** -- No opinion on how you build agents.
79
+ - **Letta fork/rebrand** -- Fresh codebase. Study Letta for learnings, don't import code.
62
80
 
63
81
  ## Context
64
82
 
65
83
  **Kata Ecosystem:**
66
- Kata Context is one layer in a vertically integrated stack. Kata Orchestrator is the first customer currently uses markdown files in `.planning/` for state persistence. Works but is brittle (manual edits break workflows, parsing markdown is fragile). Kata Context replaces this with proper context management.
84
+ Kata Context is one layer in a vertically integrated stack. Kata Orchestrator is the first customer -- currently uses markdown files in `.planning/` for state persistence. Works but is brittle (manual edits break workflows, parsing markdown is fragile). Kata Context replaces this with proper context management.
67
85
 
68
86
  **Why vertical integration:**
69
- 1. Real requirements not guessing what developers need. We are the developer.
70
- 2. Proof of concept built-in production multi-agent system running on Kata Context.
71
- 3. Forces good design if the API is awkward for Kata, it'll be awkward for everyone.
87
+ 1. Real requirements -- not guessing what developers need. We are the developer.
88
+ 2. Proof of concept built-in -- production multi-agent system running on Kata Context.
89
+ 3. Forces good design -- if the API is awkward for Kata, it'll be awkward for everyone.
72
90
 
73
91
  **Prior Art:**
74
- - Letta Full agent framework with bundled memory. Learning source for context window calculation, summarization approaches. Not forking context layer is coupled to their agent model.
75
- - mem0, Zep Similar space, but more opinionated. We're lower-level infrastructure.
92
+ - Letta -- Full agent framework with bundled memory. Learning source for context window calculation, summarization approaches. Not forking -- context layer is coupled to their agent model.
93
+ - mem0, Zep -- Similar space, but more opinionated. We're lower-level infrastructure.
76
94
 
77
95
  **Competitive Positioning:**
78
96
  The context layer you'd build yourself, but shouldn't have to. Infrastructure, not framework. Works with everything.
79
97
 
98
+ **Tech Stack (v0.2.0):**
99
+ pnpm 10.x, Node.js 24.x, TypeScript 5.9.x, Biome 2.3.x, Vitest 4.x, Zod 4.x, Drizzle ORM 0.45.1, pg 8.14.1, Neon PostgreSQL with pgvector
100
+
80
101
  ## Constraints
81
102
 
82
103
  - **Tech stack**: Vercel ecosystem (serverless functions, Postgres via Neon with pgvector), TypeScript for server
83
- - **SDKs**: Python and TypeScript required these are what developers actually use
84
- - **First customer**: Kata Orchestrator API must support its workflows
104
+ - **SDKs**: Python and TypeScript required -- these are what developers actually use
105
+ - **First customer**: Kata Orchestrator -- API must support its workflows
85
106
  - **Solo developer**: One person building, so scope must stay tight
86
107
  - **Open source**: Public repo from day one, Apache 2.0 for core and SDKs
87
108
 
@@ -89,15 +110,27 @@ The context layer you'd build yourself, but shouldn't have to. Infrastructure, n
89
110
 
90
111
  | Decision | Rationale | Outcome |
91
112
  | -------- | --------- | ------- |
92
- | Standalone layer, not framework | Larger market, cleaner differentiation, smaller surface area | Pending |
93
- | Fresh codebase, not Letta fork | Avoid rebrand complexity, build what we need | Pending |
94
- | Vercel serverless deployment | Simplicity, TypeScript-native, scales automatically | Pending |
95
- | PostgreSQL with pgvector | Battle-tested, embeddings built-in, Vercel Postgres available | Pending |
96
- | TypeScript for server | Vercel-native, faster iteration than Rust, good enough perf for MVP | Pending |
97
- | Open source from day one | Builds trust, consistency with other Kata projects, no awkward transition | Pending |
98
- | Local beta first, then hosted MVP | Validate with self as customer before commercializing | Pending |
99
- | Open core business model | Open source core for adoption, monetize hosted service | Pending |
100
- | Small milestones (1-3 phases) | Shippable in a day, maintain momentum | Pending |
113
+ | Standalone layer, not framework | Larger market, cleaner differentiation, smaller surface area | Good |
114
+ | Fresh codebase, not Letta fork | Avoid rebrand complexity, build what we need | Good |
115
+ | Vercel serverless deployment | Simplicity, TypeScript-native, scales automatically | Good |
116
+ | PostgreSQL with pgvector | Battle-tested, embeddings built-in, Vercel Postgres available | Good |
117
+ | TypeScript for server | Vercel-native, faster iteration than Rust, good enough perf for MVP | Good |
118
+ | Open source from day one | Builds trust, consistency with other Kata projects, no awkward transition | Good |
119
+ | Local beta first, then hosted MVP | Validate with self as customer before commercializing | Pending |
120
+ | Open core business model | Open source core for adoption, monetize hosted service | Pending |
121
+ | Small milestones (1-3 phases) | Shippable in a day, maintain momentum | Good |
122
+ | ESM with type: module | NodeNext resolution requires ESM; Vercel serverless expects ESM | Good |
123
+ | Exact version pinning | Reproducible builds; avoids surprise breakage | Good |
124
+ | Biome over ESLint/Prettier | Faster, simpler config, all-in-one tool | Good |
125
+ | Web Standard APIs for Vercel | No SDK dependency; portable code; modern standard | Good |
126
+ | Neon over Vercel Postgres | Vercel Postgres deprecated Q4 2024; Neon is the underlying provider | Good |
127
+ | Drizzle over Prisma | Lighter weight, better serverless cold start, closer to SQL | Good |
128
+ | pg driver over @neondatabase/serverless | Node.js serverless runtime, simpler driver model | Good |
129
+ | Repository pattern | Clean data access abstraction, testable with PGlite | Good |
130
+ | Soft delete for contexts | Preserve history, enable future undelete/audit | Good |
131
+ | PGlite for testing | No external database dependency, fast in-memory tests | Good |
132
+ | Zod v4 for validation | Type-safe API validation, zod/v4 import path for compatibility | Good |
133
+ | RFC 9457 error format | Standard problem detail for API error responses | Good |
101
134
 
102
135
  ---
103
- *Last updated: 2025-01-29 after initialization*
136
+ *Last updated: 2026-02-04 after v0.2.0 milestone*
@@ -1,45 +1,54 @@
1
1
  # State
2
2
 
3
+ ## Project Reference
4
+
5
+ See: .planning/PROJECT.md (updated 2026-02-04)
6
+
7
+ **Core value:** Policy-based context window management for AI agents
8
+ **Current focus:** Planning next milestone
9
+
3
10
  ## Current Position
4
11
 
5
- Phase: 1 of 2 (Foundation)
6
- Plan: 2 of 2 in phase
7
- Status: Phase complete
8
- Last activity: 2026-01-29 - Completed 01-02-PLAN.md
12
+ Phase: v0.2.0 complete
13
+ Plan: N/A
14
+ Status: Ready for next milestone
15
+ Last activity: 2026-02-04 -- v0.2.0 milestone complete
9
16
 
10
17
  ## Progress
11
18
 
12
19
  ```
13
- v0.1.0 Core Setup
14
- [#####-----] Phase 1: Foundation (2/2 plans complete)
15
- [----------] Phase 2: Automation and Deployment (0/? plans)
20
+ v0.1.0 Core Setup - SHIPPED
21
+ [##########] Phase 1: Foundation (2/2 plans complete)
22
+ [##########] Phase 2: Automation and Deployment (2/2 plans complete)
23
+
24
+ v0.2.0 Database + Storage Layer - SHIPPED
25
+ [##########] Phase 3: Database Foundation (2/2 plans) - COMPLETE
26
+ [##########] Phase 4: Repository Layer (2/2 plans) - COMPLETE
27
+ [##########] Phase 5: API + Testing Layer (4/4 plans) - COMPLETE
16
28
  ```
17
29
 
18
30
  ## Accumulated Context
19
31
 
20
32
  ### Decisions Made
21
33
 
22
- | ID | Decision | Rationale | Phase |
23
- |----|----------|-----------|-------|
24
- | esm-module-type | type: module in package.json | NodeNext module resolution requires ESM; Vercel serverless expects ESM | 01-01 |
25
- | exact-versions | --save-exact for all dependencies | Reproducible builds; avoids surprise breakage from minor updates | 01-01 |
26
- | license | Apache-2.0 | Matches PROJECT.md open source constraint | 01-01 |
27
- | biome-2-organize-imports | Use assist.actions.source.organizeImports | Biome 2.x moved organize imports to assist section; old schema key invalid | 01-02 |
28
- | biome-ignore-claude | Exclude .claude directory with includes pattern | Claude Code hooks directory contains external JS files that fail lint | 01-02 |
29
- | vitest-pass-no-tests | Enable passWithNoTests option | Clean CI builds when no test files exist yet | 01-02 |
34
+ See PROJECT.md Key Decisions table for cumulative record.
30
35
 
31
36
  ### Blockers
37
+
32
38
  (None)
33
39
 
40
+ ### TODOs
41
+
42
+ (None -- milestone complete)
43
+
34
44
  ### Notes
35
- - First milestone - establishing project foundation
36
- - Kata Orchestrator is the first customer
37
- - Stack: pnpm 10.x, Node.js 24.x, TypeScript 5.9.x, Biome 2.3.x, Vitest 4.x
38
- - Engine warning on Node 23.6 is expected (project targets Node 24+)
39
- - Phase 1 Foundation complete: all developer workflow commands functional
45
+
46
+ - v0.1.0 shipped with full developer workflow and CI infrastructure
47
+ - v0.2.0 shipped with storage foundation, repository layer, and REST API
48
+ - Stack: pnpm 10.x, Node.js 24.x, TypeScript 5.9.x, Biome 2.3.x, Vitest 4.x, Zod 4.x, Drizzle ORM 0.45.1, pg 8.14.1
40
49
 
41
50
  ## Session Continuity
42
51
 
43
- Last session: 2026-01-29 11:15 UTC
44
- Stopped at: Completed 01-02-PLAN.md (Phase 1 complete)
45
- Resume file: .planning/phases/02-automation/02-01-PLAN.md
52
+ Last session: 2026-02-04
53
+ Stopped at: v0.2.0 milestone complete
54
+ Resume with: `/kata:kata-add-milestone` for v0.3.0