@contextium/cli 1.0.14 → 1.0.15

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.14",
3
+ "version": "1.0.15",
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",
@@ -49,6 +49,32 @@ Workspace
49
49
  | A role combining multiple skills? | Agent |
50
50
  | Ready-to-use context package for a task? | Workflow |
51
51
 
52
+ ## Contextium Is the Source of Truth
53
+
54
+ All AI-relevant information — project state, SOPs, constraints, decisions, research, planning — lives in Contextium. It is always written to Contextium first. Local files are only for things that belong in git: source code, config, READMEs.
55
+
56
+ Never write AI planning or knowledge files locally by default. If a user specifically asks for a local copy of something, write it — but Contextium is always written first and is always authoritative.
57
+
58
+ This gives users something local file-based tools cannot: state survives machine loss, team members share the same context, and multiple projects run in parallel — one workflow loaded per terminal session — with no interference between them.
59
+
60
+ ## Multi-Project Rule
61
+
62
+ Each project must have its own dedicated context library. Never mix two projects into one library.
63
+
64
+ The project state file (`project-state.md`) is the single source of truth for a project's current position, locked decisions, and seeds. **Only one `project-state.md` should ever exist per library.** If a second one would need to be created in the same library, stop and ask the user to use a different library or create a new one.
65
+
66
+ ## Decision Routing
67
+
68
+ When a significant architectural, technical, or approach decision is made during any session, write it to the `## Decisions Log` in `project-state.md` immediately — no user permission needed. Log it silently and mention it in the phase summary.
69
+
70
+ A decision qualifies if it:
71
+ - Picks a technology or library
72
+ - Sets an API contract or data model
73
+ - Establishes a pattern future phases will depend on
74
+ - Rules out an approach that was considered
75
+
76
+ Decisions in the log are **locked**. Future sessions must not re-debate them. If the user explicitly wants to revisit a decision, they must say so — only then update the entry.
77
+
52
78
  ## File Routing — Writing Files When Contextium Is Connected
53
79
 
54
80
  When the Contextium MCP is connected or the CLI is active, **any time a new file is about to be created**, intercept it with a routing question before writing:
@@ -202,7 +202,7 @@ If no: set `research_agent_planned = false` and continue.
202
202
  <step name="planner_question">
203
203
  Ask the user:
204
204
 
205
- "Would you like a project planner to break your project into phases and track progress? I'll create a planning agent and a phase tracker document you can follow from start to finish."
205
+ "Would you like a project planner to break your project into phases and track progress? I'll create a planning agent and a state document you can follow from start to finish."
206
206
 
207
207
  Use AskUserQuestion:
208
208
  - "Yes, add a project planner"
@@ -210,23 +210,50 @@ Use AskUserQuestion:
210
210
 
211
211
  If yes:
212
212
  1. Add a "**[Project Name] Planner**" agent to the creation plan — its role is to define project phases, estimate scope, and guide execution in order. Tailor its system prompt to the project domain. Store as `planner_planned = true`.
213
- 2. After all resources are created, create a planning document file in the most relevant library. The file should contain a phased breakdown of the project inferred from the user's description structured like:
213
+ 2. After all resources are created, create a project state document in the most relevant library. This is the living memory for the project not just a phase list. Use this exact structure:
214
214
 
215
215
  ```markdown
216
- # [Project Name] — Project Plan
216
+ # [Project Name] — Project State
217
217
 
218
- ## Phase 1: [Name]
218
+ ## Current Position
219
+ **Phase:** Phase 1: [Name]
220
+ **Status:** Not Started
221
+ **Last Updated:** [today's date]
222
+ **Next Action:** Begin Phase 1
223
+
224
+ ## Phases
225
+
226
+ ### Phase 1: [Name]
219
227
  **Status:** Not Started
220
228
  [Brief description of what this phase covers]
221
229
 
222
- ## Phase 2: [Name]
230
+ ### Phase 2: [Name]
223
231
  **Status:** Not Started
224
232
  [Brief description]
225
233
 
226
234
  ...
235
+
236
+ ## Decisions Log
237
+ > Locked decisions — record here when a significant architectural, technical, or approach decision is made. Do not re-debate entries in this log.
238
+
239
+ | Decision | Rationale | Phase |
240
+ |----------|-----------|-------|
241
+ | _(none yet)_ | | |
242
+
243
+ ## Seeds
244
+ > Ideas and suggestions to revisit at the right time — not immediate work.
245
+
246
+ | Idea | When to revisit | Context |
247
+ |------|-----------------|---------|
248
+ | _(none yet)_ | | |
249
+
250
+ ## Notes
251
+ _(ad-hoc notes that don't fit elsewhere)_
227
252
  ```
