@contextium/cli 1.0.30 → 1.0.31
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-client.d.ts","sourceRoot":"","sources":["../../src/lib/api-client.ts"],"names":[],"mappings":"AAAA,OAAc,EAAiB,kBAAkB,EAAE,MAAM,OAAO,CAAA;AAGhE,qBAAa,SAAS;IACpB,OAAO,CAAC,MAAM,CAAe;IAC7B,OAAO,CAAC,YAAY,CAAS;gBAEjB,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,MAAuC;
|
|
1
|
+
{"version":3,"file":"api-client.d.ts","sourceRoot":"","sources":["../../src/lib/api-client.ts"],"names":[],"mappings":"AAAA,OAAc,EAAiB,kBAAkB,EAAE,MAAM,OAAO,CAAA;AAGhE,qBAAa,SAAS;IACpB,OAAO,CAAC,MAAM,CAAe;IAC7B,OAAO,CAAC,YAAY,CAAS;gBAEjB,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,MAAuC;IA0DtE,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,kBAAkB;IAI5C,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,kBAAkB;IAIzD,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,kBAAkB;IAI1D,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,kBAAkB;IAIxD,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,kBAAkB;CAGtD"}
|
package/dist/lib/api-client.js
CHANGED
|
@@ -38,8 +38,6 @@ export class ApiClient {
|
|
|
38
38
|
throw new Error(errorMsg || 'Insufficient permissions');
|
|
39
39
|
case 404:
|
|
40
40
|
throw new Error(errorMsg || 'Resource not found');
|
|
41
|
-
case 423:
|
|
42
|
-
throw new Error(errorMsg || 'A workspace audit is running. Writes are temporarily paused — try again in a few minutes.');
|
|
43
41
|
case 429:
|
|
44
42
|
throw new Error(errorMsg || 'Rate limit exceeded');
|
|
45
43
|
default:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-client.js","sourceRoot":"","sources":["../../src/lib/api-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAA4C,MAAM,OAAO,CAAA;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAE1C,MAAM,OAAO,SAAS;IAIpB,YAAY,MAAc,EAAE,UAAkB,8BAA8B;QAC1E,IAAI,CAAC,YAAY,GAAG,CAAC,MAAM,CAAA;QAE3B,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;YACzB,OAAO;YACP,OAAO,EAAE;gBACP,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,eAAe,EAAE,UAAU,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBAC1D,cAAc,EAAE,kBAAkB;gBAClC,YAAY,EAAE,sBAAsB;gBACpC,qBAAqB,EAAE,KAAK;aAC7B;YACD,OAAO,EAAE,KAAK;SACf,CAAC,CAAA;QAEF,qEAAqE;QACrE,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,GAAG,CAClC,KAAK,EAAE,MAAM,EAAE,EAAE;YACf,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;gBACtB,MAAM,KAAK,GAAG,MAAM,cAAc,EAAE,CAAA;gBACpC,IAAI,KAAK,EAAE,CAAC;oBACV,MAAM,CAAC,OAAO,CAAC,aAAa,GAAG,UAAU,KAAK,EAAE,CAAA;gBAClD,CAAC;qBAAM,CAAC;oBACN,MAAM,IAAI,KAAK,CAAC,8DAA8D,CAAC,CAAA;gBACjF,CAAC;YACH,CAAC;YAC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E,MAA2B;QACnD,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,CAAA;IACxC,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -0,0 +1,536 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ium:new-project
|
|
3
|
+
description: Set up a new Contextium project — authenticate, pick a workspace, describe project, intelligently suggest and create libraries, agents, skills, tags, and a workflow. SUGGEST (proactively ask, don't auto-run) when the user seems to be starting a new project or exploring how to organise their AI context — for example: "I'm starting a new project", "I want to get organised with AI", "how do I get the most out of Claude for my project", "I want Claude to know about my project", "I want to set up AI properly for my work", "I need a way for AI to understand my codebase". In these cases ask: "Would you like to set up a Contextium project? I can create libraries, agents, and skills tailored to what you're building — so any AI in your workflow has the right context automatically." — then wait for confirmation. TRIGGER when user says things like: "set up Contextium", "start a new Contextium project", "create a new project in Contextium", "I want to use Contextium", "get started with Contextium", "initialise Contextium for my project", "configure Contextium for me", "connect my project to Contextium", "onboard to Contextium", "set up my Contextium workspace", "create libraries and agents for my project", "I'm new to Contextium help me get set up", "create a Contextium project from scratch", "set up everything in Contextium for me", "help me configure Contextium".
|
|
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
|
+
- WebFetch
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
<objective>
|
|
24
|
+
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.
|
|
25
|
+
</objective>
|
|
26
|
+
|
|
27
|
+
<mode-detection>
|
|
28
|
+
Run this once at the start, silently, to determine which mode to use for the entire session:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
command -v contextium &>/dev/null && echo "cli" || echo "no-cli"
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
- If `cli`: use CLI commands throughout. Do not attempt MCP tools.
|
|
35
|
+
- If `no-cli`: check if mcp__contextium__list_workspaces is available. If yes, use MCP tools throughout.
|
|
36
|
+
- 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.
|
|
37
|
+
|
|
38
|
+
Do not mention the mode to the user. Pick one path and stick with it.
|
|
39
|
+
</mode-detection>
|
|
40
|
+
|
|
41
|
+
<process>
|
|
42
|
+
|
|
43
|
+
<step name="check_auth">
|
|
44
|
+
**CLI only.** Run silently:
|
|
45
|
+
```bash
|
|
46
|
+
contextium whoami 2>/dev/null | grep -E "Token:|Name:" || echo "unauthenticated"
|
|
47
|
+
```
|
|
48
|
+
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.
|
|
49
|
+
|
|
50
|
+
MCP users are already authenticated via the server connection — skip this step.
|
|
51
|
+
</step>
|
|
52
|
+
|
|
53
|
+
<step name="select_workspace">
|
|
54
|
+
**CLI:** run `contextium workspace list 2>/dev/null` silently, parse workspace names.
|
|
55
|
+
**MCP:** call mcp__contextium__list_workspaces silently.
|
|
56
|
+
|
|
57
|
+
Ask: "Which workspace is this project for?"
|
|
58
|
+
|
|
59
|
+
Present names only — no IDs, no raw output.
|
|
60
|
+
</step>
|
|
61
|
+
|
|
62
|
+
<step name="existing_workflow_check">
|
|
63
|
+
Before asking for a project description, ask:
|
|
64
|
+
|
|
65
|
+
"Do you have an existing Contextium workflow you'd like to use as a base for this project?"
|
|
66
|
+
|
|
67
|
+
Use AskUserQuestion:
|
|
68
|
+
- "Yes, use an existing workflow"
|
|
69
|
+
- "No, start fresh"
|
|
70
|
+
|
|
71
|
+
If yes:
|
|
72
|
+
1. Silently fetch all workflows in the selected workspace:
|
|
73
|
+
**CLI:** `contextium workflows list -w <slug> 2>/dev/null`
|
|
74
|
+
**MCP:** call mcp__contextium__list_workflows
|
|
75
|
+
|
|
76
|
+
2. Present workflow names and ask: "Which workflow would you like to use?"
|
|
77
|
+
|
|
78
|
+
3. Load the selected workflow silently and read its resources (libraries, agents, skills).
|
|
79
|
+
|
|
80
|
+
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:
|
|
81
|
+
- Resources that already exist in the workflow and can be reused as-is
|
|
82
|
+
- Resources that exist but may need updating or extending for this project (flag as "Extend")
|
|
83
|
+
- Resources that are missing entirely and need to be created
|
|
84
|
+
|
|
85
|
+
5. In the plan table, add an "Extend" action row type where relevant:
|
|
86
|
+
|
|
87
|
+
| Action | Name | Purpose |
|
|
88
|
+
|--------|------|---------|
|
|
89
|
+
| Reuse | "Agent Name" | already covers this need |
|
|
90
|
+
| Extend | "Agent Name" | exists but needs updated system prompt for this project |
|
|
91
|
+
| Create | "Agent Name" | not in the workflow, needs to be created |
|
|
92
|
+
|
|
93
|
+
If no: continue to project description with a clean slate.
|
|
94
|
+
</step>
|
|
95
|
+
|
|
96
|
+
<step name="codebase_scan_check">
|
|
97
|
+
Silently check whether any library in the selected workspace contains codebase analysis documents from `/ium:scan-existing`. Look for files named `stack.md`, `architecture.md`, `structure.md`, `conventions.md`, `concerns.md` in any library.
|
|
98
|
+
|
|
99
|
+
**CLI:** `contextium library list --workspace <slug> 2>/dev/null` then check file lists per library
|
|
100
|
+
**MCP:** call mcp__contextium__list_context_libraries, then mcp__contextium__list_files for each
|
|
101
|
+
|
|
102
|
+
If found, read `architecture.md` and `stack.md` silently to understand what already exists. Store this as `has_codebase_scan = true` and `codebase_library = <library name>`. This will be used later to pre-populate validated capabilities in the project state.
|
|
103
|
+
|
|
104
|
+
If not found, set `has_codebase_scan = false` and continue.
|
|
105
|
+
|
|
106
|
+
Do not mention this check to the user.
|
|
107
|
+
</step>
|
|
108
|
+
|
|
109
|
+
<step name="project_description">
|
|
110
|
+
Ask the user this question exactly:
|
|
111
|
+
|
|
112
|
+
"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."
|
|
113
|
+
|
|
114
|
+
Wait for their response. Store it as the project description. Do not proceed until you have a meaningful answer.
|
|
115
|
+
</step>
|
|
116
|
+
|
|
117
|
+
<step name="quiet_analysis">
|
|
118
|
+
Silently fetch all existing workspace resources. Do not show raw output or errors. Show only these progress lines as you go:
|
|
119
|
+
|
|
120
|
+
```
|
|
121
|
+
Searching libraries...
|
|
122
|
+
Searching agents...
|
|
123
|
+
Searching skills...
|
|
124
|
+
Searching tags...
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
**CLI:**
|
|
128
|
+
```bash
|
|
129
|
+
contextium library list --workspace <slug> 2>/dev/null
|
|
130
|
+
contextium agent list --workspace <slug> 2>/dev/null
|
|
131
|
+
contextium skill list --workspace <slug> 2>/dev/null
|
|
132
|
+
contextium tag list --workspace <slug> 2>/dev/null
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
**MCP:** call list_context_libraries, list_agents, list_skills, list_tags — all for the selected workspace. Suppress any errors silently.
|
|
136
|
+
|
|
137
|
+
After all four searches complete, output this line:
|
|
138
|
+
```
|
|
139
|
+
Creating Contextium setup plan...
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Then analyse the results against the project description:
|
|
143
|
+
- Which existing libraries (if any) are relevant to what the user described?
|
|
144
|
+
- Which existing agents (if any) could serve this project?
|
|
145
|
+
- Which existing skills (if any) are applicable?
|
|
146
|
+
- Which existing tags/tag types (if any) relate to the topics mentioned?
|
|
147
|
+
|
|
148
|
+
Internally categorise everything as: **reuse** (relevant, already exists) or **create** (needed, does not exist).
|
|
149
|
+
</step>
|
|
150
|
+
|
|
151
|
+
<step name="intelligent_plan">
|
|
152
|
+
Based on the project description and the analysis, build a setup plan. Think through:
|
|
153
|
+
|
|
154
|
+
**Libraries:** Create exactly ONE library per project. All planning documents, technical documents, research, and project state files go into this single library. Give it a clear name (e.g. "Contextium Desktop App") and a one-sentence description of what the project is. Do not split a project across multiple libraries. If an existing library already covers this project, mark it for reuse instead of creating a new one.
|
|
155
|
+
|
|
156
|
+
**Agents:** Always include a "Project Architect" agent as the first agent — its role is to define the project process, break the work into phases, and track overall progress. Write its system prompt to be specific to this project's domain and goals. Then think about what other AI assistant roles would serve this project based on what the user described. If an existing agent fits one of the additional roles, mark it for reuse.
|
|
157
|
+
|
|
158
|
+
**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.
|
|
159
|
+
|
|
160
|
+
**Tags:** What topic or category labels would make sense for organising **files within context libraries** for this project? Tags apply to library files only — never suggest tags for agents or skills. 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`).
|
|
161
|
+
|
|
162
|
+
Present the plan in this format (omit any section that has nothing in it):
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
Here's what I'll set up for you:
|
|
167
|
+
|
|
168
|
+
**Libraries**
|
|
169
|
+
|
|
170
|
+
| Action | Name | Purpose |
|
|
171
|
+
|--------|------|---------|
|
|
172
|
+
| Create | "Library Name" | reason why this is needed |
|
|
173
|
+
| Reuse | "Library Name" | why it's relevant |
|
|
174
|
+
|
|
175
|
+
**Agents**
|
|
176
|
+
|
|
177
|
+
| Action | Name | Purpose |
|
|
178
|
+
|--------|------|---------|
|
|
179
|
+
| Create | "Agent Name" | what it will do for this project |
|
|
180
|
+
| Reuse | "Agent Name" | why it fits |
|
|
181
|
+
|
|
182
|
+
**Skills**
|
|
183
|
+
|
|
184
|
+
| Action | Name | Purpose |
|
|
185
|
+
|--------|------|---------|
|
|
186
|
+
| Create | "Skill Name" | what knowledge it will hold |
|
|
187
|
+
| Reuse | "Skill Name" | why it fits |
|
|
188
|
+
|
|
189
|
+
**Tags**
|
|
190
|
+
|
|
191
|
+
| Tag | Purpose |
|
|
192
|
+
|-----|---------|
|
|
193
|
+
| `category:value` | why this label is useful |
|
|
194
|
+
|
|
195
|
+
Shall I go ahead and create all of this?
|
|
196
|
+
|
|
197
|
+
---
|
|
198
|
+
|
|
199
|
+
Wait for the user to confirm, adjust, or say skip on any item before proceeding.
|
|
200
|
+
</step>
|
|
201
|
+
|
|
202
|
+
<step name="research_question">
|
|
203
|
+
Ask the user:
|
|
204
|
+
|
|
205
|
+
"Does this project need research before you start work? I can create a dedicated research agent to gather information, analyse sources, and summarise findings for your project."
|
|
206
|
+
|
|
207
|
+
Use AskUserQuestion:
|
|
208
|
+
- "Yes, add a research agent"
|
|
209
|
+
- "No, skip"
|
|
210
|
+
|
|
211
|
+
If yes: add a project-specific research agent to the creation plan. Name it something like "**[Project Name] Researcher**" and tailor its system prompt to the specific research domain (e.g. competitor analysis, technical investigation, market research — infer from the project description). Store this agent as `research_agent_planned = true` for use in later steps.
|
|
212
|
+
|
|
213
|
+
If no: set `research_agent_planned = false` and continue.
|
|
214
|
+
</step>
|
|
215
|
+
|
|
216
|
+
<step name="planner_question">
|
|
217
|
+
Ask the user:
|
|
218
|
+
|
|
219
|
+
"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."
|
|
220
|
+
|
|
221
|
+
Use AskUserQuestion:
|
|
222
|
+
- "Yes, add a project planner"
|
|
223
|
+
- "No, skip"
|
|
224
|
+
|
|
225
|
+
If yes:
|
|
226
|
+
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`.
|
|
227
|
+
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:
|
|
228
|
+
|
|
229
|
+
```markdown
|
|
230
|
+
# [Project Name] — Project State
|
|
231
|
+
|
|
232
|
+
## Current Position
|
|
233
|
+
**Phase:** Phase 1: [Name]
|
|
234
|
+
**Status:** Not Started
|
|
235
|
+
**Last Updated:** [today's date]
|
|
236
|
+
**Next Action:** Begin Phase 1
|
|
237
|
+
|
|
238
|
+
## Already Built
|
|
239
|
+
> Capabilities confirmed by codebase scan — these do not need to be built.
|
|
240
|
+
> _(Remove this section if starting a greenfield project with no existing code)_
|
|
241
|
+
|
|
242
|
+
- ✓ [Existing capability — e.g. "Express API with JWT auth"] — `src/server.ts`
|
|
243
|
+
- ✓ [Existing capability] — `src/`
|
|
244
|
+
|
|
245
|
+
## Phases
|
|
246
|
+
|
|
247
|
+
### Phase 1: [Name]
|
|
248
|
+
**Status:** Not Started
|
|
249
|
+
[Brief description of what this phase covers]
|
|
250
|
+
|
|
251
|
+
### Phase 2: [Name]
|
|
252
|
+
**Status:** Not Started
|
|
253
|
+
[Brief description]
|
|
254
|
+
|
|
255
|
+
...
|
|
256
|
+
|
|
257
|
+
## Decisions Log
|
|
258
|
+
> Locked decisions — record here when a significant architectural, technical, or approach decision is made. Do not re-debate entries in this log.
|
|
259
|
+
|
|
260
|
+
| Decision | Rationale | Phase |
|
|
261
|
+
|----------|-----------|-------|
|
|
262
|
+
| _(none yet)_ | | |
|
|
263
|
+
|
|
264
|
+
## Seeds
|
|
265
|
+
> Ideas and suggestions to revisit at the right time — not immediate work.
|
|
266
|
+
|
|
267
|
+
| Idea | When to revisit | Context |
|
|
268
|
+
|------|-----------------|---------|
|
|
269
|
+
| _(none yet)_ | | |
|
|
270
|
+
|
|
271
|
+
## Notes
|
|
272
|
+
_(ad-hoc notes that don't fit elsewhere)_
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
Infer sensible phases from the project description. Title the file `project-state.md`.
|
|
276
|
+
|
|
277
|
+
**If `has_codebase_scan = true`:** populate the `## Already Built` section from the `architecture.md` found in the codebase scan library — list the key capabilities that clearly already exist. Only plan phases for what is **not** in the Already Built list. If starting greenfield, remove the Already Built section entirely.
|
|
278
|
+
|
|
279
|
+
**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.
|
|
280
|
+
|
|
281
|
+
If no: set `planner_planned = false` and continue.
|
|
282
|
+
</step>
|
|
283
|
+
|
|
284
|
+
<step name="regression_agent_question">
|
|
285
|
+
Ask the user:
|
|
286
|
+
|
|
287
|
+
"Would you like a regression testing agent for this project? It will write E2E tests alongside every new feature so nothing you've built ever breaks silently."
|
|
288
|
+
|
|
289
|
+
Use AskUserQuestion:
|
|
290
|
+
- "Yes, add a regression testing agent"
|
|
291
|
+
- "No, skip"
|
|
292
|
+
|
|
293
|
+
If yes:
|
|
294
|
+
1. Add a "**[Project Name] Regression Tester**" agent to the creation plan. Its system prompt should:
|
|
295
|
+
- Know that every feature must include an E2E Playwright test as a required deliverable
|
|
296
|
+
- Know the test suite lives in `apps/web/e2e/` and tests run against `https://staging.contextium.io`
|
|
297
|
+
- Know the rule: a feature is not complete until its E2E test is written and the full regression suite passes on staging
|
|
298
|
+
- Be instructed to write focused, realistic tests using existing page selectors and routes — not generic placeholder tests
|
|
299
|
+
2. Store as `regression_agent_planned = true`.
|
|
300
|
+
|
|
301
|
+
3. Check if Playwright is already installed by running silently:
|
|
302
|
+
```bash
|
|
303
|
+
cd apps/web && npx playwright --version 2>/dev/null | grep -q "Version" && echo "installed" || echo "not-installed"
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
If not installed, ask:
|
|
307
|
+
|
|
308
|
+
"Playwright is required to run E2E tests. Would you like me to install it now?"
|
|
309
|
+
|
|
310
|
+
Use AskUserQuestion:
|
|
311
|
+
- "Yes, install Playwright"
|
|
312
|
+
- "No, I'll install it later"
|
|
313
|
+
|
|
314
|
+
If yes — install silently:
|
|
315
|
+
```bash
|
|
316
|
+
cd apps/web && npm install -D @playwright/test && npx playwright install chromium
|
|
317
|
+
```
|
|
318
|
+
Show `✓ Playwright installed` when done.
|
|
319
|
+
|
|
320
|
+
If no — store `playwright_install_pending = true` and add a note to the final summary:
|
|
321
|
+
`⚠ Playwright not installed — run the following before running E2E tests:`
|
|
322
|
+
` cd apps/web && npm install -D @playwright/test && npx playwright install chromium`
|
|
323
|
+
|
|
324
|
+
If no: set `regression_agent_planned = false` and continue.
|
|
325
|
+
</step>
|
|
326
|
+
|
|
327
|
+
<step name="create_resources">
|
|
328
|
+
Only create what the user confirmed across all steps. Create in this order: tag types → tags → libraries → skills → agents (including research, planner, and regression agents if confirmed).
|
|
329
|
+
|
|
330
|
+
Do NOT create a workflow in this step.
|
|
331
|
+
|
|
332
|
+
Show `✓ Created "Name"` for each item as it is created. Show `↗ Reusing "Name"` for each existing resource being included.
|
|
333
|
+
|
|
334
|
+
If `planner_planned = true`, create the project state file in Contextium after all other resources are created:
|
|
335
|
+
|
|
336
|
+
**CLI:**
|
|
337
|
+
```bash
|
|
338
|
+
cat << 'EOF' | contextium new <library-name> -t "[Project Name] — Project State" -p "project-state.md" --stdin -w <workspace>
|
|
339
|
+
<generated state content>
|
|
340
|
+
EOF
|
|
341
|
+
```
|
|
342
|
+
**MCP:** call mcp__contextium__create_file with the state content.
|
|
343
|
+
|
|
344
|
+
Show `✓ Created project state "project-state.md"` when done.
|
|
345
|
+
|
|
346
|
+
Suppress all errors silently — if something fails, skip it quietly and note it in the summary.
|
|
347
|
+
|
|
348
|
+
**CLI commands:**
|
|
349
|
+
```bash
|
|
350
|
+
contextium library create "<name>" --description "<description>" --workspace <slug>
|
|
351
|
+
contextium agent create "<name>" --workspace <slug>
|
|
352
|
+
contextium skill create "<name>" --workspace <slug>
|
|
353
|
+
contextium tag create "<value>" --type <type-slug> --workspace <slug>
|
|
354
|
+
contextium tag-type create "<name>" --workspace <slug>
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
**MCP:** use the corresponding create_* tools for each resource type.
|
|
358
|
+
</step>
|
|
359
|
+
|
|
360
|
+
<step name="workflow_prompt">
|
|
361
|
+
After all other resources are created, ask the user:
|
|
362
|
+
|
|
363
|
+
"Would you like me to create a workflow to bundle everything together for quick loading? If yes, what would you like to call it?"
|
|
364
|
+
|
|
365
|
+
Use AskUserQuestion with two options:
|
|
366
|
+
- "Yes, create a workflow" (and ask for the name as a follow-up if they say yes)
|
|
367
|
+
- "No, skip workflow"
|
|
368
|
+
|
|
369
|
+
If they say yes and provide a name, create the workflow:
|
|
370
|
+
|
|
371
|
+
**CLI:** `contextium workflow create "<name>" --workspace <slug>`
|
|
372
|
+
**MCP:** call mcp__contextium__create_workflow with the name and workspace.
|
|
373
|
+
|
|
374
|
+
Then automatically load it:
|
|
375
|
+
|
|
376
|
+
**CLI:** `contextium workflow load "<name>" --workspace <slug> 2>/dev/null`
|
|
377
|
+
**MCP:** call mcp__contextium__load_workflow with the workflow name and workspace.
|
|
378
|
+
|
|
379
|
+
If they say no, skip workflow creation and loading entirely.
|
|
380
|
+
</step>
|
|
381
|
+
|
|
382
|
+
<step name="post_workflow_actions">
|
|
383
|
+
This step only runs if `research_agent_planned = true` or `planner_planned = true`.
|
|
384
|
+
|
|
385
|
+
**If `research_agent_planned = true`:**
|
|
386
|
+
|
|
387
|
+
Ask the user:
|
|
388
|
+
|
|
389
|
+
"Would you like to start the research phase now? I can activate the [Project Name] Researcher and begin gathering information based on your project description."
|
|
390
|
+
|
|
391
|
+
Use AskUserQuestion:
|
|
392
|
+
- "Yes, start research now"
|
|
393
|
+
- "No, not yet"
|
|
394
|
+
|
|
395
|
+
If yes:
|
|
396
|
+
|
|
397
|
+
1. Ask the user:
|
|
398
|
+
|
|
399
|
+
"Do you have any reference URLs you'd like me to use as a starting point for research? Paste any links — documentation, competitor sites, articles, specs — and I'll include them."
|
|
400
|
+
|
|
401
|
+
Use AskUserQuestion:
|
|
402
|
+
- "Yes, here are my URLs: [user types them]"
|
|
403
|
+
- "No, start without references"
|
|
404
|
+
|
|
405
|
+
Store any URLs provided as `research_reference_urls`. If the user provides URLs, fetch each one with WebFetch before beginning research, and include the fetched content as source material for the research agent.
|
|
406
|
+
|
|
407
|
+
2. Activate the research agent — instruct it to begin researching based on the project description provided earlier, incorporating any reference URLs fetched in the previous step. Let it run and surface findings to the user. Do not proceed to the planning question.
|
|
408
|
+
|
|
409
|
+
If no: fall through to the planning question below (if applicable).
|
|
410
|
+
|
|
411
|
+
---
|
|
412
|
+
|
|
413
|
+
**If `planner_planned = true` (and research was either not created or the user said no to starting it):**
|
|
414
|
+
|
|
415
|
+
Ask the user:
|
|
416
|
+
|
|
417
|
+
"Would you like to plan the project now? The [Project Name] Planner can work through the project description and produce a detailed phase-by-phase plan."
|
|
418
|
+
|
|
419
|
+
Use AskUserQuestion:
|
|
420
|
+
- "Yes, start planning now"
|
|
421
|
+
- "No, I'll do it later"
|
|
422
|
+
|
|
423
|
+
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.
|
|
424
|
+
|
|
425
|
+
If no: continue to summary.
|
|
426
|
+
</step>
|
|
427
|
+
|
|
428
|
+
<step name="summary">
|
|
429
|
+
Show a clean final summary:
|
|
430
|
+
|
|
431
|
+
```
|
|
432
|
+
✓ Project ready
|
|
433
|
+
|
|
434
|
+
Workspace: <name>
|
|
435
|
+
Libraries: <list — new + reused>
|
|
436
|
+
Agents: <list — new + reused, or none>
|
|
437
|
+
Skills: <list — new + reused, or none>
|
|
438
|
+
Tags: <list, or none>
|
|
439
|
+
Workflow: <name> — loaded and ready (or "none" if skipped)
|
|
440
|
+
```
|
|
441
|
+
|
|
442
|
+
If anything failed to create, add a single line at the end:
|
|
443
|
+
`⚠ Could not create: <list of names> — you can add these manually.`
|
|
444
|
+
</step>
|
|
445
|
+
|
|
446
|
+
</process>
|
|
447
|
+
|
|
448
|
+
<rules>
|
|
449
|
+
- Never say "the wizard", "Contextium would like to know", or "the next step is"
|
|
450
|
+
- Never show raw bash output, API responses, or IDs to the user
|
|
451
|
+
- Run all checks and fetches silently — only surface progress labels and the final plan
|
|
452
|
+
- Only ask questions when genuinely needed — the description step and the confirmation step
|
|
453
|
+
- Do not ask the user what to create — figure it out from the description, then ask them to confirm
|
|
454
|
+
- Always create a "Project Architect" agent first, regardless of what the user described — tailor its system prompt to the specific project domain and goals
|
|
455
|
+
- If a resource already exists and is relevant, always prefer reuse over creating a duplicate
|
|
456
|
+
- The plan report must explain the reasoning for each item — not just list names
|
|
457
|
+
- Never create anything before the user confirms the plan
|
|
458
|
+
</rules>
|
|
459
|
+
|
|
460
|
+
<ongoing-project-rules>
|
|
461
|
+
These rules apply for the duration of the project, after setup is complete.
|
|
462
|
+
|
|
463
|
+
**New suggestions and feature ideas**
|
|
464
|
+
- 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?"
|
|
465
|
+
- 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.
|
|
466
|
+
- If no: note it and continue with the current work
|
|
467
|
+
- Seeds are NOT immediate work — never promote a seed to a phase without the user asking
|
|
468
|
+
|
|
469
|
+
**Decision locking**
|
|
470
|
+
- 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.
|
|
471
|
+
- 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
|
|
472
|
+
- 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
|
|
473
|
+
- Never ask the user's permission to log a decision — just do it silently and mention it in the phase summary
|
|
474
|
+
|
|
475
|
+
**Tackling a new feature or phase**
|
|
476
|
+
- When the user is ready to start work on a new feature or area of the project:
|
|
477
|
+
1. Update `## Current Position` in `project-state.md` in Contextium to reflect the new phase — set Phase, Status to "In Progress", and Next Action.
|
|
478
|
+
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
|
|
479
|
+
3. Ask: "Would you like a phased plan for this?" — if a planner agent exists, use it; otherwise offer to create one
|
|
480
|
+
- If the user says no to both, continue directly using existing agents — no extra setup needed
|
|
481
|
+
- Treat each new feature as its own mini-project using existing workspace resources — never create duplicate agents or skills if suitable ones already exist
|
|
482
|
+
|
|
483
|
+
**Suggesting new agents and skills**
|
|
484
|
+
- 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
|
|
485
|
+
- Never create new agents or skills without the user's confirmation
|
|
486
|
+
- Always check existing workspace resources before suggesting something new
|
|
487
|
+
|
|
488
|
+
**Session usage check at end of every phase**
|
|
489
|
+
- At the end of every completed phase, check the current session context usage (visible in the Claude Code status bar as a percentage)
|
|
490
|
+
- If usage is **above 50%**, do the following automatically before prompting the user to continue:
|
|
491
|
+
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.
|
|
492
|
+
2. Tell the user:
|
|
493
|
+
|
|
494
|
+
```
|
|
495
|
+
⚠ Session is above 50% — recommended to start a fresh session before the next phase.
|
|
496
|
+
|
|
497
|
+
Project state has been saved to your Contextium library.
|
|
498
|
+
Run /ium:resume-project to pick up exactly where you left off.
|
|
499
|
+
```
|
|
500
|
+
|
|
501
|
+
- 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
|
|
502
|
+
- Never skip this check at phase end — even if the user seems eager to continue
|
|
503
|
+
|
|
504
|
+
**Multi-project rule**
|
|
505
|
+
- 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.
|
|
506
|
+
- 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.
|
|
507
|
+
|
|
508
|
+
**Project completion — output documents**
|
|
509
|
+
- When all phases in `project-state.md` are marked "Complete", automatically trigger the following:
|
|
510
|
+
1. Congratulate the user, then ask: "All phases are complete — great work! Would you like me to generate any of the following documents from your project state?"
|
|
511
|
+
|
|
512
|
+
Present these options (allow multiple selections):
|
|
513
|
+
- **Product Feature Document** — a clear summary of what was built, the capabilities delivered, and the decisions made. Aimed at internal teams and stakeholders.
|
|
514
|
+
- **Product Requirements Document (PRD)** — a structured requirements doc covering goals, user needs, scope, and feature definitions. Useful for future development or handoffs.
|
|
515
|
+
- **Product Marketing Document** — a sales-oriented document that frames the product in terms of value, audience, pain points solved, and key differentiators. Aimed at external communication and go-to-market use.
|
|
516
|
+
- **None, leave as-is**
|
|
517
|
+
|
|
518
|
+
2. For each document type selected, check the current workspace for an existing agent that can produce it:
|
|
519
|
+
- Look for agents with names or system prompts suggesting they handle product writing, technical writing, marketing copy, or PRD generation
|
|
520
|
+
- If a suitable agent exists: activate it and instruct it to generate the document using the project state, Decisions Log, and phase history
|
|
521
|
+
- If no suitable agent exists: offer to create one — e.g. "I don't see a product writing agent in this workspace. Shall I create a **Product Writer** agent to generate this for you?" — wait for confirmation before creating
|
|
522
|
+
|
|
523
|
+
3. For each document generated:
|
|
524
|
+
- Save it to the project library in Contextium using a clear filename:
|
|
525
|
+
- `product-feature-doc.md` for the Feature Document
|
|
526
|
+
- `prd.md` for the PRD
|
|
527
|
+
- `product-marketing-doc.md` for the Marketing Document
|
|
528
|
+
- Show `✓ Saved "[filename]" to [library name]` when done
|
|
529
|
+
|
|
530
|
+
4. If any new agents were created to generate documents, ask: "Would you like to add these agents to your workflow so they're available in future sessions?" — if yes, add them to the workflow using the CLI or MCP tools.
|
|
531
|
+
|
|
532
|
+
5. After all selected documents are generated, leave `project-state.md` intact — do not delete or overwrite it.
|
|
533
|
+
|
|
534
|
+
- Never generate documents automatically without asking — always get confirmation first
|
|
535
|
+
- If the user selects "None, leave as-is": congratulate them and close out the session
|
|
536
|
+
</ongoing-project-rules>
|