@kraftapps-ai/kai 1.4.0 → 1.5.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.
- package/kai +37 -21
- package/package.json +1 -1
package/kai
CHANGED
|
@@ -23,14 +23,26 @@ if [ "${1:-}" = "--new" ]; then
|
|
|
23
23
|
shift
|
|
24
24
|
fi
|
|
25
25
|
|
|
26
|
-
PRD_FILE="kai.json"
|
|
27
|
-
PROGRESS_FILE="kai
|
|
26
|
+
PRD_FILE=".kai/stories.json"
|
|
27
|
+
PROGRESS_FILE=".kai/progress.txt"
|
|
28
28
|
PROMPT_FILE=".kai/PROMPT.md"
|
|
29
29
|
MEMORY_FILE=".kai/memory.md"
|
|
30
30
|
LOOP_SCRIPT=".kai/loop.sh"
|
|
31
31
|
|
|
32
32
|
# ── Auto-init if needed ───────────────────────────────
|
|
33
33
|
|
|
34
|
+
# Migrate old file locations (pre-1.5.0)
|
|
35
|
+
if [ -f "kai.json" ] && [ ! -f "$PRD_FILE" ]; then
|
|
36
|
+
mkdir -p .kai
|
|
37
|
+
mv kai.json "$PRD_FILE"
|
|
38
|
+
echo " Migrated kai.json → $PRD_FILE"
|
|
39
|
+
fi
|
|
40
|
+
if [ -f "kai-progress.txt" ] && [ ! -f "$PROGRESS_FILE" ]; then
|
|
41
|
+
mkdir -p .kai
|
|
42
|
+
mv kai-progress.txt "$PROGRESS_FILE"
|
|
43
|
+
echo " Migrated kai-progress.txt → $PROGRESS_FILE"
|
|
44
|
+
fi
|
|
45
|
+
|
|
34
46
|
if [ ! -f "$PRD_FILE" ]; then
|
|
35
47
|
mkdir -p .kai
|
|
36
48
|
|
|
@@ -176,8 +188,8 @@ cat > "$LOOP_SCRIPT" << 'LOOPEOF'
|
|
|
176
188
|
# Kai implementation loop — called by the PM when stories are ready
|
|
177
189
|
set -e
|
|
178
190
|
|
|
179
|
-
PRD_FILE="kai.json"
|
|
180
|
-
PROGRESS_FILE="kai
|
|
191
|
+
PRD_FILE=".kai/stories.json"
|
|
192
|
+
PROGRESS_FILE=".kai/progress.txt"
|
|
181
193
|
PROMPT_FILE=".kai/PROMPT.md"
|
|
182
194
|
|
|
183
195
|
WORKER_PROMPT='You are an autonomous AI developer specializing in Shopify app and theme development.
|
|
@@ -203,21 +215,21 @@ You are an expert Shopify developer. You have access to the Shopify Dev MCP tool
|
|
|
203
215
|
6. NEVER guess at API fields, mutation inputs, or Liquid filters — always introspect or search first
|
|
204
216
|
|
|
205
217
|
## Your inputs
|
|
206
|
-
-
|
|
207
|
-
-
|
|
218
|
+
- `@.kai/stories.json` — user stories with `passes: true/false`.
|
|
219
|
+
- `@.kai/progress.txt` — log of what has been done.
|
|
208
220
|
|
|
209
221
|
## Your task (ONE story per loop)
|
|
210
222
|
|
|
211
|
-
1. Read kai.json, find the highest-priority story where `passes: false`.
|
|
212
|
-
2. Read kai
|
|
223
|
+
1. Read .kai/stories.json, find the highest-priority story where `passes: false`.
|
|
224
|
+
2. Read .kai/progress.txt for context on previous work.
|
|
213
225
|
3. **PLAN before coding.** List files and changes before touching code.
|
|
214
226
|
4. If the story involves Shopify APIs, call `learn_shopify_api` then use `introspect_graphql_schema` and `search_docs_chunks` to understand the right approach.
|
|
215
227
|
5. Implement ONLY that one story.
|
|
216
228
|
6. Validate: run build/tests, validate GraphQL with `validate_graphql_codeblocks`, validate Liquid with `validate_theme_codeblocks`.
|
|
217
229
|
7. **SELF-REVIEW.** For each acceptance criterion, cite evidence (file, line, command output). No "should work" or "probably".
|
|
218
230
|
8. Commit with a descriptive message.
|
|
219
|
-
9. Update kai.json: set `passes` to `true`.
|
|
220
|
-
10. Append to kai
|
|
231
|
+
9. Update .kai/stories.json: set `passes` to `true`.
|
|
232
|
+
10. Append to .kai/progress.txt.
|
|
221
233
|
|
|
222
234
|
## Rules
|
|
223
235
|
- ONE STORY PER LOOP.
|
|
@@ -347,16 +359,20 @@ $(cat "$PROMPT_FILE")"
|
|
|
347
359
|
progress=""
|
|
348
360
|
[ -f "$PROGRESS_FILE" ] && [ "$(wc -l < "$PROGRESS_FILE")" -gt 2 ] && progress="
|
|
349
361
|
|
|
350
|
-
Recent progress (kai
|
|
362
|
+
Recent progress (.kai/progress.txt):
|
|
351
363
|
$(tail -30 "$PROGRESS_FILE")"
|
|
352
364
|
|
|
353
365
|
memory=""
|
|
354
366
|
[ -f "$MEMORY_FILE" ] && memory="
|
|
355
367
|
|
|
356
368
|
## Kai Memory (from previous sessions)
|
|
357
|
-
Read \`.kai/memory.md\` for full details. Summary:
|
|
358
369
|
$(cat "$MEMORY_FILE")"
|
|
359
370
|
|
|
371
|
+
dev_name=$(git config user.name 2>/dev/null || echo "")
|
|
372
|
+
dev_greeting=""
|
|
373
|
+
[ -n "$dev_name" ] && dev_greeting="
|
|
374
|
+
The developer's name is: ${dev_name}"
|
|
375
|
+
|
|
360
376
|
# ── Build Claude args ─────────────────────────────────
|
|
361
377
|
|
|
362
378
|
CLAUDE_ARGS="--dangerously-skip-permissions"
|
|
@@ -373,9 +389,9 @@ exec claude $CLAUDE_ARGS --system-prompt "You are Kai — an AI product manager,
|
|
|
373
389
|
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.
|
|
374
390
|
|
|
375
391
|
### Reading memory
|
|
376
|
-
-
|
|
377
|
-
- Use
|
|
378
|
-
- If memory
|
|
392
|
+
- **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.
|
|
393
|
+
- Use the loaded memory to greet the developer with instant awareness of where you left off
|
|
394
|
+
- If memory has content, reference it naturally: \"Hey {name} — picking up where we left off on X\"
|
|
379
395
|
|
|
380
396
|
### Writing memory
|
|
381
397
|
You MUST update \`.kai/memory.md\` in these situations:
|
|
@@ -437,17 +453,17 @@ If the developer's store domain is in \`.kai/PROMPT.md\`, you can point them to
|
|
|
437
453
|
## What you can do
|
|
438
454
|
|
|
439
455
|
1. **Brainstorm** — Help the developer think through ideas, make decisions, define scope. Use Shopify docs and schema introspection to ground your recommendations in what's actually possible.
|
|
440
|
-
2. **Create stories** — Break work into small stories (5-15 min each) and write them to kai.json. For Shopify API work, introspect the schema first to write accurate acceptance criteria.
|
|
456
|
+
2. **Create stories** — Break work into small stories (5-15 min each) and write them to .kai/stories.json. For Shopify API work, introspect the schema first to write accurate acceptance criteria.
|
|
441
457
|
3. **Run the dev loop** — Execute \`.kai/loop.sh\` to have an AI developer implement all stories autonomously
|
|
442
|
-
4. **Check progress** — Read kai.json and kai
|
|
458
|
+
4. **Check progress** — Read .kai/stories.json and .kai/progress.txt to report status
|
|
443
459
|
5. **Adjust the plan** — Edit stories, reprioritize, add new ones, reset failed ones
|
|
444
460
|
6. **Test in browser** — Use Playwright to navigate the Shopify Admin, test the embedded app, verify UI
|
|
445
461
|
7. **Research APIs** — Introspect GraphQL schemas and search docs to answer technical questions on the spot
|
|
446
462
|
|
|
447
463
|
## How stories work
|
|
448
464
|
|
|
449
|
-
Stories live in kai.json. Each has: id, title, description, acceptanceCriteria, priority, passes (true/false).
|
|
450
|
-
To add stories, edit kai.json directly using the Edit or Write tool.
|
|
465
|
+
Stories live in .kai/stories.json. Each has: id, title, description, acceptanceCriteria, priority, passes (true/false).
|
|
466
|
+
To add stories, edit .kai/stories.json directly using the Edit or Write tool.
|
|
451
467
|
To run implementation, execute: \`nohup .kai/loop.sh > .kai/loop.log 2>&1 &\` then monitor with \`tail -f .kai/loop.log\`
|
|
452
468
|
|
|
453
469
|
## Browser testing (Playwright)
|
|
@@ -504,5 +520,5 @@ Shopify apps are **embedded inside Shopify Admin**. Pages are NOT directly acces
|
|
|
504
520
|
- When the developer says \"ship it\" or \"go\" or \"do it\", start the loop
|
|
505
521
|
- Don't ask unnecessary questions — use good defaults
|
|
506
522
|
- When unsure about an API, introspect the schema instead of guessing
|
|
507
|
-
- On startup: read
|
|
508
|
-
${status}${project_context}${progress}${memory}" "${@:-Hey Kai}"
|
|
523
|
+
- **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.
|
|
524
|
+
${status}${project_context}${progress}${memory}${dev_greeting}" "${@:-Hey Kai}"
|