228
253
 
229
- Infer sensible phases from the project description. Use "Not Started" for all phases. Title the file something like `project-plan.md`.
254
+ Infer sensible phases from the project description. Title the file `project-state.md`.
255
+
256
+ **Important:** Only one `project-state.md` should ever exist per context library. This is the single source of truth for this project. Never create a second one or split state across multiple files.
230
257
 
231
258
  If no: set `planner_planned = false` and continue.
232
259
  </step>
@@ -238,25 +265,17 @@ Do NOT create a workflow in this step.
238
265
 
239
266
  Show `✓ Created "Name"` for each item as it is created. Show `↗ Reusing "Name"` for each existing resource being included.
240
267
 
241
- If `planner_planned = true`, create the project plan file after all other resources are created:
268
+ If `planner_planned = true`, create the project state file in Contextium after all other resources are created:
242
269
 
243
270
  **CLI:**
244
271
  ```bash
245
- cat << 'EOF' | contextium new <library-name> -t "[Project Name] — Project Plan" -p "project-plan.md" --stdin -w <workspace>
246
- <generated phase content>
272
+ cat << 'EOF' | contextium new <library-name> -t "[Project Name] — Project State" -p "project-state.md" --stdin -w <workspace>
273
+ <generated state content>
247
274
  EOF
248
275
  ```
249
- **MCP:** call mcp__contextium__create_file with the phase content.
276
+ **MCP:** call mcp__contextium__create_file with the state content.
250
277
 
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.
278
+ Show `✓ Created project state "project-state.md"` when done.
260
279
 
261
280
  Suppress all errors silently — if something fails, skip it quietly and note it in the summary.
262
281
 
@@ -323,7 +342,7 @@ Use AskUserQuestion:
323
342
  - "Yes, start planning now"
324
343
  - "No, I'll do it later"
325
344
 
326
- If yes: activate the planner agent — instruct it to analyse the project description and produce a detailed phased plan, updating the `project-plan.md` file created earlier with specific tasks, milestones, and sequencing. Let it run and surface the plan to the user.
345
+ If yes: activate the planner agent — instruct it to analyse the project description and produce a detailed phased plan, updating the `project-state.md` file created earlier with specific tasks, milestones, and sequencing. Let it run and surface the plan to the user.
327
346
 
328
347
  If no: continue to summary.
329
348
  </step>
@@ -364,16 +383,24 @@ If anything failed to create, add a single line at the end:
364
383
  These rules apply for the duration of the project, after setup is complete.
365
384
 
366
385
  **New suggestions and feature ideas**
367
- - Whenever a new feature, idea, or suggestion comes up during the project, ask: "Would you like to add this to the project plan to tackle after the current work is done?"
368
- - If yes: append it to `project-plan.md` as a new phase with status "Not Started"
386
+ - Whenever a new feature, idea, or suggestion comes up during the project, ask: "Would you like to add this to the project state as a seed to revisit later?"
387
+ - If yes: append it to the `## Seeds` section of `project-state.md` in Contextium with a "When to revisit" trigger (e.g. "When Phase 3 begins", "When load testing reveals bottlenecks") and a brief context note.
369
388
  - If no: note it and continue with the current work
