@contextium/cli 1.0.18 → 1.0.20

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.
@@ -0,0 +1,211 @@
1
+ ---
2
+ name: ium:new-project-legacy
3
+ description: Legacy new-project setup flow (deprecated; kept for reference)
4
+ allowed-tools:
5
+ - Bash
6
+ - mcp__contextium__list_workspaces
7
+ - mcp__contextium__create_context_library
8
+ - mcp__contextium__list_context_libraries
9
+ - mcp__contextium__create_agent
10
+ - mcp__contextium__list_agents
11
+ - mcp__contextium__create_skill
12
+ - mcp__contextium__list_skills
13
+ - mcp__contextium__create_workflow
14
+ - mcp__contextium__list_workflows
15
+ - mcp__contextium__list_tags
16
+ - mcp__contextium__list_tag_types
17
+ - mcp__contextium__create_tag
18
+ - mcp__contextium__create_tag_type
19
+ - AskUserQuestion
20
+ ---
21
+
22
+ <objective>
23
+ Set up a new Contextium project intelligently — understand what the user is trying to do, quietly analyse the workspace for existing resources, then recommend exactly what to create (libraries, agents, skills, tags, workflow) with clear reasoning. Get confirmation before creating anything.
24
+ </objective>
25
+
26
+ <mode-detection>
27
+ Run this once at the start, silently, to determine which mode to use for the entire session:
28
+
29
+ ```bash
30
+ command -v contextium &>/dev/null && echo "cli" || echo "no-cli"
31
+ ```
32
+
33
+ - If `cli`: use CLI commands throughout. Do not attempt MCP tools.
34
+ - If `no-cli`: check if mcp__contextium__list_workspaces is available. If yes, use MCP tools throughout.
35
+ - If neither: tell the user "Contextium doesn't appear to be installed. Install the CLI with `npm install -g @contextium/cli` or connect the MCP server, then re-run this." Stop here.
36
+
37
+ Do not mention the mode to the user. Pick one path and stick with it.
38
+ </mode-detection>
39
+
40
+ <process>
41
+
42
+ <step name="check_auth">
43
+ **CLI only.** Run silently:
44
+ ```bash
45
+ contextium whoami 2>/dev/null | grep -E "Token:|Name:" || echo "unauthenticated"
46
+ ```
47
+ If token is expired or unauthenticated, tell the user: "Your Contextium session has expired — run `contextium login` in your terminal, then come back and re-run this." Stop here.
48
+
49
+ MCP users are already authenticated via the server connection — skip this step.
50
+ </step>
51
+
52
+ <step name="select_workspace">
53
+ **CLI:** run `contextium workspace list 2>/dev/null` silently, parse workspace names.
54
+ **MCP:** call mcp__contextium__list_workspaces silently.
55
+
56
+ Ask: "Which workspace is this project for?"
57
+
58
+ Present names only — no IDs, no raw output.
59
+ </step>
60
+
61
+ <step name="project_description">
62
+ Ask the user this question exactly:
63
+
64
+ "Tell me about your project — what are you trying to do, what topics are involved, and what kind of work will you be doing with this? The more detail you give me, the better I can set things up for you."
65
+
66
+ Wait for their response. Store it as the project description. Do not proceed until you have a meaningful answer.
67
+ </step>
68
+
69
+ <step name="quiet_analysis">
70
+ Silently fetch all existing workspace resources. Do not show raw output or errors. Show only these progress lines as you go:
71
+
72
+ ```
73
+ Searching libraries...
74
+ Searching agents...
75
+ Searching skills...
76
+ Searching tags...
77
+ ```
78
+
79
+ **CLI:**
80
+ ```bash
81
+ contextium library list --workspace <slug> 2>/dev/null
82
+ contextium agent list --workspace <slug> 2>/dev/null
83
+ contextium skill list --workspace <slug> 2>/dev/null
84
+ contextium tag list --workspace <slug> 2>/dev/null
85
+ ```
86
+
87
+ **MCP:** call list_context_libraries, list_agents, list_skills, list_tags — all for the selected workspace. Suppress any errors silently.
88
+
89
+ After all four searches complete, output this line:
90
+ ```
91
+ Creating Contextium setup plan...
92
+ ```
93
+
94
+ Then analyse the results against the project description:
95
+ - Which existing libraries (if any) are relevant to what the user described?
96
+ - Which existing agents (if any) could serve this project?
97
+ - Which existing skills (if any) are applicable?
98
+ - Which existing tags/tag types (if any) relate to the topics mentioned?
99
+
100
+ Internally categorise everything as: **reuse** (relevant, already exists) or **create** (needed, does not exist).
101
+ </step>
102
+
103
+ <step name="intelligent_plan">
104
+ Based on the project description and the analysis, build a setup plan. Think through:
105
+
106
+ **Libraries:** What distinct knowledge areas did the user mention? Each major topic or type of content that needs to be stored separately should be its own library. If an existing library already covers one of these, mark it for reuse.
107
+
108
+ **Agents:** What kind of AI assistant roles would serve this project? Think about what tasks the user will perform — research, writing, analysis, Q&A, etc. If an existing agent fits, mark it for reuse.
109
+
110
+ **Skills:** What reusable knowledge blocks would help agents working on this project? Think about domain-specific guidelines, reference material, or persistent context the agent needs. If an existing skill fits, mark it for reuse.
111
+
112
+ **Tags:** What topic or category labels would make sense for organising content in this project? Look for existing tag types that match. If none exist, suggest new ones. Think in terms of tag categories (e.g. `topic`, `source`, `status`) and the specific tag values within them (e.g. `topic:space-travel`, `topic:rocket-engineering`).
113
+
114
+ **Workflow:** Propose one workflow name that bundles everything together for quick loading.
115
+
116
+ Present the plan in this format (omit any section that has nothing in it):
117
+
118
+ ---
119
+
120
+ Here's what I'll set up for you:
121
+
122
+ **New libraries to create**
123
+ - "Library Name" — reason why this is needed
124
+
125
+ **Existing libraries to reuse**
126
+ - "Library Name" — why it's relevant
127
+
128
+ **New agents to create**
129
+ - "Agent Name" — what it will do for this project
130
+
131
+ **Existing agents to reuse**
132
+ - "Agent Name" — why it fits
133
+
134
+ **New skills to create**
135
+ - "Skill Name" — what knowledge it will hold
136
+
137
+ **Existing skills to reuse**
138
+ - "Skill Name" — why it fits
139
+
140
+ **Tags to create**
141
+ - `category:value` — why this label is useful
142
+
143
+ **Workflow**
144
+ - "Workflow Name" — bundles everything above for quick loading
145
+
146
+ Shall I go ahead and create all of this?
147
+
148
+ ---
149
+
150
+ Wait for the user to confirm, adjust, or say skip on any item before proceeding.
151
+ </step>
152
+
153
+ <step name="create_resources">
154
+ Only create what the user confirmed. Create in this order: tag types → tags → libraries → skills → agents → workflow.
155
+
156
+ Show `✓ Created "Name"` for each item as it is created. Show `↗ Reusing "Name"` for each existing resource being included.
157
+
158
+ Suppress all errors silently — if something fails, skip it quietly and note it in the summary.
159
+
160
+ **CLI commands:**
161
+ ```bash
162
+ contextium library create "<name>" --workspace <slug>
163
+ contextium agent create "<name>" --workspace <slug>
164
+ contextium skill create "<name>" --workspace <slug>
165
+ contextium workflow create "<name>" --workspace <slug>
166
+ contextium tag create "<value>" --type <type-slug> --workspace <slug>
167
+ contextium tag-type create "<name>" --workspace <slug>
168
+ ```
169
+
170
+ **MCP:** use the corresponding create_* tools for each resource type.
171
+ </step>
172
+
173
+ <step name="load_workflow">
174
+ After all resources are created, automatically load the workflow without asking the user. Run silently:
175
+
176
+ **CLI:** `contextium workflow load "<workflow-name>" --workspace <slug> 2>/dev/null`
177
+ **MCP:** call mcp__contextium__load_workflow with the workflow name and workspace.
178
+
179
+ Do not tell the user to load it themselves — just load it as part of setup.
180
+ </step>
181
+
182
+ <step name="summary">
183
+ Show a clean final summary:
184
+
185
+ ```
186
+ ✓ Project ready
187
+
188
+ Workspace: <name>
189
+ Libraries: <list — new + reused>
190
+ Agents: <list — new + reused, or none>
191
+ Skills: <list — new + reused, or none>
192
+ Tags: <list, or none>
193
+ Workflow: <name> — loaded and ready
194
+ ```
195
+
196
+ If anything failed to create, add a single line at the end:
197
+ `⚠ Could not create: <list of names> — you can add these manually.`
198
+ </step>
199
+
200
+ </process>
201
+
202
+ <rules>
203
+ - Never say "the wizard", "Contextium would like to know", or "the next step is"
204
+ - Never show raw bash output, API responses, or IDs to the user
205
+ - Run all checks and fetches silently — only surface progress labels and the final plan
206
+ - Only ask questions when genuinely needed — the description step and the confirmation step
207
+ - Do not ask the user what to create — figure it out from the description, then ask them to confirm
208
+ - If a resource already exists and is relevant, always prefer reuse over creating a duplicate
209
+ - The plan report must explain the reasoning for each item — not just list names
210
+ - Never create anything before the user confirms the plan
211
+ </rules>
@@ -0,0 +1,32 @@
1
+ ---
2
+ name: ium:run
3
+ description: Run exact Contextium CLI commands non-interactively
4
+ allowed-tools:
5
+ - Bash
6
+ ---
7
+
8
+ <objective>
9
+ Execute a user-provided `contextium` command exactly as written, with no interactive planning flow.
10
+ </objective>
11
+
12
+ <process>
13
+ If the user provided command arguments, run silently:
14
+
15
+ ```bash
16
+ contextium <user-args>
17
+ ```
18
+
19
+ Then return only a concise result summary.
20
+
21
+ If no args were provided, ask one short question:
22
+ "What exact Contextium command should I run?"
23
+
24
+ Do not propose workflows, plans, or alternatives unless the command fails.
25
+ </process>
26
+
27
+ <rules>
28
+ - Default to non-interactive behavior.
29
+ - Do not call slash commands from this command.
30
+ - Do not ask follow-up questions unless required args are missing or command fails.
31
+ - On failure, show the error and one concrete fix command.
32
+ </rules>
@@ -10,17 +10,6 @@ Search across Contextium documentation and return matching files with their cont
10
10
  </objective>
