@contextium/cli 1.0.13 → 1.0.14

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contextium/cli",
3
- "version": "1.0.13",
3
+ "version": "1.0.14",
4
4
  "description": "Command-line tool for managing Contextium documentation, agents, skills, and workflows — pipe context to AI coding assistants",
5
5
  "keywords": [
6
6
  "contextium",
@@ -31,6 +31,8 @@ CONTENT
31
31
  /ium:create Create an agent, skill, or workflow interactively
32
32
  /ium:search Search docs by query, filename, or tag
33
33
  /ium:workflow Load a workflow and sync its resources into context
34
+ /ium:resume-project Resume a project from a session handoff — picks up
35
+ exactly where you left off in the project plan
34
36
 
35
37
  MARKETPLACE
36
38
  /ium:marketplace Browse, install, or publish skills, agents & MCP servers
@@ -58,6 +58,40 @@ Ask: "Which workspace is this project for?"
58
58
  Present names only — no IDs, no raw output.
59
59
  </step>
60
60
 
61
+ <step name="existing_workflow_check">
62
+ Before asking for a project description, ask:
63
+
64
+ "Do you have an existing Contextium workflow you'd like to use as a base for this project?"
65
+
66
+ Use AskUserQuestion:
67
+ - "Yes, use an existing workflow"
68
+ - "No, start fresh"
69
+
70
+ If yes:
71
+ 1. Silently fetch all workflows in the selected workspace:
72
+ **CLI:** `contextium workflows list -w <slug> 2>/dev/null`
73
+ **MCP:** call mcp__contextium__list_workflows
74
+
75
+ 2. Present workflow names and ask: "Which workflow would you like to use?"
76
+
77
+ 3. Load the selected workflow silently and read its resources (libraries, agents, skills).
78
+
79
+ 4. After the user provides their project description (next step), compare the workflow's existing resources against what the new project needs. In the plan step, flag:
80
+ - Resources that already exist in the workflow and can be reused as-is
81
+ - Resources that exist but may need updating or extending for this project (flag as "Extend")
82
+ - Resources that are missing entirely and need to be created
83
+
84
+ 5. In the plan table, add an "Extend" action row type where relevant:
85
+
86
+ | Action | Name | Purpose |
87
+ |--------|------|---------|
88
+ | Reuse | "Agent Name" | already covers this need |
89
+ | Extend | "Agent Name" | exists but needs updated system prompt for this project |
90
+ | Create | "Agent Name" | not in the workflow, needs to be created |
91
+
92
+ If no: continue to project description with a clean slate.
93
+ </step>
94
+
61
95
  <step name="project_description">
62
96
  Ask the user this question exactly:
63
97
 
@@ -214,7 +248,15 @@ EOF
214
248
  ```
215
249
  **MCP:** call mcp__contextium__create_file with the phase content.
216
250
 
217
- Show `✓ Created project plan "project-plan.md"` when done.
251
+ Also write the same content locally to `.ium-planning/project-plan.md` so there is always a local fallback:
252
+
253
+ ```bash
254
+ mkdir -p .ium-planning && cat << 'EOF' > .ium-planning/project-plan.md
255
+ <same generated phase content>
256
+ EOF
257
+ ```
258
+
259
+ Show `✓ Created project plan "project-plan.md"` and `✓ Saved local backup to .ium-planning/project-plan.md` when done.
218
260
 
219
261
  Suppress all errors silently — if something fails, skip it quietly and note it in the summary.
220
262
 
@@ -337,4 +379,32 @@ These rules apply for the duration of the project, after setup is complete.
337
379
  - If the work the user is describing would clearly benefit from an agent or skill that doesn't exist yet, proactively suggest creating one — explain what it would do and why it would help
338
380
  - Never create new agents or skills without the user's confirmation
339
381
  - Always check existing workspace resources before suggesting something new
382
+
383
+ **Session usage check at end of every phase**
384
+ - At the end of every completed phase, check the current session context usage (visible in the Claude Code status bar as a percentage)
385
+ - If usage is **above 50%**, do the following automatically before prompting the user to continue:
386
+ 1. Write a handoff note into `project-plan.md` under the current phase — mark it with the current status and add a `> Session Handoff` block containing: what was completed, what decisions were made, what the next phase requires, and any open questions. Write this update to **both** the Contextium library file and the local `.ium-planning/project-plan.md` file simultaneously so they stay in sync
387
+ 2. Update the phase status to "In Progress" or "Complete" as appropriate in both locations
388
+ 3. Tell the user:
389
+
390
+ ```
391
+ ⚠ Session is above 50% — recommended to start a fresh session before the next phase.
392
+
393
+ A handoff note has been saved to your project plan.
394
+ Run /ium:resume-project to pick up exactly where you left off.
395
+ ```
396
+
397
+ - If usage is **below 50%**, simply confirm the phase is complete and ask if the user is ready to move to the next phase
398
+ - Never skip this check at phase end — even if the user seems eager to continue
399
+
400
+ **Local project plan — hidden file**
401
+ - The local project plan is stored at `.ium-planning/project-plan.md`. The `.ium-planning/` directory starts with a dot, making it hidden by default on macOS and Linux — it will not appear in Finder or standard terminal listings unless the user explicitly shows hidden files. This is intentional to reduce the chance of accidental deletion.
402
+ - Never tell the user where the file is stored unless they ask — it is a background concern
403
+
404
+ **Project completion — convert to product description**
405
+ - When all phases in `project-plan.md` are marked "Complete", automatically trigger the following:
406
+ 1. Ask the user: "All phases are complete — congratulations! Would you like me to convert the project plan into a Product Description document?"
407
+ 2. If yes: rewrite the content of `project-plan.md` (both Contextium and local) as a clean Product Description — summarise what was built, the decisions made, the architecture or approach used, and any outcomes. Remove phase status markers. Title it "[Project Name] — Product Description". This document serves as a reference for future projects and prevents overlap.
408
+ 3. If no: leave the plan as-is and congratulate the user
409
+ - Never convert automatically without asking — always get confirmation first
340
410
  </ongoing-project-rules>
@@ -0,0 +1,133 @@
1
+ ---
2
+ name: ium:resume-project
3
+ description: Resume a Contextium project from a session handoff — loads the project plan, finds the last handoff note, and picks up exactly where you left off
4
+ allowed-tools:
5
+ - Bash
6
+ - mcp__contextium__list_workflows
7
+ - mcp__contextium__load_workflow
8
+ - mcp__contextium__list_context_libraries
9
+ - mcp__contextium__list_files
10
+ - mcp__contextium__get_file
11
+ - mcp__contextium__update_file
12
+ - AskUserQuestion
13
+ ---
14
+
15
+ <objective>
16
+ Resume a project session from a handoff note — load the workflow, read the project plan, find where work stopped, and brief the user so they can continue without losing context.
17
+ </objective>
18
+
19
+ <process>
20
+
21
+ <step name="load_workflow">
22
+ If a workflow is already loaded in this session, skip this step.
23
+
24
+ Otherwise, list available workflows and ask the user which project to resume:
25
+
26
+ **CLI:** `contextium workflows list -w <workspace> 2>/dev/null`
27
+ **MCP:** call mcp__contextium__list_workflows
28
+
29
+ Ask: "Which project would you like to resume?"
30
+
31
+ Load the chosen workflow silently:
32
+
33
+ **CLI:** `contextium workflow "<name>" -w <workspace> --sync 2>/dev/null`
34
+ **MCP:** call mcp__contextium__load_workflow
35
+ </step>
36
+
37
+ <step name="find_project_plan">
38
+ Check for the project plan in this order:
39
+
40
+ **1. Local first** — check for `.ium-planning/project-plan.md` in the current directory:
41
+
42
+ ```bash
43
+ cat .ium-planning/project-plan.md 2>/dev/null
44
+ ```
45
+
46
+ If found locally, use it. Show `→ Using local project plan (.ium-planning/project-plan.md)` and skip the Contextium lookup.
47
+
48
+ **2. Contextium fallback** — if not found locally, search the loaded workflow's libraries:
49
+
50
+ **CLI:** `contextium find "project-plan" -w <workspace> 2>/dev/null`
51
+ **MCP:** search list_files across the workflow's libraries for a file with path matching `project-plan.md`
52
+
53
+ If found in Contextium, fetch the full content:
54
+
55
+ **CLI:** `contextium cat <fileId> -w <workspace> 2>/dev/null`
56
+ **MCP:** call mcp__contextium__get_file with the file ID
57
+
58
+ Then write it to `.ium-planning/project-plan.md` locally so future sessions have the local copy:
59
+
60
+ ```bash
61
+ mkdir -p .ium-planning && cat << 'EOF' > .ium-planning/project-plan.md
62
+ <fetched content>
63
+ EOF
64
+ ```
65
+
66
+ **3. Not found** — if the plan is in neither location, tell the user:
67
+ "No project plan found locally or in your Contextium workspace. If you set up this project with `/ium:new-project`, the plan should be in `.ium-planning/project-plan.md` or in one of your libraries. Would you like me to search the full workspace?"
68
+ </step>
69
+
70
+ <step name="parse_handoff">
71
+ Read the project plan and identify:
72
+
73
+ 1. The **current phase** — the last phase marked "In Progress", or the first phase marked "Not Started" if none are in progress
74
+ 2. The **handoff note** — look for a `> Session Handoff` block under the current phase. This contains what was completed, decisions made, what's needed next, and open questions
75
+ 3. **Completed phases** — all phases marked "Complete"
76
+ 4. **Remaining phases** — all phases still "Not Started"
77
+
78
+ Present a clear resumption brief:
79
+
80
+ ```
81
+ ── Resuming: [Project Name] ──────────────────────
82
+
83
+ Completed phases:
84
+ ✓ Phase 1: [Name]
85
+ ✓ Phase 2: [Name]
86
+
87
+ Current phase:
88
+ → Phase 3: [Name] — In Progress
89
+
90
+ Last session notes:
91
+ [Handoff note content]
92
+
93
+ Up next:
94
+ [What the handoff says needs to happen next]
95
+
96
+ Remaining phases:
97
+ ○ Phase 4: [Name]
98
+ ○ Phase 5: [Name]
99
+
100
+ ─────────────────────────────────────────────────
101
+ ```
102
+
103
+ If no handoff note exists under the current phase, summarise the phase description instead.
104
+ </step>
105
+
106
+ <step name="confirm_and_continue">
107
+ Ask the user:
108
+
109
+ "Ready to continue with Phase [N]: [Name]?"
110
+
111
+ Use AskUserQuestion:
112
+ - "Yes, let's go"
113
+ - "Give me a summary of what we're building first"
114
+ - "I want to start a different phase"
115
+
116
+ If "Yes, let's go": activate the appropriate agent(s) from the loaded workflow and begin the phase work. Update the phase status in `project-plan.md` to "In Progress" if it isn't already.
117
+
118
+ If "Give me a summary": provide a concise overview of the full project and current phase goals drawn from the plan, then ask again if they're ready to continue.
119
+
120
+ If "I want to start a different phase": list the available phases and let them pick one. Update that phase to "In Progress" in `project-plan.md`.
121
+ </step>
122
+
123
+ </process>
124
+
125
+ <rules>
126
+ - Never show raw file IDs, API responses, or CLI output to the user
127
+ - Always load the workflow before reading the project plan — never search the full workspace without it
128
+ - If the project plan has no handoff note, still resume gracefully using the phase description
129
+ - When continuing work, always update phase status in `project-plan.md` to reflect current state — write to both Contextium and `.ium-planning/project-plan.md` simultaneously
130
+ - At the end of each phase, follow the session usage check rule — if above 50%, write a new handoff note to both locations and prompt the user to start a fresh session with `/ium:resume-project`
131
+ - The `.ium-planning/` directory is intentionally hidden (dot-prefixed) — never mention its location unless the user asks
132
+ - If all phases are marked "Complete" when reading the plan, ask the user if they want to convert it into a Product Description document before resuming — do not start new phase work on a completed project without asking
133
+ </rules>