370
-
371
- **Tackling a new feature or setting**
372
- - When the user is ready to start work on a new feature or area of the project, ask:
373
- 1. "Would you like to run a research phase on this first?" if a research agent exists, use it; otherwise offer to create one
374
- 2. "Would you like a phased plan for this?" if a planner agent exists, use it to produce a plan and add it to `project-plan.md`; otherwise offer to create one
375
- - If the user says no to both, continue directly using the existing agents based on their instructions no extra setup needed
376
- - Treat each new feature as its own mini-project using the existing workspace resources never create duplicate agents or skills if suitable ones already exist
389
+ - Seeds are NOT immediate work — never promote a seed to a phase without the user asking
390
+
391
+ **Decision locking**
392
+ - Whenever a significant architectural, technical, or approach decision is made during a phase, write it to the `## Decisions Log` table in `project-state.md` in Contextium immediately.
393
+ - A decision qualifies if it: picks a technology, sets an API contract, defines a data model, or establishes a pattern that future phases will depend on
394
+ - Decisions in the log are **locked** — do not re-debate them in future sessions. If the user wants to revisit a decision, they must explicitly say so; only then remove or update the entry
395
+ - Never ask the user's permission to log a decisionjust do it silently and mention it in the phase summary
396
+
397
+ **Tackling a new feature or phase**
398
+ - When the user is ready to start work on a new feature or area of the project:
399
+ 1. Update `## Current Position` in `project-state.md` in Contextium to reflect the new phase — set Phase, Status to "In Progress", and Next Action.
400
+ 2. Ask: "Would you like to run a research phase on this first?" — if a research agent exists, use it; otherwise offer to create one
401
+ 3. Ask: "Would you like a phased plan for this?" — if a planner agent exists, use it; otherwise offer to create one
402
+ - If the user says no to both, continue directly using existing agents — no extra setup needed
403
+ - Treat each new feature as its own mini-project using existing workspace resources — never create duplicate agents or skills if suitable ones already exist
377
404
 
378
405
  **Suggesting new agents and skills**
379
406
  - 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
@@ -383,28 +410,27 @@ These rules apply for the duration of the project, after setup is complete.
383
410
  **Session usage check at end of every phase**
384
411
  - At the end of every completed phase, check the current session context usage (visible in the Claude Code status bar as a percentage)
385
412
  - 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:
413
+ 1. Update `project-state.md` in Contextium — mark the phase "Complete" or "In Progress", update `## Current Position` to point to the next phase, and add a `> Session Handoff` block under the current phase containing: what was completed, decisions made this session (list them), what the next phase requires, and open questions.
414
+ 2. Tell the user:
389
415
 
390
416
  ```
391
417
  ⚠ Session is above 50% — recommended to start a fresh session before the next phase.
392
418
 
393
- A handoff note has been saved to your project plan.
419
+ Project state has been saved to your Contextium library.
394
420
  Run /ium:resume-project to pick up exactly where you left off.
395
421
  ```
396
422
 
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
423
+ - If usage is **below 50%**, confirm the phase is complete, update `## Current Position` to the next phase, and ask if the user is ready to move on
398
424
  - Never skip this check at phase end — even if the user seems eager to continue
399
425
 
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
426
+ **Multi-project rule**
427
+ - Only one `project-state.md` should ever exist per context library. If a user has multiple projects, each project must have its own dedicated library never mix two projects' state into one library.
428
+ - If a second `project-state.md` would need to be created in the same library, stop and ask the user to either use a different library or create a new one for this project.
403
429
 
404
430
  **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
431
+ - When all phases in `project-state.md` are marked "Complete", automatically trigger the following:
432
+ 1. Ask the user: "All phases are complete — congratulations! Would you like me to convert the project state into a Product Description document?"
433
+ 2. If yes: rewrite the content in Contextium as a clean Product Description — summarise what was built, the decisions made (draw from the Decisions Log), the architecture or approach used, and outcomes. Remove phase status markers and the Decisions Log table. Title it "[Project Name] — Product Description". This document serves as a reference for future projects.
434
+ 3. If no: leave the state file as-is and congratulate the user
409
435
  - Never convert automatically without asking — always get confirmation first
410
436
  </ongoing-project-rules>
@@ -34,72 +34,66 @@ Load the chosen workflow silently:
34
34
  **MCP:** call mcp__contextium__load_workflow
35
35
  </step>
36
36
 
37
- <step name="find_project_plan">
38
- Check for the project plan in this order:
37
+ <step name="find_project_state">
38
+ Contextium is the source of truth. Always read from there first.
39
39
 
