@anthropologies/claudestory 0.1.41 → 0.1.43
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/dist/cli.js +122 -72
- package/dist/index.d.ts +42 -42
- package/dist/mcp.js +69 -30
- package/package.json +1 -1
- package/src/skill/SKILL.md +40 -226
- package/src/skill/autonomous-mode.md +65 -0
- package/src/skill/setup-flow.md +581 -0
package/dist/mcp.js
CHANGED
|
@@ -4096,7 +4096,7 @@ var init_session = __esm({
|
|
|
4096
4096
|
// src/mcp/index.ts
|
|
4097
4097
|
init_esm_shims();
|
|
4098
4098
|
import { realpathSync as realpathSync2, existsSync as existsSync11 } from "fs";
|
|
4099
|
-
import { resolve as resolve8, join as
|
|
4099
|
+
import { resolve as resolve8, join as join19, isAbsolute } from "path";
|
|
4100
4100
|
import { z as z11 } from "zod";
|
|
4101
4101
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
4102
4102
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
@@ -4149,7 +4149,7 @@ init_errors();
|
|
|
4149
4149
|
init_helpers();
|
|
4150
4150
|
init_types();
|
|
4151
4151
|
import { z as z10 } from "zod";
|
|
4152
|
-
import { join as
|
|
4152
|
+
import { join as join17 } from "path";
|
|
4153
4153
|
|
|
4154
4154
|
// src/cli/commands/status.ts
|
|
4155
4155
|
init_esm_shims();
|
|
@@ -5443,8 +5443,8 @@ init_handover();
|
|
|
5443
5443
|
init_esm_shims();
|
|
5444
5444
|
init_session_types();
|
|
5445
5445
|
init_session();
|
|
5446
|
-
import { readFileSync as
|
|
5447
|
-
import { join as
|
|
5446
|
+
import { readFileSync as readFileSync7, writeFileSync as writeFileSync3, readdirSync as readdirSync4 } from "fs";
|
|
5447
|
+
import { join as join14 } from "path";
|
|
5448
5448
|
|
|
5449
5449
|
// src/autonomous/state-machine.ts
|
|
5450
5450
|
init_esm_shims();
|
|
@@ -7783,6 +7783,43 @@ init_project_loader();
|
|
|
7783
7783
|
init_snapshot();
|
|
7784
7784
|
init_snapshot();
|
|
7785
7785
|
init_queries();
|
|
7786
|
+
|
|
7787
|
+
// src/autonomous/version-check.ts
|
|
7788
|
+
init_esm_shims();
|
|
7789
|
+
import { readFileSync as readFileSync6 } from "fs";
|
|
7790
|
+
import { join as join13, dirname as dirname4 } from "path";
|
|
7791
|
+
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
7792
|
+
function checkVersionMismatch(runningVersion, installedVersion) {
|
|
7793
|
+
if (!installedVersion) return null;
|
|
7794
|
+
if (runningVersion === "0.0.0-dev") return null;
|
|
7795
|
+
if (runningVersion === installedVersion) return null;
|
|
7796
|
+
return `claudestory MCP server is running v${runningVersion} but v${installedVersion} is installed. Restart Claude Code to load the updated version.`;
|
|
7797
|
+
}
|
|
7798
|
+
function getInstalledVersion() {
|
|
7799
|
+
try {
|
|
7800
|
+
const thisFile = fileURLToPath3(import.meta.url);
|
|
7801
|
+
const candidates = [
|
|
7802
|
+
join13(dirname4(thisFile), "..", "..", "package.json"),
|
|
7803
|
+
join13(dirname4(thisFile), "..", "package.json")
|
|
7804
|
+
];
|
|
7805
|
+
for (const candidate of candidates) {
|
|
7806
|
+
try {
|
|
7807
|
+
const raw = readFileSync6(candidate, "utf-8");
|
|
7808
|
+
const pkg = JSON.parse(raw);
|
|
7809
|
+
if (pkg.version) return pkg.version;
|
|
7810
|
+
} catch {
|
|
7811
|
+
}
|
|
7812
|
+
}
|
|
7813
|
+
return null;
|
|
7814
|
+
} catch {
|
|
7815
|
+
return null;
|
|
7816
|
+
}
|
|
7817
|
+
}
|
|
7818
|
+
function getRunningVersion() {
|
|
7819
|
+
return "0.1.43";
|
|
7820
|
+
}
|
|
7821
|
+
|
|
7822
|
+
// src/autonomous/guide.ts
|
|
7786
7823
|
init_handover();
|
|
7787
7824
|
var RECOVERY_MAPPING = {
|
|
7788
7825
|
PICK_TICKET: { state: "PICK_TICKET", resetPlan: false, resetCode: false },
|
|
@@ -7804,18 +7841,18 @@ var RECOVERY_MAPPING = {
|
|
|
7804
7841
|
function buildGuideRecommendOptions(root) {
|
|
7805
7842
|
const opts = {};
|
|
7806
7843
|
try {
|
|
7807
|
-
const handoversDir =
|
|
7844
|
+
const handoversDir = join14(root, ".story", "handovers");
|
|
7808
7845
|
const files = readdirSync4(handoversDir, "utf-8").filter((f) => f.endsWith(".md")).sort();
|
|
7809
7846
|
if (files.length > 0) {
|
|
7810
|
-
opts.latestHandoverContent =
|
|
7847
|
+
opts.latestHandoverContent = readFileSync7(join14(handoversDir, files[files.length - 1]), "utf-8");
|
|
7811
7848
|
}
|
|
7812
7849
|
} catch {
|
|
7813
7850
|
}
|
|
7814
7851
|
try {
|
|
7815
|
-
const snapshotsDir =
|
|
7852
|
+
const snapshotsDir = join14(root, ".story", "snapshots");
|
|
7816
7853
|
const snapFiles = readdirSync4(snapshotsDir, "utf-8").filter((f) => f.endsWith(".json")).sort();
|
|
7817
7854
|
if (snapFiles.length > 0) {
|
|
7818
|
-
const raw =
|
|
7855
|
+
const raw = readFileSync7(join14(snapshotsDir, snapFiles[snapFiles.length - 1]), "utf-8");
|
|
7819
7856
|
const snap = JSON.parse(raw);
|
|
7820
7857
|
if (snap.issues) {
|
|
7821
7858
|
opts.previousOpenIssueCount = snap.issues.filter((i) => i.status !== "resolved").length;
|
|
@@ -8008,6 +8045,7 @@ async function handleStart(root, args) {
|
|
|
8008
8045
|
for (const stale of staleSessions) {
|
|
8009
8046
|
writeSessionSync(stale.dir, { ...stale.state, status: "superseded" });
|
|
8010
8047
|
}
|
|
8048
|
+
const versionWarning = checkVersionMismatch(getRunningVersion(), getInstalledVersion());
|
|
8011
8049
|
const wsId = deriveWorkspaceId(root);
|
|
8012
8050
|
const mode = args.mode ?? "auto";
|
|
8013
8051
|
if (mode !== "auto" && !args.ticketId) {
|
|
@@ -8202,7 +8240,7 @@ Staged: ${stagedResult.data.join(", ")}`
|
|
|
8202
8240
|
}
|
|
8203
8241
|
}
|
|
8204
8242
|
const { state: projectState, warnings } = await loadProject(root);
|
|
8205
|
-
const handoversDir =
|
|
8243
|
+
const handoversDir = join14(root, ".story", "handovers");
|
|
8206
8244
|
const ctx = { state: projectState, warnings, root, handoversDir, format: "md" };
|
|
8207
8245
|
let handoverText = "";
|
|
8208
8246
|
try {
|
|
@@ -8219,7 +8257,7 @@ Staged: ${stagedResult.data.join(", ")}`
|
|
|
8219
8257
|
}
|
|
8220
8258
|
} catch {
|
|
8221
8259
|
}
|
|
8222
|
-
const rulesText = readFileSafe2(
|
|
8260
|
+
const rulesText = readFileSafe2(join14(root, "RULES.md"));
|
|
8223
8261
|
const lessonDigest = buildLessonDigest(projectState.lessons);
|
|
8224
8262
|
const digestParts = [
|
|
8225
8263
|
handoverText ? `## Recent Handovers
|
|
@@ -8235,7 +8273,7 @@ ${rulesText}` : "",
|
|
|
8235
8273
|
].filter(Boolean);
|
|
8236
8274
|
const digest = digestParts.join("\n\n---\n\n");
|
|
8237
8275
|
try {
|
|
8238
|
-
writeFileSync3(
|
|
8276
|
+
writeFileSync3(join14(dir, "context-digest.md"), digest, "utf-8");
|
|
8239
8277
|
} catch {
|
|
8240
8278
|
}
|
|
8241
8279
|
if (mode !== "auto" && args.ticketId) {
|
|
@@ -8427,7 +8465,8 @@ ${ticket.description}` : "",
|
|
|
8427
8465
|
"Do NOT use Claude Code's plan mode \u2014 write plans as markdown files.",
|
|
8428
8466
|
"Do NOT ask the user for confirmation or approval.",
|
|
8429
8467
|
"Do NOT stop or summarize between tickets \u2014 call autonomous_guide IMMEDIATELY.",
|
|
8430
|
-
"You are in autonomous mode \u2014 continue working until done."
|
|
8468
|
+
"You are in autonomous mode \u2014 continue working until done.",
|
|
8469
|
+
...versionWarning ? [`**Warning:** ${versionWarning}`] : []
|
|
8431
8470
|
],
|
|
8432
8471
|
transitionedFrom: "INIT"
|
|
8433
8472
|
});
|
|
@@ -8954,7 +8993,7 @@ function guideError(err) {
|
|
|
8954
8993
|
}
|
|
8955
8994
|
function readFileSafe2(path2) {
|
|
8956
8995
|
try {
|
|
8957
|
-
return
|
|
8996
|
+
return readFileSync7(path2, "utf-8");
|
|
8958
8997
|
} catch {
|
|
8959
8998
|
return "";
|
|
8960
8999
|
}
|
|
@@ -8964,8 +9003,8 @@ function readFileSafe2(path2) {
|
|
|
8964
9003
|
init_esm_shims();
|
|
8965
9004
|
init_session();
|
|
8966
9005
|
init_session_types();
|
|
8967
|
-
import { readFileSync as
|
|
8968
|
-
import { join as
|
|
9006
|
+
import { readFileSync as readFileSync8, existsSync as existsSync10 } from "fs";
|
|
9007
|
+
import { join as join15 } from "path";
|
|
8969
9008
|
|
|
8970
9009
|
// src/core/session-report-formatter.ts
|
|
8971
9010
|
init_esm_shims();
|
|
@@ -9179,7 +9218,7 @@ async function handleSessionReport(sessionId, root, format = "md") {
|
|
|
9179
9218
|
isError: true
|
|
9180
9219
|
};
|
|
9181
9220
|
}
|
|
9182
|
-
const statePath2 =
|
|
9221
|
+
const statePath2 = join15(dir, "state.json");
|
|
9183
9222
|
if (!existsSync10(statePath2)) {
|
|
9184
9223
|
return {
|
|
9185
9224
|
output: `Error: Session ${sessionId} corrupt \u2014 state.json missing.`,
|
|
@@ -9189,7 +9228,7 @@ async function handleSessionReport(sessionId, root, format = "md") {
|
|
|
9189
9228
|
};
|
|
9190
9229
|
}
|
|
9191
9230
|
try {
|
|
9192
|
-
const rawJson = JSON.parse(
|
|
9231
|
+
const rawJson = JSON.parse(readFileSync8(statePath2, "utf-8"));
|
|
9193
9232
|
if (rawJson && typeof rawJson === "object" && "schemaVersion" in rawJson && rawJson.schemaVersion !== CURRENT_SESSION_SCHEMA_VERSION) {
|
|
9194
9233
|
return {
|
|
9195
9234
|
output: `Error: Session ${sessionId} \u2014 unsupported session schema version ${rawJson.schemaVersion}.`,
|
|
@@ -9218,7 +9257,7 @@ async function handleSessionReport(sessionId, root, format = "md") {
|
|
|
9218
9257
|
const events = readEvents(dir);
|
|
9219
9258
|
let planContent = null;
|
|
9220
9259
|
try {
|
|
9221
|
-
planContent =
|
|
9260
|
+
planContent = readFileSync8(join15(dir, "plan.md"), "utf-8");
|
|
9222
9261
|
} catch {
|
|
9223
9262
|
}
|
|
9224
9263
|
let gitLog = null;
|
|
@@ -9243,7 +9282,7 @@ init_issue();
|
|
|
9243
9282
|
init_roadmap();
|
|
9244
9283
|
init_output_formatter();
|
|
9245
9284
|
init_helpers();
|
|
9246
|
-
import { join as
|
|
9285
|
+
import { join as join16, resolve as resolve6 } from "path";
|
|
9247
9286
|
var PHASE_ID_REGEX = /^[a-z0-9]+(-[a-z0-9]+)*$/;
|
|
9248
9287
|
var PHASE_ID_MAX_LENGTH = 40;
|
|
9249
9288
|
function validatePhaseId(id) {
|
|
@@ -9352,7 +9391,7 @@ function formatMcpError(code, message) {
|
|
|
9352
9391
|
async function runMcpReadTool(pinnedRoot, handler) {
|
|
9353
9392
|
try {
|
|
9354
9393
|
const { state, warnings } = await loadProject(pinnedRoot);
|
|
9355
|
-
const handoversDir =
|
|
9394
|
+
const handoversDir = join17(pinnedRoot, ".story", "handovers");
|
|
9356
9395
|
const ctx = { state, warnings, root: pinnedRoot, handoversDir, format: "md" };
|
|
9357
9396
|
const result = await handler(ctx);
|
|
9358
9397
|
if (result.errorCode && INFRASTRUCTURE_ERROR_CODES.includes(result.errorCode)) {
|
|
@@ -9910,10 +9949,10 @@ init_esm_shims();
|
|
|
9910
9949
|
init_project_loader();
|
|
9911
9950
|
init_errors();
|
|
9912
9951
|
import { mkdir as mkdir4, stat as stat2, readFile as readFile4, writeFile as writeFile2 } from "fs/promises";
|
|
9913
|
-
import { join as
|
|
9952
|
+
import { join as join18, resolve as resolve7 } from "path";
|
|
9914
9953
|
async function initProject(root, options) {
|
|
9915
9954
|
const absRoot = resolve7(root);
|
|
9916
|
-
const wrapDir =
|
|
9955
|
+
const wrapDir = join18(absRoot, ".story");
|
|
9917
9956
|
let exists = false;
|
|
9918
9957
|
try {
|
|
9919
9958
|
const s = await stat2(wrapDir);
|
|
@@ -9933,11 +9972,11 @@ async function initProject(root, options) {
|
|
|
9933
9972
|
".story/ already exists. Use --force to overwrite config and roadmap."
|
|
9934
9973
|
);
|
|
9935
9974
|
}
|
|
9936
|
-
await mkdir4(
|
|
9937
|
-
await mkdir4(
|
|
9938
|
-
await mkdir4(
|
|
9939
|
-
await mkdir4(
|
|
9940
|
-
await mkdir4(
|
|
9975
|
+
await mkdir4(join18(wrapDir, "tickets"), { recursive: true });
|
|
9976
|
+
await mkdir4(join18(wrapDir, "issues"), { recursive: true });
|
|
9977
|
+
await mkdir4(join18(wrapDir, "handovers"), { recursive: true });
|
|
9978
|
+
await mkdir4(join18(wrapDir, "notes"), { recursive: true });
|
|
9979
|
+
await mkdir4(join18(wrapDir, "lessons"), { recursive: true });
|
|
9941
9980
|
const created = [
|
|
9942
9981
|
".story/config.json",
|
|
9943
9982
|
".story/roadmap.json",
|
|
@@ -9977,7 +10016,7 @@ async function initProject(root, options) {
|
|
|
9977
10016
|
};
|
|
9978
10017
|
await writeConfig(config, absRoot);
|
|
9979
10018
|
await writeRoadmap(roadmap, absRoot);
|
|
9980
|
-
const gitignorePath =
|
|
10019
|
+
const gitignorePath = join18(wrapDir, ".gitignore");
|
|
9981
10020
|
await ensureGitignoreEntries(gitignorePath, STORY_GITIGNORE_ENTRIES);
|
|
9982
10021
|
const warnings = [];
|
|
9983
10022
|
if (options.force && exists) {
|
|
@@ -10016,7 +10055,7 @@ async function ensureGitignoreEntries(gitignorePath, entries) {
|
|
|
10016
10055
|
// src/mcp/index.ts
|
|
10017
10056
|
var ENV_VAR2 = "CLAUDESTORY_PROJECT_ROOT";
|
|
10018
10057
|
var CONFIG_PATH2 = ".story/config.json";
|
|
10019
|
-
var version = "0.1.
|
|
10058
|
+
var version = "0.1.43";
|
|
10020
10059
|
function tryDiscoverRoot() {
|
|
10021
10060
|
const envRoot = process.env[ENV_VAR2];
|
|
10022
10061
|
if (envRoot) {
|
|
@@ -10028,7 +10067,7 @@ function tryDiscoverRoot() {
|
|
|
10028
10067
|
const resolved = resolve8(envRoot);
|
|
10029
10068
|
try {
|
|
10030
10069
|
const canonical = realpathSync2(resolved);
|
|
10031
|
-
if (existsSync11(
|
|
10070
|
+
if (existsSync11(join19(canonical, CONFIG_PATH2))) {
|
|
10032
10071
|
return canonical;
|
|
10033
10072
|
}
|
|
10034
10073
|
process.stderr.write(`Warning: No .story/config.json at ${canonical}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@anthropologies/claudestory",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.43",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"description": "Cross-session context persistence for AI coding projects. Tracks tickets, issues, roadmap, and handovers so every session builds on the last.",
|
|
6
6
|
"keywords": [
|
package/src/skill/SKILL.md
CHANGED
|
@@ -3,7 +3,7 @@ name: story
|
|
|
3
3
|
description: Cross-session context persistence for AI coding projects. Load project context, manage sessions, guide setup.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# /story
|
|
6
|
+
# /story -- Project Context & Session Management
|
|
7
7
|
|
|
8
8
|
claudestory tracks tickets, issues, roadmap, and handovers in a `.story/` directory so every AI coding session builds on the last instead of starting from zero.
|
|
9
9
|
|
|
@@ -11,16 +11,16 @@ claudestory tracks tickets, issues, roadmap, and handovers in a `.story/` direct
|
|
|
11
11
|
|
|
12
12
|
`/story` is one smart command. Parse the user's intent from context:
|
|
13
13
|
|
|
14
|
-
- `/story`
|
|
15
|
-
- `/story auto`
|
|
16
|
-
- `/story review T-XXX`
|
|
17
|
-
- `/story plan T-XXX`
|
|
18
|
-
- `/story guided T-XXX`
|
|
19
|
-
- `/story handover`
|
|
20
|
-
- `/story snapshot`
|
|
21
|
-
- `/story export`
|
|
22
|
-
- `/story status`
|
|
23
|
-
- `/story help`
|
|
14
|
+
- `/story` -> full context load (default, see Step 2 below)
|
|
15
|
+
- `/story auto` -> start autonomous mode (read `autonomous-mode.md` in the same directory as this skill file; if not found, tell user to run `claudestory setup-skill`)
|
|
16
|
+
- `/story review T-XXX` -> start review mode for a ticket (read `autonomous-mode.md` in the same directory as this skill file; if not found, tell user to run `claudestory setup-skill`)
|
|
17
|
+
- `/story plan T-XXX` -> start plan mode for a ticket (read `autonomous-mode.md` in the same directory as this skill file; if not found, tell user to run `claudestory setup-skill`)
|
|
18
|
+
- `/story guided T-XXX` -> start guided mode for a ticket (read `autonomous-mode.md` in the same directory as this skill file; if not found, tell user to run `claudestory setup-skill`)
|
|
19
|
+
- `/story handover` -> draft a session handover. Summarize the session's work, then call `claudestory_handover_create` with the drafted content and a descriptive slug
|
|
20
|
+
- `/story snapshot` -> save project state (call `claudestory_snapshot` MCP tool)
|
|
21
|
+
- `/story export` -> export project for sharing. Ask the user whether to export the current phase or the full project, then call `claudestory_export` with either `phase` or `all` set
|
|
22
|
+
- `/story status` -> quick status check (call `claudestory_status` MCP tool)
|
|
23
|
+
- `/story help` -> show all capabilities (read `reference.md` in the same directory as this skill file; if not found, tell user to run `claudestory setup-skill`)
|
|
24
24
|
|
|
25
25
|
If the user's intent doesn't match any of these, use the full context load.
|
|
26
26
|
|
|
@@ -28,13 +28,13 @@ If the user's intent doesn't match any of these, use the full context load.
|
|
|
28
28
|
|
|
29
29
|
Check if the claudestory MCP tools are available by looking for `claudestory_status` in your available tools.
|
|
30
30
|
|
|
31
|
-
**If MCP tools ARE available**
|
|
31
|
+
**If MCP tools ARE available** -> proceed to Step 1.
|
|
32
32
|
|
|
33
33
|
**If MCP tools are NOT available:**
|
|
34
34
|
|
|
35
35
|
1. Check if the `claudestory` CLI is installed: run `claudestory --version` via Bash
|
|
36
36
|
2. If NOT installed:
|
|
37
|
-
- Check `node --version` and `npm --version`
|
|
37
|
+
- Check `node --version` and `npm --version` -- both must be available
|
|
38
38
|
- If Node.js is missing, tell the user to install Node.js 20+ first
|
|
39
39
|
- Otherwise, with user permission, run: `npm install -g @anthropologies/claudestory`
|
|
40
40
|
- Then run: `claude mcp add claudestory -s user -- claudestory --mcp`
|
|
@@ -56,156 +56,28 @@ Check if the claudestory MCP tools are available by looking for `claudestory_sta
|
|
|
56
56
|
|
|
57
57
|
## Step 1: Check Project
|
|
58
58
|
|
|
59
|
-
- If `.story/` exists in the current working directory (or a parent)
|
|
60
|
-
- If no `.story/` but project indicators exist (code, manifest, .git)
|
|
61
|
-
- If no `.story/` and no project indicators
|
|
62
|
-
|
|
63
|
-
### AI-Assisted Setup Flow
|
|
64
|
-
|
|
65
|
-
This flow creates a meaningful `.story/` project instead of empty scaffolding. Claude analyzes the project, proposes structure, and creates everything via MCP tools.
|
|
66
|
-
|
|
67
|
-
#### 1a. Detect Project Type
|
|
68
|
-
|
|
69
|
-
Check for project indicators to determine if this is an **existing project** or a **new/empty project**:
|
|
70
|
-
|
|
71
|
-
- `package.json` → npm/node (read `name`, `description`, check for `typescript` dep)
|
|
72
|
-
- `Cargo.toml` → Rust
|
|
73
|
-
- `go.mod` → Go
|
|
74
|
-
- `pyproject.toml` / `requirements.txt` → Python
|
|
75
|
-
- `*.xcodeproj` / `Package.swift` → Swift/macOS
|
|
76
|
-
- `*.sln` / `*.csproj` → C#/.NET
|
|
77
|
-
- `Gemfile` → Ruby
|
|
78
|
-
- `build.gradle.kts` / `build.gradle` → Android/Kotlin/Java (or Spring Boot)
|
|
79
|
-
- `pubspec.yaml` → Flutter/Dart
|
|
80
|
-
- `angular.json` → Angular
|
|
81
|
-
- `svelte.config.js` → SvelteKit
|
|
82
|
-
- `.git/` → has version history
|
|
83
|
-
|
|
84
|
-
If none found (empty or near-empty directory) → skip to **1c. New Project Interview**.
|
|
85
|
-
|
|
86
|
-
#### 1b. Existing Project — Analyze
|
|
87
|
-
|
|
88
|
-
Before diving into analysis, briefly introduce claudestory to the user:
|
|
89
|
-
|
|
90
|
-
"Claude Story tracks your project's roadmap, tickets, issues, and session handovers in a `.story/` directory. Every Claude Code session starts by reading this context, so you never re-explain your project from scratch. Sessions build on each other: decisions, blockers, and lessons carry forward automatically. I'll analyze your project and propose a structure. You can adjust everything before I create anything."
|
|
91
|
-
|
|
92
|
-
Keep it to 3-4 sentences. Not a sales pitch, just enough that the user knows what they're opting into and that they're in control.
|
|
93
|
-
|
|
94
|
-
Read these files to understand the project (skip any that don't exist, skip files > 50KB):
|
|
95
|
-
|
|
96
|
-
1. **README.md** — project description, goals, feature list, roadmap/TODO sections
|
|
97
|
-
2. **Package manifest** — project name, dependencies, scripts
|
|
98
|
-
3. **CLAUDE.md** — existing project spec (if any)
|
|
99
|
-
4. **Top-level directory listing** — identify major components (src/, test/, docs/, etc.)
|
|
100
|
-
5. **Git summary** — `git log --oneline -20` for recent work patterns
|
|
101
|
-
6. **GitHub issues (ask user first)** — `gh issue list --limit 30 --state open --json number,title,labels,body,createdAt`. If gh fails (auth, rate limit, no remote), skip cleanly and note "GitHub import skipped: [reason]"
|
|
102
|
-
|
|
103
|
-
**Framework-specific deep scan** — after detecting the project type in 1a, scan deeper into framework conventions to understand architecture:
|
|
104
|
-
|
|
105
|
-
- **Next.js / Nuxt:** Check `app/` vs `pages/` routing, scan `app/api/` or `pages/api/` for API routes, read `next.config.*` / `nuxt.config.*`, check for middleware.
|
|
106
|
-
- **Express / Fastify / Koa:** Scan for route files (`routes/`, `src/routes/`), look for `router.get/post` patterns, identify service/controller layers.
|
|
107
|
-
- **NestJS:** Read `nest-cli.json`, scan `src/` for `*.module.ts`, check for controllers and services.
|
|
108
|
-
- **React (CRA / Vite) / Vue / Svelte:** Check `src/components/` structure, look for state management imports (redux, zustand, pinia), identify routing setup.
|
|
109
|
-
- **Angular:** Read `angular.json`, scan `src/app/` for modules and components, check for services and guards.
|
|
110
|
-
- **Django / FastAPI / Flask:** Check for `manage.py`, scan for app directories or router files, look at models and migrations.
|
|
111
|
-
- **Spring Boot:** Check `pom.xml` or `build.gradle` for Spring deps, scan `src/main/java` for controller/service/repository layers.
|
|
112
|
-
- **Rust:** Check `Cargo.toml` for workspace members, scan for `mod.rs` / `lib.rs` structure, identify crate types.
|
|
113
|
-
- **Swift / Xcode:** Check `.xcodeproj` or `Package.swift`, identify SwiftUI vs UIKit, scan for targets.
|
|
114
|
-
- **Android (Kotlin/Java):** Check `build.gradle.kts`, scan `app/src/main/` for activity/fragment/composable structure, check `AndroidManifest.xml`, identify Compose vs XML layouts.
|
|
115
|
-
- **Flutter / Dart:** Check `pubspec.yaml`, scan `lib/` for feature folders (models/, screens/, widgets/, services/), check for state management imports (provider, riverpod, bloc).
|
|
116
|
-
- **Go:** Check `go.mod`, scan for `cmd/` and `internal/`/`pkg/`, check for `Makefile`.
|
|
117
|
-
- **Monorepo:** If `packages/`, `apps/`, or workspace config detected, list each package with its purpose before proposing phases.
|
|
118
|
-
- **Other:** Scan `src/` two levels deep and identify dominant patterns (MVC, service layers, feature folders).
|
|
119
|
-
|
|
120
|
-
**Derive project metadata:**
|
|
121
|
-
- **name**: from package manifest `name` field, or directory name
|
|
122
|
-
- **type**: from package manager (npm, cargo, pip, etc.)
|
|
123
|
-
- **language**: from file extensions and manifest
|
|
124
|
-
|
|
125
|
-
**Assess project stage** from the data — don't use fixed thresholds. A project with 3 commits and a half-written README is greenfield. A project with 500+ commits, test suites, and release tags is mature. A project with 200 commits and active PRs is active development. Use your judgment.
|
|
126
|
-
|
|
127
|
-
**Propose 3-7 phases** reflecting the project's actual development trajectory. Examples:
|
|
128
|
-
- Library: setup → core-api → documentation → testing → publishing
|
|
129
|
-
- App: mvp → auth → data-layer → ui-polish → deployment
|
|
130
|
-
- Mid-development project: capture completed work as early phases, then plan forward
|
|
131
|
-
|
|
132
|
-
**Propose initial tickets** per active phase (2-5 each), based on:
|
|
133
|
-
- README TODOs or roadmap sections (treat as hints, not ground truth)
|
|
134
|
-
- GitHub issues if imported — infer from label semantics: bug/defect labels → issues, enhancement/feature labels → tickets
|
|
135
|
-
- Obvious gaps (missing tests, no CI, no docs, etc.)
|
|
136
|
-
- If more than 30 GitHub issues exist, note "Showing 30 of N. Additional issues can be imported later."
|
|
137
|
-
|
|
138
|
-
**Important:** Only mark phases complete if explicitly confirmed by user or docs — do NOT infer completion from git history alone.
|
|
139
|
-
|
|
140
|
-
#### 1c. New Project — Interview
|
|
141
|
-
|
|
142
|
-
Ask the user:
|
|
143
|
-
1. "What are you building?" — project name and purpose
|
|
144
|
-
2. "What's the tech stack?" — language, framework, project type
|
|
145
|
-
3. "What are the major milestones?" — helps define phases
|
|
146
|
-
4. "What's the first thing to build?" — seeds the first ticket
|
|
147
|
-
|
|
148
|
-
Propose phases and initial tickets from the answers.
|
|
149
|
-
|
|
150
|
-
#### 1d. Present Proposal
|
|
151
|
-
|
|
152
|
-
Show the user a structured proposal (table format, not raw JSON):
|
|
153
|
-
- **Project:** name, type, language
|
|
154
|
-
- **Phases** (table: id, name, description)
|
|
155
|
-
- **Tickets per phase** (title, type, status)
|
|
156
|
-
- **Issues** (if GitHub import was used)
|
|
157
|
-
|
|
158
|
-
Before asking for approval, briefly explain what they're looking at:
|
|
159
|
-
|
|
160
|
-
"**How this works:** Phases are milestones in your project's development. They track progress from setup to shipping. Tickets are specific work items within each phase. After setup, typing `/story` at the start of any Claude Code session loads this context automatically. Claude will know your project's state, what was done last session, and what to work on next."
|
|
161
|
-
|
|
162
|
-
Then ask for approval with clear interaction guidance:
|
|
163
|
-
|
|
164
|
-
"Does this look right? You can:
|
|
165
|
-
- Adjust any phase (rename, reorder, add, remove)
|
|
166
|
-
- Change tickets (add, remove, rephrase, move between phases)
|
|
167
|
-
- Mark phases as complete or in-progress
|
|
168
|
-
- Split or merge phases
|
|
169
|
-
|
|
170
|
-
I'll iterate until you're happy, then create everything."
|
|
171
|
-
|
|
172
|
-
#### 1e. Execute on Approval
|
|
173
|
-
|
|
174
|
-
1. Call `claudestory_init` with name, type, language — after this, all MCP tools become available dynamically
|
|
175
|
-
2. Call `claudestory_phase_create` for each phase — first phase with `atStart: true`, subsequent with `after: <previous-phase-id>`
|
|
176
|
-
3. Call `claudestory_ticket_create` for each ticket
|
|
177
|
-
4. Call `claudestory_issue_create` for each imported GitHub issue
|
|
178
|
-
5. Call `claudestory_ticket_update` to mark already-complete tickets as `complete`
|
|
179
|
-
6. Call `claudestory_snapshot` to save initial baseline
|
|
180
|
-
|
|
181
|
-
#### 1f. Post-Setup
|
|
182
|
-
|
|
183
|
-
After creation completes:
|
|
184
|
-
- Confirm what was created (e.g., "Created 5 phases, 12 tickets, and 3 issues")
|
|
185
|
-
- Check if `.gitignore` includes `.story/snapshots/` (warn if missing — snapshots should not be committed)
|
|
186
|
-
- Suggest creating `CLAUDE.md` if it doesn't exist (project spec for AI sessions)
|
|
187
|
-
- Suggest creating `RULES.md` if it doesn't exist (development constraints)
|
|
188
|
-
- Write an initial handover documenting the setup decisions
|
|
189
|
-
- Proceed to Step 2 (Load Context) to show the new project state
|
|
59
|
+
- If `.story/` exists in the current working directory (or a parent) -> proceed to Step 2
|
|
60
|
+
- If no `.story/` but project indicators exist (code, manifest, .git) -> read `setup-flow.md` in the same directory as this skill file and follow the AI-Assisted Setup Flow (if not found, tell user to run `claudestory setup-skill`)
|
|
61
|
+
- If no `.story/` and no project indicators -> explain what claudestory is and suggest navigating to a project
|
|
190
62
|
|
|
191
63
|
## Step 2: Load Context (Default /story Behavior)
|
|
192
64
|
|
|
193
65
|
Call these in order:
|
|
194
66
|
|
|
195
|
-
1. **Project status**
|
|
196
|
-
2. **Session recap**
|
|
197
|
-
3. **Recent handovers**
|
|
198
|
-
4. **Development rules**
|
|
199
|
-
5. **Lessons learned**
|
|
200
|
-
6. **Recent commits**
|
|
67
|
+
1. **Project status** -- call `claudestory_status` MCP tool
|
|
68
|
+
2. **Session recap** -- call `claudestory_recap` MCP tool (shows changes since last snapshot)
|
|
69
|
+
3. **Recent handovers** -- call `claudestory_handover_latest` MCP tool with `count: 3` (last 3 sessions' context -- ensures reasoning behind recent decisions is preserved, not just the latest session's state)
|
|
70
|
+
4. **Development rules** -- read `RULES.md` if it exists in the project root
|
|
71
|
+
5. **Lessons learned** -- call `claudestory_lesson_digest` MCP tool
|
|
72
|
+
6. **Recent commits** -- run `git log --oneline -10`
|
|
201
73
|
|
|
202
74
|
## Step 2b: Empty Scaffold Check
|
|
203
75
|
|
|
204
76
|
After `claudestory_status` returns, check in order:
|
|
205
77
|
|
|
206
|
-
1. **Integrity guard**
|
|
207
|
-
2. **Scaffold detection**
|
|
208
|
-
3. **Empty without code**
|
|
78
|
+
1. **Integrity guard** -- if the response starts with "Warning:" and contains "item(s) skipped due to data integrity issues", this is NOT an empty scaffold. Tell the user to run `claudestory validate`. Continue Step 2/3 normally.
|
|
79
|
+
2. **Scaffold detection** -- check BOTH: output contains "## Getting Started" AND shows `Tickets: 0/0 complete` + `Handovers: 0`. If met AND the project has code indicators (git history, package manifest, source files), read `setup-flow.md` in the same directory as this skill file and follow the AI-Assisted Setup Flow (section 1b). After setup completes, restart Step 2 from the top (the project now has data to load).
|
|
80
|
+
3. **Empty without code** -- if scaffold detected but no code indicators (truly empty directory), continue to Step 3 which will show: "Your project is set up but has no tickets yet. Would you like me to help you create your first phase and tickets?"
|
|
209
81
|
|
|
210
82
|
## Step 3: Present Summary
|
|
211
83
|
|
|
@@ -226,9 +98,9 @@ Then ask: **"What would you like to work on?"**
|
|
|
226
98
|
|
|
227
99
|
- **Snapshots** save project state for diffing. They may be auto-taken before context compaction.
|
|
228
100
|
- **Handovers** are session continuity documents. Create one at the end of significant sessions.
|
|
229
|
-
- **Recaps** show what changed since the last snapshot
|
|
101
|
+
- **Recaps** show what changed since the last snapshot -- useful for understanding drift.
|
|
230
102
|
|
|
231
|
-
**Never modify or overwrite existing handover files.** Handovers are append-only historical records. Always create new handover files
|
|
103
|
+
**Never modify or overwrite existing handover files.** Handovers are append-only historical records. Always create new handover files -- never edit, replace, or write to an existing one. If you need to correct something from a previous session, create a new handover that references the correction. This prevents accidental data loss during sessions.
|
|
232
104
|
|
|
233
105
|
Before writing a handover at the end of a session, run `claudestory snapshot` first. This ensures the next session's recap can show what changed. If `setup-skill` has been run, a PreCompact hook auto-takes snapshots before context compaction.
|
|
234
106
|
|
|
@@ -238,20 +110,20 @@ Before writing a handover at the end of a session, run `claudestory snapshot` fi
|
|
|
238
110
|
- Tool/framework quirks discovered during implementation
|
|
239
111
|
- Process improvements (review workflows, testing strategies)
|
|
240
112
|
|
|
241
|
-
Don't duplicate what's already in the handover
|
|
113
|
+
Don't duplicate what's already in the handover -- lessons are structured, tagged, and ranked. Handovers are narrative. Use `claudestory_lesson_digest` to check existing lessons before creating duplicates. Use `claudestory_lesson_reinforce` when an existing lesson proves true again.
|
|
242
114
|
|
|
243
115
|
## Ticket and Issue Discipline
|
|
244
116
|
|
|
245
|
-
**Tickets** are planned work
|
|
117
|
+
**Tickets** are planned work -- features, tasks, refactors. They represent intentional, scoped commitments.
|
|
246
118
|
|
|
247
119
|
**Ticket types:**
|
|
248
|
-
- `task`
|
|
249
|
-
- `feature`
|
|
250
|
-
- `chore`
|
|
120
|
+
- `task` -- Implementation work: building features, writing code, fixing bugs, refactoring.
|
|
121
|
+
- `feature` -- A user-facing capability or significant new functionality. Larger scope than a task.
|
|
122
|
+
- `chore` -- Maintenance, publishing, documentation, cleanup. No functional change to the product.
|
|
251
123
|
|
|
252
|
-
**Issues** are discovered problems
|
|
124
|
+
**Issues** are discovered problems -- bugs, inconsistencies, gaps, risks found during work. If you're not sure whether something is a ticket or an issue, make it an issue. It can be promoted to a ticket later.
|
|
253
125
|
|
|
254
|
-
When working on a task and you encounter a bug, inconsistency, or improvement opportunity that is out of scope for the current ticket, create an issue using `claudestory issue create` (CLI) with a clear title, severity, and impact description. Don't fix it in the current task, don't ignore it
|
|
126
|
+
When working on a task and you encounter a bug, inconsistency, or improvement opportunity that is out of scope for the current ticket, create an issue using `claudestory issue create` (CLI) with a clear title, severity, and impact description. Don't fix it in the current task, don't ignore it -- log it. This keeps the issue tracker growing organically and ensures nothing discovered during work is lost.
|
|
255
127
|
|
|
256
128
|
When starting work on a ticket, update its status to `inprogress`. When done, update to `complete` in the same commit as the code change.
|
|
257
129
|
|
|
@@ -274,7 +146,7 @@ Read operations (list, get, next, blocked) are available via both CLI and MCP.
|
|
|
274
146
|
|
|
275
147
|
## Notes
|
|
276
148
|
|
|
277
|
-
**Notes** are unstructured brainstorming artifacts
|
|
149
|
+
**Notes** are unstructured brainstorming artifacts -- ideas, design thinking, "what if" explorations. Use notes when the content doesn't fit tickets (planned work) or issues (discovered problems).
|
|
278
150
|
|
|
279
151
|
Create notes via CLI: `claudestory note create --content "..." --tags idea`
|
|
280
152
|
|
|
@@ -282,68 +154,10 @@ Create notes via MCP: `claudestory_note_create` with `content`, optional `title`
|
|
|
282
154
|
|
|
283
155
|
List, get, and update notes via MCP: `claudestory_note_list`, `claudestory_note_get`, `claudestory_note_update`. Delete remains CLI-only: `claudestory note delete <id>`.
|
|
284
156
|
|
|
285
|
-
##
|
|
286
|
-
|
|
287
|
-
`/story auto` starts an autonomous coding session. The guide picks tickets, plans, reviews, implements, and commits — looping until all tickets are done or the session limit is reached.
|
|
288
|
-
|
|
289
|
-
**How it works:**
|
|
290
|
-
|
|
291
|
-
1. Call `claudestory_autonomous_guide` with `{ "sessionId": null, "action": "start" }`
|
|
292
|
-
2. The guide returns an instruction with ticket candidates and exact JSON for the next call
|
|
293
|
-
3. Follow every instruction exactly. Call the guide back after each step.
|
|
294
|
-
4. The guide advances through: PICK_TICKET → PLAN → PLAN_REVIEW → IMPLEMENT → CODE_REVIEW → FINALIZE → COMPLETE → loop
|
|
295
|
-
5. Continue until the guide returns SESSION_END
|
|
296
|
-
|
|
297
|
-
**Critical rules for autonomous mode:**
|
|
298
|
-
- Do NOT use Claude Code's plan mode — write plans as markdown files
|
|
299
|
-
- Do NOT ask the user for confirmation or approval
|
|
300
|
-
- Do NOT stop or summarize between tickets — call the guide IMMEDIATELY
|
|
301
|
-
- Follow the guide's instructions exactly — it specifies which tools to call, what parameters to use
|
|
302
|
-
- After each step completes, call `claudestory_autonomous_guide` with `action: "report"` and the results
|
|
303
|
-
|
|
304
|
-
**If the guide says to compact:** Call `claudestory_autonomous_guide` with `action: "pre_compact"`, then run `/compact`, then call with `action: "resume"`.
|
|
305
|
-
|
|
306
|
-
**If something goes wrong:** Call `claudestory_autonomous_guide` with `action: "cancel"` to cleanly end the session.
|
|
307
|
-
|
|
308
|
-
## Tiered Access — Review, Plan, Guided Modes
|
|
309
|
-
|
|
310
|
-
The autonomous guide supports four execution tiers. Same guide, same handlers, different entry/exit points.
|
|
311
|
-
|
|
312
|
-
### `/story review T-XXX`
|
|
313
|
-
|
|
314
|
-
"I wrote code for T-XXX, review it." Enters at CODE_REVIEW, loops review rounds, exits on approval.
|
|
315
|
-
|
|
316
|
-
1. Call `claudestory_autonomous_guide` with `{ "sessionId": null, "action": "start", "mode": "review", "ticketId": "T-XXX" }`
|
|
317
|
-
2. The guide enters CODE_REVIEW — follow its diff capture and review instructions
|
|
318
|
-
3. On approve: session ends automatically. On revise/reject: fix code, re-review
|
|
319
|
-
4. After approval, you can proceed to commit — the guide does NOT auto-commit in review mode
|
|
320
|
-
|
|
321
|
-
**Note:** Review mode relaxes git constraints — dirty working tree is allowed since the user has code ready for review.
|
|
322
|
-
|
|
323
|
-
### `/story plan T-XXX`
|
|
324
|
-
|
|
325
|
-
"Help me plan T-XXX." Enters at PLAN, runs PLAN_REVIEW rounds, exits on approval.
|
|
326
|
-
|
|
327
|
-
1. Call `claudestory_autonomous_guide` with `{ "sessionId": null, "action": "start", "mode": "plan", "ticketId": "T-XXX" }`
|
|
328
|
-
2. The guide enters PLAN — write the implementation plan as a markdown file
|
|
329
|
-
3. On plan review approve: session ends automatically. On revise/reject: revise plan, re-review
|
|
330
|
-
4. The approved plan is saved in `.story/sessions/<id>/plan.md`
|
|
331
|
-
|
|
332
|
-
### `/story guided T-XXX`
|
|
333
|
-
|
|
334
|
-
"Do T-XXX end to end with review." Full pipeline for a single ticket: PLAN → PLAN_REVIEW → IMPLEMENT → CODE_REVIEW → FINALIZE → COMPLETE → HANDOVER → SESSION_END.
|
|
335
|
-
|
|
336
|
-
1. Call `claudestory_autonomous_guide` with `{ "sessionId": null, "action": "start", "mode": "guided", "ticketId": "T-XXX" }`
|
|
337
|
-
2. Follow every instruction exactly, calling the guide back after each step
|
|
338
|
-
3. Session ends automatically after the single ticket is complete
|
|
339
|
-
|
|
340
|
-
**Guided vs Auto:** Guided mode forces `maxTicketsPerSession: 1` and exits after the ticket. Auto mode loops until all tickets are done or the session limit is reached.
|
|
341
|
-
|
|
342
|
-
### All tiered modes:
|
|
343
|
-
- Require a `ticketId` — no ad-hoc review without a ticket in V1
|
|
344
|
-
- Use the same review process as auto mode (same backends, same adaptive depth)
|
|
345
|
-
- Can be cancelled with `action: "cancel"` at any point
|
|
157
|
+
## Support Files
|
|
346
158
|
|
|
347
|
-
|
|
159
|
+
Additional skill documentation, loaded on demand:
|
|
348
160
|
|
|
349
|
-
|
|
161
|
+
- **`setup-flow.md`** -- Project detection and AI-Assisted Setup Flow (new project initialization)
|
|
162
|
+
- **`autonomous-mode.md`** -- Autonomous mode, review, plan, and guided execution tiers
|
|
163
|
+
- **`reference.md`** -- Full CLI command and MCP tool reference
|