@kraftapps-ai/kai 1.3.4 → 1.4.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/CLAUDE.md +12 -2
- package/kai +79 -3
- package/package.json +1 -1
package/CLAUDE.md
CHANGED
|
@@ -7,16 +7,26 @@ Autonomous AI Shopify expert, product manager, and developer loop for Claude Cod
|
|
|
7
7
|
- `kai` — the entire tool; a single bash script that bootstraps the PM agent and dev loop
|
|
8
8
|
- `package.json` — npm metadata and version
|
|
9
9
|
- `.kai/PROMPT.md` — per-project context (generated at runtime, not in repo)
|
|
10
|
+
- `.kai/memory.md` — persistent memory across sessions (generated at runtime, not in repo)
|
|
10
11
|
- `.kai/loop.sh` — dev loop script (generated at runtime, not in repo)
|
|
11
12
|
|
|
12
13
|
## How it works
|
|
13
14
|
|
|
14
|
-
1. `kai` script auto-inits project files (`kai.json`, `kai-progress.txt`, `.kai/PROMPT.md`)
|
|
15
|
+
1. `kai` script auto-inits project files (`kai.json`, `kai-progress.txt`, `.kai/PROMPT.md`, `.kai/memory.md`)
|
|
15
16
|
2. Auto-installs MCP servers if not already configured:
|
|
16
17
|
- **Playwright** — browser testing inside Shopify Admin
|
|
17
18
|
- **@shopify/dev-mcp** — Shopify docs, GraphQL schema introspection, Liquid/GraphQL/component validation
|
|
18
19
|
3. Generates `.kai/loop.sh` (the autonomous dev loop)
|
|
19
|
-
4. Launches Claude
|
|
20
|
+
4. Launches Claude with `--continue` to resume the last conversation (per-repo)
|
|
21
|
+
5. Falls back to `.kai/memory.md` for context if conversation history is unavailable
|
|
22
|
+
|
|
23
|
+
## Session persistence
|
|
24
|
+
|
|
25
|
+
Kai uses a two-layer persistence strategy:
|
|
26
|
+
- **`claude --continue`** — resumes the exact last conversation in this directory (primary)
|
|
27
|
+
- **`.kai/memory.md`** — Kai-maintained memory file with key decisions, current focus, and session log (fallback)
|
|
28
|
+
|
|
29
|
+
Use `kai --new` to force a fresh conversation (memory.md is still loaded for context).
|
|
20
30
|
|
|
21
31
|
The PM creates user stories in `kai.json`, then kicks off `.kai/loop.sh` which runs Claude in a loop — one story per iteration with self-review. Both the PM and the dev loop worker use Shopify Dev MCP tools to introspect APIs, search docs, and validate code.
|
|
22
32
|
|
package/kai
CHANGED
|
@@ -15,9 +15,18 @@ if [ "${1:-}" = "--version" ] || [ "${1:-}" = "-v" ]; then
|
|
|
15
15
|
exit 0
|
|
16
16
|
fi
|
|
17
17
|
|
|
18
|
+
# ── Handle --new flag ─────────────────────────────────
|
|
19
|
+
|
|
20
|
+
USE_CONTINUE=true
|
|
21
|
+
if [ "${1:-}" = "--new" ]; then
|
|
22
|
+
USE_CONTINUE=false
|
|
23
|
+
shift
|
|
24
|
+
fi
|
|
25
|
+
|
|
18
26
|
PRD_FILE="kai.json"
|
|
19
27
|
PROGRESS_FILE="kai-progress.txt"
|
|
20
28
|
PROMPT_FILE=".kai/PROMPT.md"
|
|
29
|
+
MEMORY_FILE=".kai/memory.md"
|
|
21
30
|
LOOP_SCRIPT=".kai/loop.sh"
|
|
22
31
|
|
|
23
32
|
# ── Auto-init if needed ───────────────────────────────
|
|
@@ -65,6 +74,29 @@ Add your project-specific context here. The more you provide, the better Kai per
|
|
|
65
74
|
EOF
|
|
66
75
|
fi
|
|
67
76
|
|
|
77
|
+
# Init memory file if it doesn't exist
|
|
78
|
+
if [ ! -f "$MEMORY_FILE" ]; then
|
|
79
|
+
mkdir -p .kai
|
|
80
|
+
cat > "$MEMORY_FILE" << 'EOF'
|
|
81
|
+
# Kai Memory
|
|
82
|
+
|
|
83
|
+
This file is automatically maintained by Kai to preserve context between sessions.
|
|
84
|
+
Do not edit manually unless you want to correct or add context for Kai.
|
|
85
|
+
|
|
86
|
+
## Current Focus
|
|
87
|
+
<!-- What we're currently working on -->
|
|
88
|
+
|
|
89
|
+
## Key Decisions
|
|
90
|
+
<!-- Important decisions made during our conversations -->
|
|
91
|
+
|
|
92
|
+
## Open Questions / Blockers
|
|
93
|
+
<!-- Things that need to be resolved -->
|
|
94
|
+
|
|
95
|
+
## Session Log
|
|
96
|
+
<!-- Brief log of what happened in each session -->
|
|
97
|
+
EOF
|
|
98
|
+
fi
|
|
99
|
+
|
|
68
100
|
# ── Ensure MCP servers are available ─────────────────
|
|
69
101
|
|
|
70
102
|
# Track what's already configured
|
|
@@ -318,9 +350,53 @@ progress=""
|
|
|
318
350
|
Recent progress (kai-progress.txt):
|
|
319
351
|
$(tail -30 "$PROGRESS_FILE")"
|
|
320
352
|
|
|
353
|
+
memory=""
|
|
354
|
+
[ -f "$MEMORY_FILE" ] && memory="
|
|
355
|
+
|
|
356
|
+
## Kai Memory (from previous sessions)
|
|
357
|
+
$(cat "$MEMORY_FILE")"
|
|
358
|
+
|
|
359
|
+
dev_name=$(git config user.name 2>/dev/null || echo "")
|
|
360
|
+
dev_greeting=""
|
|
361
|
+
[ -n "$dev_name" ] && dev_greeting="
|
|
362
|
+
The developer's name is: ${dev_name}"
|
|
363
|
+
|
|
364
|
+
# ── Build Claude args ─────────────────────────────────
|
|
365
|
+
|
|
366
|
+
CLAUDE_ARGS="--dangerously-skip-permissions"
|
|
367
|
+
if [ "$USE_CONTINUE" = true ]; then
|
|
368
|
+
CLAUDE_ARGS="$CLAUDE_ARGS --continue"
|
|
369
|
+
fi
|
|
370
|
+
|
|
321
371
|
# ── Launch the PM ─────────────────────────────────────
|
|
322
372
|
|
|
323
|
-
exec claude
|
|
373
|
+
exec claude $CLAUDE_ARGS --system-prompt "You are Kai — an AI product manager, tech lead, and **Shopify expert**. You work directly with the developer to plan and ship Shopify apps, themes, and integrations.
|
|
374
|
+
|
|
375
|
+
## Session persistence
|
|
376
|
+
|
|
377
|
+
You maintain a memory file at \`.kai/memory.md\` that preserves context between sessions. This is critical — it's how you remember what happened in previous conversations.
|
|
378
|
+
|
|
379
|
+
### Reading memory
|
|
380
|
+
- **All context is already loaded in this system prompt** — story status, project context, progress log, and memory are all below. Do NOT read files on startup.
|
|
381
|
+
- Use the loaded memory to greet the developer with instant awareness of where you left off
|
|
382
|
+
- If memory has content, reference it naturally: \"Hey {name} — picking up where we left off on X\"
|
|
383
|
+
|
|
384
|
+
### Writing memory
|
|
385
|
+
You MUST update \`.kai/memory.md\` in these situations:
|
|
386
|
+
- **After creating or modifying stories** — record what was planned and why
|
|
387
|
+
- **After the dev loop completes** — record what was built and any issues
|
|
388
|
+
- **When the developer makes a key decision** — record the decision and reasoning
|
|
389
|
+
- **When there are open questions or blockers** — record them so you remember next time
|
|
390
|
+
- **Before the developer leaves** — if they say \"bye\", \"done for today\", \"gotta go\", etc., immediately update memory with a session summary
|
|
391
|
+
|
|
392
|
+
### Memory format
|
|
393
|
+
Keep \`.kai/memory.md\` organized with these sections:
|
|
394
|
+
- **Current Focus** — what we're actively working on
|
|
395
|
+
- **Key Decisions** — important choices and their reasoning
|
|
396
|
+
- **Open Questions / Blockers** — unresolved issues
|
|
397
|
+
- **Session Log** — brief dated entries of what happened (newest first, keep last 10)
|
|
398
|
+
|
|
399
|
+
Keep entries concise. Memory is context, not a novel.
|
|
324
400
|
|
|
325
401
|
## Your Shopify expertise
|
|
326
402
|
|
|
@@ -432,5 +508,5 @@ Shopify apps are **embedded inside Shopify Admin**. Pages are NOT directly acces
|
|
|
432
508
|
- When the developer says \"ship it\" or \"go\" or \"do it\", start the loop
|
|
433
509
|
- Don't ask unnecessary questions — use good defaults
|
|
434
510
|
- When unsure about an API, introspect the schema instead of guessing
|
|
435
|
-
- On startup
|
|
436
|
-
${status}${project_context}${progress}" "${@:-Hey Kai}"
|
|
511
|
+
- **On startup: DO NOT read any files. All context is already loaded below.** Greet the developer by name immediately. If memory has context from previous sessions, acknowledge where you left off in 1-2 lines. If fresh, ask what they want to build. Keep greeting to 2-3 lines max. Be instant — no tool calls before your first response.
|
|
512
|
+
${status}${project_context}${progress}${memory}${dev_greeting}" "${@:-Hey Kai}"
|