40
- **1. Local first** — check for `.ium-planning/project-plan.md` in the current directory:
40
+ **1. Contextium first** — search the loaded workflow's libraries for `project-state.md`:
41
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`
42
+ **CLI:** `contextium find "project-state" -w <workspace> 2>/dev/null`
43
+ **MCP:** search list_files across the workflow's libraries for a file with path matching `project-state.md`
52
44
 
53
- If found in Contextium, fetch the full content:
45
+ If found, fetch the full content:
54
46
 
55
47
  **CLI:** `contextium cat <fileId> -w <workspace> 2>/dev/null`
56
48
  **MCP:** call mcp__contextium__get_file with the file ID
57
49
 
58
- Then write it to `.ium-planning/project-plan.md` locally so future sessions have the local copy:
50
+ **2. Legacy fallback** if `project-state.md` is not found, search for the older `project-plan.md` filename in the same libraries and treat it the same way.
59
51
 
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?"
52
+ **3. Not found** — if not found in Contextium, tell the user:
53
+ "No project state found in your Contextium workspace. If you set up this project with `/ium:new-project`, the state should be in one of your libraries. Would you like me to search the full workspace?"
68
54
  </step>
69
55
 
70
- <step name="parse_handoff">
71
- Read the project plan and identify:
56
+ <step name="parse_state">
57
+ Read the project state file and extract:
72
58
 
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
59
+ 1. **Current Position** — from the `## Current Position` section: current phase name, status, and next action
60
+ 2. **Handoff note** — look for a `> Session Handoff` block under the current phase. Contains what was completed, decisions made, what's needed next, open questions
75
61
  3. **Completed phases** — all phases marked "Complete"
76
- 4. **Remaining phases** — all phases still "Not Started"
62
+ 4. **Remaining phases** — all phases still "Not Started" or "In Progress"
63
+ 5. **Recent decisions** — the last 3 entries from the `## Decisions Log` table (if it exists and has entries)
64
+ 6. **Pending seeds** — any entries in the `## Seeds` table (surface only if relevant to the current phase)
77
65
 
78
66
  Present a clear resumption brief:
79
67
 
80
68
  ```
81
69
  ── Resuming: [Project Name] ──────────────────────
82
70
 
83
- Completed phases:
71
+ Completed:
84
72
  ✓ Phase 1: [Name]
85
73
  ✓ Phase 2: [Name]
86
74
 
87
- Current phase:
75
+ Current:
88
76
  → Phase 3: [Name] — In Progress
77
+ Next action: [from Current Position]
89
78
 
90
79
  Last session notes:
91
- [Handoff note content]
80
+ [Handoff note content, or phase description if no handoff]
92
81
 
93
82
  Up next:
94
- [What the handoff says needs to happen next]
83
+ [What the handoff says needs to happen]
95
84
 
96
- Remaining phases:
85
+ Remaining:
97
86
  ○ Phase 4: [Name]
98
87
  ○ Phase 5: [Name]
99
88
 
89
+ Locked decisions:
90
+ • [Decision] — [Rationale]
91
+ • [Decision] — [Rationale]
92
+
100
93
  ─────────────────────────────────────────────────
101
94
  ```
102
95
 
96
+ Only show the "Locked decisions" section if the Decisions Log has entries — these are facts the session must not re-debate.
103
97
  If no handoff note exists under the current phase, summarise the phase description instead.
104
98
  </step>
105
99
 
@@ -113,21 +107,21 @@ Use AskUserQuestion:
113
107
  - "Give me a summary of what we're building first"
114
108
  - "I want to start a different phase"
115
109
 
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.
110
+ 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-state.md` to "In Progress" if it isn't already.
117
111
 
118
112
  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
113
 
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`.
114
+ 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-state.md`.
121
115
  </step>
122
116
 
123
117
  </process>
124
118
 
125
119
  <rules>
126
120
  - 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
121
+ - Always load the workflow before reading the project state — never search the full workspace without it
122
+ - If the state file has no handoff note, still resume gracefully using the phase description and Current Position
123
+ - When continuing work, always update `## Current Position` and phase status in `project-state.md` in Contextium
124
+ - Decisions in the `## Decisions Log` are locked surface them in the resumption brief so the session starts with full context, but never re-debate them unless the user explicitly asks to
125
+ - At the end of each phase, follow the session usage check rule if above 50%, write a new handoff note and update Current Position in Contextium, then prompt the user to start a fresh session with `/ium:resume-project`
126
+ - If all phases are marked "Complete" when reading the state, 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
127
  </rules>