11
11
 
12
12
  <process>
13
- **Step 1 — Check loaded context first**
14
- If a workflow session context block is active in this conversation, look there first. If the answer is found, respond from it without running any commands.
15
-
16
- **Step 2 — Ask before expanding scope**
17
- If the loaded context doesn't have what the user needs, ask:
18
- "That's not in the loaded workflow context. Would you like me to search the full workspace?"
19
-
20
- Only proceed to step 3 after the user confirms.
21
-
22
- **Step 3 — Search the full workspace**
23
-
24
13
  Run a search across the workspace:
25
14
 
26
15
  ```bash
@@ -19,32 +19,24 @@ Load a Contextium workflow and bring its resources into the current context. Onc
19
19
 
20
20
  Present workflow names only. Ask the user which one to load.
21
21
 
22
- 2. Load the chosen workflow:
22
+ 2. Resolve the workspace BEFORE running any command:
23
+ - If `-w <workspace>` was given in the user's message, use it directly.
24
+ - Otherwise run: `contextium whoami 2>/dev/null` and extract the `workspace` field.
25
+ - If that returns nothing, ask the user: "Which workspace should I load this workflow from?"
26
+ - Do NOT proceed to step 3 until you have a workspace value.
23
27
 
24
- **CLI:** `contextium workflow "<workflow-name>" -w <workspace> --sync 2>/dev/null`
25
- **MCP:** call mcp__contextium__load_workflow
28
+ 3. Load the chosen workflow (workspace is now known):
26
29
 
27
- 3. Output synced file content to context (CLI only):
28
- ```bash
29
- contextium cat --all -w <workspace> 2>/dev/null
30
- ```
30
+ **CLI:** `contextium workflow "<workflow-name>" -w "<workspace>" 2>/dev/null`
31
+ **MCP:** call mcp__contextium__load_workflow
31
32
 
32
- 4. Persist the loaded workspace and workflow to `.contextiumrc` so it can be auto-restored after `/clear`:
33
+ Note: `--sync` is optional and only needed if you want to cache files locally. Omit it by default.
33
34
 
35
+ 4. Output synced file content to context (CLI only):
34
36
  ```bash
35
- node -e "
36
- try {
37
- const fs = require('fs');
38
- const rc = JSON.parse(fs.readFileSync('.contextiumrc', 'utf8'));
39
- rc.last_workflow = '<workflow-name>';
40
- rc.last_workspace = '<workspace-slug-or-name>';
41
- fs.writeFileSync('.contextiumrc', JSON.stringify(rc, null, 2));
42
- } catch(e) {}
43
- " 2>/dev/null
37
+ contextium cat --all -w "<workspace>" 2>/dev/null
44
38
  ```
45
39
 
46
- Do this silently — never mention it to the user.
47
-
48
40
  5. Output a session context block in this exact format so all resource IDs and names are available for the rest of the session without re-querying:
49
41
 
50
42
  ```
@@ -67,7 +59,6 @@ Workflow loaded. What would you like to do?
67
59
  ```
68
60
 
69
61
  If a workflow name was specified directly in the user's message, skip step 1 and load immediately.
70
- If no workspace is specified, use the default from .contextiumrc or ask the user.
71
62
  </process>
72
63
 
73
64
  <session-rules>
@@ -78,13 +69,4 @@ Once the session context block has been output, these rules apply for the rest o
78
69
  - Do NOT re-verify or re-check which libraries, agents, or skills exist — they are already known
79
70
  - All tool calls and checks must be silent — never show the user raw API responses, tool call names, or intermediate results
80
71
  - Only surface the final answer or the created/updated content to the user
81
-
82
- **Scope rules — what is "available":**
83
- - When the user asks "what agents/skills/libraries do I have?" or "what's available?" — answer ONLY from the session context block above. Never call list_agents, list_skills, or list_context_libraries to answer this question.
84
- - If the user asks about something not in the session context, say so and ask if they want you to search the full workspace before doing so.
85
-
86
- **Search order:**
87
- 1. Check the loaded session context first
88
- 2. If not found there, say: "That's not in the loaded workflow. Would you like me to search the full workspace?"
89
- 3. Only query the full workspace after the user confirms
90
72
  </session-rules>
@@ -13,28 +13,27 @@ Switch the active Contextium workspace with full context handoff — save what's
13
13
  <process>
14
14
 
15
15
  <step name="show_current">
16
- Silently fetch the current workspace and available workspaces:
16
+ Show the current workspace and list available workspaces:
17
17
 
18
18
  ```bash
19
- cat .contextiumrc 2>/dev/null
20
- ```
21
-
22
- **CLI:** `contextium workspaces 2>/dev/null`
23
- **MCP:** call mcp__contextium__list_workspaces
19
+ # Show current workspace from .contextiumrc
20
+ cat .contextiumrc 2>/dev/null | grep -E "workspace" | head -5 || echo "No .contextiumrc found"
24
21
 
25
- Parse the results internally — extract names and slugs only. Never show IDs, UUIDs, or raw command output to the user.
22
+ # List all available workspaces
23
+ contextium workspaces
24
+ ```
26
25
 
27
26
  Display clearly:
28
27
  ```
29
28
  Current workspace: <name>
30
29
 
31
30
  Available workspaces:
32
- 1. Workspace A
33
- 2. Workspace B
34
- 3. Workspace C
31
+ 1. workspace-a
32
+ 2. workspace-b
33
+ 3. workspace-c
35
34
  ```
36
35
 
37
- Ask the user which workspace to switch to using AskUserQuestion with workspace **names only** as options — no IDs, no slugs. If the user already specified one in their message, skip this and use it directly.
36
+ Ask the user which workspace to switch to using AskUserQuestion with the workspace names as options. If the user already specified one in their message, skip this and use it directly.
38
37
  </step>
39
38
 
40
39
  <step name="save_handoff">