@contextium/cli
Advanced tools
| import { Command } from 'commander'; | ||
| export declare const loadSkillCommand: Command; | ||
| //# sourceMappingURL=load-skill.d.ts.map |
| {"version":3,"file":"load-skill.d.ts","sourceRoot":"","sources":["../../src/commands/load-skill.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAQnC,eAAO,MAAM,gBAAgB,SA6BzB,CAAA"} |
| import { Command } from 'commander'; | ||
| import fs from 'fs/promises'; | ||
| import path from 'path'; | ||
| import { fileURLToPath } from 'url'; | ||
| import { chalk } from '../lib/output.js'; | ||
| const __dirname = path.dirname(fileURLToPath(import.meta.url)); | ||
| export const loadSkillCommand = new Command('load-skill') | ||
| .description('Output bundled Contextium CLI SKILL.md for local agent context loading') | ||
| .option('--format <format>', 'Output format (text|json)', 'text') | ||
| .option('--name <name>', 'Skill name to load', 'contextium-cli') | ||
| .action(async (options) => { | ||
| try { | ||
| if (options.name !== 'contextium-cli') { | ||
| console.log(chalk.red(`Unknown skill '${options.name}'.`)); | ||
| console.log(chalk.dim('Available skills: contextium-cli')); | ||
| process.exit(1); | ||
| } | ||
| const skillPath = path.join(__dirname, '..', '..', 'skills', 'ium', 'SKILL.md'); | ||
| const content = await fs.readFile(skillPath, 'utf-8'); | ||
| if (options.format === 'json') { | ||
| console.log(JSON.stringify({ | ||
| name: 'contextium-cli', | ||
| source: 'skills/ium/SKILL.md', | ||
| content, | ||
| }, null, 2)); | ||
| return; | ||
| } | ||
| console.log(content); | ||
| } | ||
| catch (error) { | ||
| console.log(chalk.red(`Failed to load skill: ${error.message}`)); | ||
| process.exit(1); | ||
| } | ||
| }); | ||
| //# sourceMappingURL=load-skill.js.map |
| {"version":3,"file":"load-skill.js","sourceRoot":"","sources":["../../src/commands/load-skill.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,MAAM,aAAa,CAAA;AAC5B,OAAO,IAAI,MAAM,MAA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,CAAC,CAAA;YACZ,OAAM;QACR,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;IACtB,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,yBAAyB,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAA;QAChE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACjB,CAAC;AACH,CAAC,CAAC,CAAA"} |
| --- | ||
| name: ium:new-project-legacy | ||
| description: Legacy new-project setup flow (deprecated; kept for reference) | ||
| allowed-tools: | ||
| - Bash | ||
| - mcp__contextium__list_workspaces | ||
| - mcp__contextium__create_context_library | ||
| - mcp__contextium__list_context_libraries | ||
| - mcp__contextium__create_agent | ||
| - mcp__contextium__list_agents | ||
| - mcp__contextium__create_skill | ||
| - mcp__contextium__list_skills | ||
| - mcp__contextium__create_workflow | ||
| - mcp__contextium__list_workflows | ||
| - mcp__contextium__list_tags | ||
| - mcp__contextium__list_tag_types | ||
| - mcp__contextium__create_tag | ||
| - mcp__contextium__create_tag_type | ||
| - AskUserQuestion | ||
| --- | ||
| <objective> | ||
| 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. | ||
| </objective> | ||
| <mode-detection> | ||
| Run this once at the start, silently, to determine which mode to use for the entire session: | ||
| ```bash | ||
| command -v contextium &>/dev/null && echo "cli" || echo "no-cli" | ||
| ``` | ||
| - If `cli`: use CLI commands throughout. Do not attempt MCP tools. | ||
| - If `no-cli`: check if mcp__contextium__list_workspaces is available. If yes, use MCP tools throughout. | ||
| - 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. | ||
| Do not mention the mode to the user. Pick one path and stick with it. | ||
| </mode-detection> | ||
| <process> | ||
| <step name="check_auth"> | ||
| **CLI only.** Run silently: | ||
| ```bash | ||
| contextium whoami 2>/dev/null | grep -E "Token:|Name:" || echo "unauthenticated" | ||
| ``` | ||
| 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. | ||
| MCP users are already authenticated via the server connection — skip this step. | ||
| </step> | ||
| <step name="select_workspace"> | ||
| **CLI:** run `contextium workspace list 2>/dev/null` silently, parse workspace names. | ||
| **MCP:** call mcp__contextium__list_workspaces silently. | ||
| Ask: "Which workspace is this project for?" | ||
| Present names only — no IDs, no raw output. | ||
| </step> | ||
| <step name="project_description"> | ||
| Ask the user this question exactly: | ||
| "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." | ||
| Wait for their response. Store it as the project description. Do not proceed until you have a meaningful answer. | ||
| </step> | ||
| <step name="quiet_analysis"> | ||
| Silently fetch all existing workspace resources. Do not show raw output or errors. Show only these progress lines as you go: | ||
| ``` | ||
| Searching libraries... | ||
| Searching agents... | ||
| Searching skills... | ||
| Searching tags... | ||
| ``` | ||
| **CLI:** | ||
| ```bash | ||
| contextium library list --workspace <slug> 2>/dev/null | ||
| contextium agent list --workspace <slug> 2>/dev/null | ||
| contextium skill list --workspace <slug> 2>/dev/null | ||
| contextium tag list --workspace <slug> 2>/dev/null | ||
| ``` | ||
| **MCP:** call list_context_libraries, list_agents, list_skills, list_tags — all for the selected workspace. Suppress any errors silently. | ||
| After all four searches complete, output this line: | ||
| ``` | ||
| Creating Contextium setup plan... | ||
| ``` | ||
| Then analyse the results against the project description: | ||
| - Which existing libraries (if any) are relevant to what the user described? | ||
| - Which existing agents (if any) could serve this project? | ||
| - Which existing skills (if any) are applicable? | ||
| - Which existing tags/tag types (if any) relate to the topics mentioned? | ||
| Internally categorise everything as: **reuse** (relevant, already exists) or **create** (needed, does not exist). | ||
| </step> | ||
| <step name="intelligent_plan"> | ||
| Based on the project description and the analysis, build a setup plan. Think through: | ||
| **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. | ||
| **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. | ||
| **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. | ||
| **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`). | ||
| **Workflow:** Propose one workflow name that bundles everything together for quick loading. | ||
| Present the plan in this format (omit any section that has nothing in it): | ||
| --- | ||
| Here's what I'll set up for you: | ||
| **New libraries to create** | ||
| - "Library Name" — reason why this is needed | ||
| **Existing libraries to reuse** | ||
| - "Library Name" — why it's relevant | ||
| **New agents to create** | ||
| - "Agent Name" — what it will do for this project | ||
| **Existing agents to reuse** | ||
| - "Agent Name" — why it fits | ||
| **New skills to create** | ||
| - "Skill Name" — what knowledge it will hold | ||
| **Existing skills to reuse** | ||
| - "Skill Name" — why it fits | ||
| **Tags to create** | ||
| - `category:value` — why this label is useful | ||
| **Workflow** | ||
| - "Workflow Name" — bundles everything above for quick loading | ||
| Shall I go ahead and create all of this? | ||
| --- | ||
| Wait for the user to confirm, adjust, or say skip on any item before proceeding. | ||
| </step> | ||
| <step name="create_resources"> | ||
| Only create what the user confirmed. Create in this order: tag types → tags → libraries → skills → agents → workflow. | ||
| Show `✓ Created "Name"` for each item as it is created. Show `↗ Reusing "Name"` for each existing resource being included. | ||
| Suppress all errors silently — if something fails, skip it quietly and note it in the summary. | ||
| **CLI commands:** | ||
| ```bash | ||
| contextium library create "<name>" --workspace <slug> | ||
| contextium agent create "<name>" --workspace <slug> | ||
| contextium skill create "<name>" --workspace <slug> | ||
| contextium workflow create "<name>" --workspace <slug> | ||
| contextium tag create "<value>" --type <type-slug> --workspace <slug> | ||
| contextium tag-type create "<name>" --workspace <slug> | ||
| ``` | ||
| **MCP:** use the corresponding create_* tools for each resource type. | ||
| </step> | ||
| <step name="load_workflow"> | ||
| After all resources are created, automatically load the workflow without asking the user. Run silently: | ||
| **CLI:** `contextium workflow load "<workflow-name>" --workspace <slug> 2>/dev/null` | ||
| **MCP:** call mcp__contextium__load_workflow with the workflow name and workspace. | ||
| Do not tell the user to load it themselves — just load it as part of setup. | ||
| </step> | ||
| <step name="summary"> | ||
| Show a clean final summary: | ||
| ``` | ||
| ✓ Project ready | ||
| Workspace: <name> | ||
| Libraries: <list — new + reused> | ||
| Agents: <list — new + reused, or none> | ||
| Skills: <list — new + reused, or none> | ||
| Tags: <list, or none> | ||
| Workflow: <name> — loaded and ready | ||
| ``` | ||
| If anything failed to create, add a single line at the end: | ||
| `⚠ Could not create: <list of names> — you can add these manually.` | ||
| </step> | ||
| </process> | ||
| <rules> | ||
| - Never say "the wizard", "Contextium would like to know", or "the next step is" | ||
| - Never show raw bash output, API responses, or IDs to the user | ||
| - Run all checks and fetches silently — only surface progress labels and the final plan | ||
| - Only ask questions when genuinely needed — the description step and the confirmation step | ||
| - Do not ask the user what to create — figure it out from the description, then ask them to confirm | ||
| - If a resource already exists and is relevant, always prefer reuse over creating a duplicate | ||
| - The plan report must explain the reasoning for each item — not just list names | ||
| - Never create anything before the user confirms the plan | ||
| </rules> |
| --- | ||
| name: contextium-cli | ||
| summary: Concise command reference for the Contextium CLI. Use exact commands and flags shown here. | ||
| allowed-tools: | ||
| - Bash(contextium *) | ||
| --- | ||
| # Contextium CLI Quick Skill | ||
| Use this file when orchestrating the local `contextium` CLI. | ||
| ## Core Rules | ||
| - Workspace-scoped commands should include `-w <workspace-name-or-slug>`. | ||
| - Use `workspaces` (plural), `libraries` (plural), and grouped subcommands like `agents list`. | ||
| - Load workflows with `contextium workflow "<name>" -w <workspace>`. | ||
| ## Command Map (Short) | ||
| | Command | What it does | Example | | ||
| |---|---|---| | ||
| | `contextium login` | Sign in with Entra auth. | `contextium login` | | ||
| | `contextium logout` | Clear local auth token. | `contextium logout` | | ||
| | `contextium whoami` | Show account + token status. | `contextium whoami` | | ||
| | `contextium init --api-key <key> -w <ws>` | Initialize `.contextiumrc`. | `contextium init --api-key $CTX_KEY -w cloudvoice` | | ||
| | `contextium setup-claude [--global|--project]` | Configure Claude Code permission + slash commands. | `contextium setup-claude --project` | | ||
| | `contextium workspaces` | List accessible workspaces. | `contextium workspaces` | | ||
| | `contextium libraries -w <ws>` | List context libraries in workspace. | `contextium libraries -w cloudvoice` | | ||
| | `contextium files <library> -w <ws>` | List files in a library. | `contextium files "02-retention-intel" -w cloudvoice` | | ||
| | `contextium structure <library> -w <ws>` | Show folder/file tree in a library. | `contextium structure "Knowledgebase" -w cloudvoice` | | ||
| | `contextium find <name> -w <ws>` | Find files by filename. | `contextium find "retention" -w cloudvoice` | | ||
| | `contextium cat --all -w <ws>` | Print workspace file contents. | `contextium cat --all -w cloudvoice` | | ||
| | `contextium cat "<file>" -w <ws>` | Print specific file content. | `contextium cat "Q2 Save Offers" -w cloudvoice --no-cache` | | ||
| | `contextium search "<query>" -w <ws>` | Full-text search docs. | `contextium search "churn" -w cloudvoice --limit 10` | | ||
| | `contextium sync -w <ws>` | Refresh local cache from workspace. | `contextium sync -w cloudvoice` | | ||
| | `contextium status -w <ws>` | Show cache/sync status. | `contextium status -w cloudvoice` | | ||
| | `contextium create-library -w <ws> -n <name>` | Create context library. | `contextium create-library -w cloudvoice -n "06-playbooks"` | | ||
| | `contextium update-library <library> -w <ws>` | Rename/update library metadata. | `contextium update-library "06-playbooks" -w cloudvoice -d "Sales playbooks"` | | ||
| | `contextium new <library> -t <title> -p <path> -c <content> -w <ws>` | Create a file in library. | `contextium new "06-playbooks" -t "Winback" -p winback.md -c "# Winback" -w cloudvoice` | | ||
| | `contextium edit <fileId> -c <content> [-m <msg>] [--version]` | Update file content/metadata. | `contextium edit <fileId> -c "# Updated" -m "refresh" --version` | | ||
| | `contextium delete <fileId> --confirm` | Soft-delete a file. | `contextium delete <fileId> --confirm` | | ||
| | `contextium versions <fileId>` | Show file version history. | `contextium versions <fileId>` | | ||
| | `contextium agents list -w <ws>` | List agents. | `contextium agents list -w cloudvoice` | | ||
| | `contextium agents create -w <ws> -n <name>` | Create agent. | `contextium agents create -w cloudvoice -n "Retention Agent"` | | ||
| | `contextium agents update -w <ws> -a <agent> ...` | Update agent fields. | `contextium agents update -w cloudvoice -a "Retention Agent" -d "Daily scripts"` | | ||
| | `contextium agents add-skill -w <ws> -a <agent> -s <skill>` | Attach skill to agent. | `contextium agents add-skill -w cloudvoice -a "Retention Agent" -s "Call Guidelines"` | | ||
| | `contextium agents remove-skill -w <ws> -a <agent> -s <skill>` | Detach skill from agent. | `contextium agents remove-skill -w cloudvoice -a "Retention Agent" -s "Call Guidelines"` | | ||
| | `contextium skills list -w <ws>` | List skills (Skills Library files). | `contextium skills list -w cloudvoice` | | ||
| | `contextium skills create -w <ws> -n <name> [-c <md>]` | Create skill doc. | `contextium skills create -w cloudvoice -n "Objection Handling"` | | ||
| | `contextium tags types -w <ws>` | List tag types. | `contextium tags types -w cloudvoice` | | ||
| | `contextium tags create-type -w <ws> -n <name>` | Create tag type. | `contextium tags create-type -w cloudvoice -n Topic` | | ||
| | `contextium tags list -w <ws>` | List tags. | `contextium tags list -w cloudvoice` | | ||
| | `contextium tags create -w <ws> -t <type> -v <value>` | Create tag. | `contextium tags create -w cloudvoice -t topic -v retention` | | ||
| | `contextium tags apply -w <ws> -t <tag> -f <fileId>` | Apply tag to one file. | `contextium tags apply -w cloudvoice -t topic:retention -f <fileId>` | | ||
| | `contextium tags apply-bulk -w <ws> -t <tag> -f <id1,id2>` | Apply tag to many files. | `contextium tags apply-bulk -w cloudvoice -t topic:retention -f <id1,id2>` | | ||
| | `contextium tags remove -w <ws> -t <tag> -f <fileId>` | Remove tag from file. | `contextium tags remove -w cloudvoice -t topic:retention -f <fileId>` | | ||
| | `contextium tags search -w <ws> -t <tag1,tag2>` | Find files by tags. | `contextium tags search -w cloudvoice -t topic:retention` | | ||
| | `contextium tags file-tags -w <ws> -f <fileId>` | List tags on a file. | `contextium tags file-tags -w cloudvoice -f <fileId>` | | ||
| | `contextium tags update -w <ws> -t <tag> ...` | Update tag value/type/color. | `contextium tags update -w cloudvoice -t topic:retention -c "#22c55e"` | | ||
| | `contextium tags type-get -w <ws> -t <type>` | Show one tag type. | `contextium tags type-get -w cloudvoice -t topic` | | ||
| | `contextium tags type-update -w <ws> -t <type> ...` | Update tag type. | `contextium tags type-update -w cloudvoice -t topic -n "Topic Area"` | | ||
| | `contextium workflows list -w <ws>` | List workflows. | `contextium workflows list -w cloudvoice` | | ||
| | `contextium workflows create -w <ws> -n <name> [--agents ... --skills ... --libraries ...]` | Create workflow bundle. | `contextium workflows create -w cloudvoice -n "Daily Retention Prep" --agents "Retention Agent" --libraries "02-retention-intel"` | | ||
| | `contextium workflows update -w <ws> --id <workflow>` | Update workflow config. | `contextium workflows update -w cloudvoice --id "Daily Retention Prep" --tags topic:retention` | | ||
| | `contextium workflow "<name>" -w <ws> [--sync]` | Load workflow and show connected resources. | `contextium workflow "Daily Retention Prep" -w cloudvoice --sync` | | ||
| | `contextium marketplace list` | Browse marketplace listings. | `contextium marketplace list --query retention` | | ||
| | `contextium marketplace show <slug>` | Show listing details. | `contextium marketplace show code-review-assistant` | | ||
| | `contextium marketplace install <slug> -w <ws>` | Install listing into workspace. | `contextium marketplace install code-review-assistant -w cloudvoice` | | ||
| | `contextium load-skill` | Print this skill file for agent context injection. | `contextium load-skill` | | ||
| ## Fast Patterns | ||
| - Load ready-to-use context: `contextium workflow "<name>" -w <ws> --sync` | ||
| - Pull one source doc: `contextium cat "<file-title>" -w <ws> --no-cache` | ||
| - Build from scratch: `create-library` → `new` → `skills create` → `agents create` → `workflows create` |
+4
-1
@@ -19,2 +19,3 @@ #!/usr/bin/env node | ||
| import { setupCommand } from './commands/setup.js'; | ||
| import { loadSkillCommand } from './commands/load-skill.js'; | ||
| import { tagsCommand } from './commands/tags.js'; | ||
@@ -42,3 +43,3 @@ import { agentsCommand } from './commands/agents.js'; | ||
| Auth: login, logout, whoami | ||
| Setup: setup, init, setup-claude | ||
| Setup: setup, init, setup-claude, load-skill | ||
| Browse: workspaces, libraries, files, find, structure | ||
@@ -74,2 +75,3 @@ Content: cat, search, sync, status | ||
| contextium marketplace install code-review-assistant -w my-ws Install listing | ||
| contextium load-skill Output bundled SKILL.md | ||
@@ -90,2 +92,3 @@ Note: All workspace-scoped commands accept -w, --workspace <name|slug>. | ||
| program.addCommand(setupClaudeCommand); | ||
| program.addCommand(loadSkillCommand); | ||
| // Data commands | ||
@@ -92,0 +95,0 @@ program.addCommand(workspacesCommand); |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AACxD,OAAO,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":3,"file":"claude-permissions.d.ts","sourceRoot":"","sources":["../../src/lib/claude-permissions.ts"],"names":[],"mappings":"AAWA,wBAAgB,eAAe,CAAC,KAAK,EAAE,QAAQ,GAAG,SAAS,GAAG,MAAM,CAInE;AAED,wBAAsB,4BAA4B,CAAC,KAAK,GAAE,QAAQ,GAAG,SAAoB,GAAG,OAAO,CAAC,OAAO,CAAC,CAQ3G;AAED,wBAAsB,mBAAmB,CAAC,KAAK,EAAE,QAAQ,GAAG,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAoBpF;AAED,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC,CAkCvD;AAED,wBAAsB,qBAAqB,IAAI,OAAO,CAAC,IAAI,CAAC,CAsB3D"} | ||
| {"version":3,"file":"claude-permissions.d.ts","sourceRoot":"","sources":["../../src/lib/claude-permissions.ts"],"names":[],"mappings":"AAWA,wBAAgB,eAAe,CAAC,KAAK,EAAE,QAAQ,GAAG,SAAS,GAAG,MAAM,CAInE;AAED,wBAAsB,4BAA4B,CAAC,KAAK,GAAE,QAAQ,GAAG,SAAoB,GAAG,OAAO,CAAC,OAAO,CAAC,CAQ3G;AAED,wBAAsB,mBAAmB,CAAC,KAAK,EAAE,QAAQ,GAAG,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAoBpF;AAED,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC,CAkCvD;AAED,wBAAsB,qBAAqB,IAAI,OAAO,CAAC,IAAI,CAAC,CAwB3D"} |
@@ -95,5 +95,7 @@ import fs from 'fs/promises'; | ||
| } | ||
| settings.statusLine = { type: 'command', command: `node "${statuslineDestPath}"` }; | ||
| await fs.writeFile(settingsPath, JSON.stringify(settings, null, 2) + '\n', 'utf-8'); | ||
| if (!settings.statusLine) { | ||
| settings.statusLine = { type: 'command', command: `node "${statuslineDestPath}"` }; | ||
| await fs.writeFile(settingsPath, JSON.stringify(settings, null, 2) + '\n', 'utf-8'); | ||
| } | ||
| } | ||
| //# sourceMappingURL=claude-permissions.js.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"claude-permissions.js","sourceRoot":"","sources":["../../src/lib/claude-permissions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,aAAa,CAAA;AAC5B,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EAAE,MAAM,IAAI,CAAA;AACnB,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAA;AAEnC,MAAM,UAAU,GAAG,mBAAmB,CAAA;AACtC,MAAM,aAAa,GAAG,qBAAqB,CAAA;AAC3C,MAAM,mBAAmB,GAAG,mBAAmB,CAAA;AAC/C,oEAAoE;AACpE,MAAM,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,CAAA;AAElG,MAAM,UAAU,eAAe,CAAC,KAA2B;IACzD,OAAO,KAAK,KAAK,QAAQ;QACvB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,eAAe,CAAC;QACrD,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,eAAe,CAAC,CAAA;AAC1D,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,4BAA4B,CAAC,QAA8B,QAAQ;IACvF,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,eAAe,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,CAAA;QAClE,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;QACpC,OAAO,QAAQ,EAAE,WAAW,EAAE,KAAK,EAAE,QAAQ,CAAC,UAAU,CAAC,KAAK,IAAI,CAAA;IACpE,CAAC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5B,MAAM,EAAE,CAAC,KAAK,CAAC,YAAY,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAA;IACjD,MAAM,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,mBAAmB,CAAC,EAAE,kBAAkB,CAAC,CAAA;IAEpF,wEAAwE;IACxE,MAAM,YAAY,GAAG,eAAe,CAAC,QAAQ,CAAC,CAAA;IAC9C,MAAM,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAA;IAE/D,IAAI,QAAQ,GAAQ,EAAE,CAAA;IACtB,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC,CAAA;QACxD,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;IAChC,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ;YAAE,MAAM,KAAK,CAAA;IAC1C,CAAC;IAED,IAAI,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAC;QACzB,QAAQ,CAAC,UAAU,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,kBAAkB,GAAG,EAAE,CAAA;QAClF,MAAM,EAAE,CAAC,SAAS,CAAC,YAAY,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,EAAE,OAAO,CAAC,CAAA;IACrF,CAAC;AACH,CAAC"} |
+1
-1
| { | ||
| "name": "@contextium/cli", | ||
| "version": "1.0.18", | ||
| "version": "1.0.19", | ||
| "description": "Command-line tool for managing Contextium documentation, agents, skills, and workflows — pipe context to AI coding assistants", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -20,6 +20,2 @@ --- | ||
| GETTING STARTED | ||
| /ium:scan-existing Scan an existing codebase and write analysis docs to | ||
| Contextium — stack, architecture, conventions, concerns. | ||
| Run this before /ium:new-project on existing projects. | ||
| /ium:new-project Set up a new Contextium project from scratch — | ||
@@ -39,4 +35,2 @@ auth, workspace, libraries, agents, skills, workflow | ||
| /ium:workflow Load a workflow and sync its resources into context | ||
| /ium:resume-project Resume a project from a session handoff — picks up | ||
| exactly where you left off in the project plan | ||
@@ -43,0 +37,0 @@ MARKETPLACE |
+0
-11
@@ -13,13 +13,2 @@ --- | ||
| <process> | ||
| **Step 1 — Check loaded context first** | ||
| 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. | ||
| **Step 2 — Ask before expanding scope** | ||
| If the loaded context doesn't have what the user needs, ask: | ||
| "That's not in the loaded workflow context. Would you like me to search the full workspace?" | ||
| Only proceed to step 3 after the user confirms. | ||
| **Step 3 — Search the full workspace** | ||
| Run a search across the workspace: | ||
@@ -26,0 +15,0 @@ |
@@ -32,21 +32,5 @@ --- | ||
| 4. Persist the loaded workspace and workflow to `.contextiumrc` so it can be auto-restored after `/clear`: | ||
| 4. 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: | ||
| ```bash | ||
| node -e " | ||
| try { | ||
| const fs = require('fs'); | ||
| const rc = JSON.parse(fs.readFileSync('.contextiumrc', 'utf8')); | ||
| rc.last_workflow = '<workflow-name>'; | ||
| rc.last_workspace = '<workspace-slug-or-name>'; | ||
| fs.writeFileSync('.contextiumrc', JSON.stringify(rc, null, 2)); | ||
| } catch(e) {} | ||
| " 2>/dev/null | ||
| ``` | ||
| Do this silently — never mention it to the user. | ||
| 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: | ||
| ``` | ||
| --- WORKFLOW SESSION CONTEXT --- | ||
@@ -82,11 +66,2 @@ Workflow: <name> | ||
| - Only surface the final answer or the created/updated content to the user | ||
| **Scope rules — what is "available":** | ||
| - 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. | ||
| - 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. | ||
| **Search order:** | ||
| 1. Check the loaded session context first | ||
| 2. If not found there, say: "That's not in the loaded workflow. Would you like me to search the full workspace?" | ||
| 3. Only query the full workspace after the user confirms | ||
| </session-rules> |
+10
-11
@@ -16,13 +16,12 @@ --- | ||
| <step name="show_current"> | ||
| Silently fetch the current workspace and available workspaces: | ||
| Show the current workspace and list available workspaces: | ||
| ```bash | ||
| cat .contextiumrc 2>/dev/null | ||
| # Show current workspace from .contextiumrc | ||
| cat .contextiumrc 2>/dev/null | grep -E "workspace" | head -5 || echo "No .contextiumrc found" | ||
| # List all available workspaces | ||
| contextium workspaces | ||
| ``` | ||
| **CLI:** `contextium workspaces 2>/dev/null` | ||
| **MCP:** call mcp__contextium__list_workspaces | ||
| Parse the results internally — extract names and slugs only. Never show IDs, UUIDs, or raw command output to the user. | ||
| Display clearly: | ||
@@ -33,8 +32,8 @@ ``` | ||
| Available workspaces: | ||
| 1. Workspace A | ||
| 2. Workspace B | ||
| 3. Workspace C | ||
| 1. workspace-a | ||
| 2. workspace-b | ||
| 3. workspace-c | ||
| ``` | ||
| 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. | ||
| 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. | ||
| </step> | ||
@@ -41,0 +40,0 @@ |
| --- | ||
| name: ium:contextium | ||
| description: General behaviour rules for the Contextium MCP and CLI — scoping, lookup order, and workspace awareness | ||
| --- | ||
| # Contextium — General Behaviour Rules | ||
| These rules apply whenever the Contextium MCP is connected or the CLI is in use, regardless of which slash command was run. | ||
| ## Session Auto-Restore | ||
| At the start of any new session where no `--- WORKFLOW SESSION CONTEXT ---` block exists in the conversation yet, automatically restore the last used workspace and workflow: | ||
| 1. Silently check `.contextiumrc`: | ||
| ```bash | ||
| cat .contextiumrc 2>/dev/null | ||
| ``` | ||
| 2. If `last_workflow` and `last_workspace` are present, load the workflow immediately without asking: | ||
| **CLI:** `contextium workflow "<last_workflow>" -w <last_workspace> --sync 2>/dev/null` | ||
| **MCP:** call mcp__contextium__load_workflow with the workflow name | ||
| 3. Output the session context block as normal. Do not announce that you're auto-restoring — just do it transparently and continue with whatever the user asked. | ||
| 4. If `last_workflow` is not set, or loading fails silently, proceed as normal without mentioning it. | ||
| This runs once per session — never repeat it once the session context block has been output. | ||
| --- | ||
| ## Scope Rules | ||
| ### If a workflow has been loaded in this session | ||
| A workflow is loaded when a `--- WORKFLOW SESSION CONTEXT ---` block has been output in the conversation. | ||
| - Answer all questions about available agents, skills, and libraries **from that session context block only** | ||
| - Do NOT call `list_agents`, `list_skills`, `list_context_libraries`, or any other listing tool to answer "what's available?" questions | ||
| - If the user asks about something not in the session context, say so clearly — do not silently fall back to a full workspace query | ||
| ### If no workflow has been loaded | ||
| Answer from whatever has been explicitly loaded or cat'd into the session. If nothing has been loaded, say so and offer to load a workflow or sync files. | ||
| ## Lookup Order | ||
| Before querying the full workspace for anything (search, find, list), follow this order: | ||
| 1. **Check loaded session context first** — agents, skills, libraries, and files already in context | ||
| 2. **If not found, ask** — "That's not in the loaded context. Would you like me to search the full workspace?" | ||
| 3. **Only query the full workspace after the user confirms** | ||
| Never silently expand scope to the full workspace. Always make it explicit and get confirmation first. | ||
| ## Data Model | ||
| ``` | ||
| Workspace | ||
| ├── Context Libraries ← containers for documentation files | ||
| │ └── Files | ||
| ├── Skills ← reusable instruction documents | ||
| ├── Agents ← roles combining a system prompt + skills | ||
| └── Workflows ← bind an agent + skills + libraries for a task | ||
| ``` | ||
| | Ask yourself | Use | | ||
| |---|---| | ||
| | Storing content, data, or docs? | Context Library + Files | | ||
| | Reusable how-to instructions? | Skill | | ||
| | A role combining multiple skills? | Agent | | ||
| | Ready-to-use context package for a task? | Workflow | | ||
| ## Contextium Is the Source of Truth | ||
| 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. | ||
| 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. | ||
| 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. | ||
| ## Multi-Project Rule | ||
| Each project must have its own dedicated context library. Never mix two projects into one library. | ||
| 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. | ||
| ## Decision Routing | ||
| 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. | ||
| A decision qualifies if it: | ||
| - Picks a technology or library | ||
| - Sets an API contract or data model | ||
| - Establishes a pattern future phases will depend on | ||
| - Rules out an approach that was considered | ||
| 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. | ||
| ## File Routing — Writing Files When Contextium Is Connected | ||
| 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: | ||
| > "Should this file go to a Contextium context library, or stay local?" | ||
| **If a workflow is loaded in this session:** | ||
| - Default to suggesting the most relevant library from the session context block | ||
| - Offer: `[1] Write to "<library name>" in Contextium [2] Keep local` | ||
| - If the user picks Contextium, use `mcp__contextium__create_file` or `contextium files create` CLI with the library ID from session context — do NOT write it locally | ||
| **If no workflow is loaded but the MCP/CLI is active:** | ||
| - Ask: "Should this go to Contextium? If yes, which library?" | ||
| - List available libraries only if the user says yes | ||
| - Otherwise write locally as normal | ||
| **Files that should NEVER be routed to Contextium — always write locally:** | ||
| - Rich text formats: `.docx`, `.doc`, `.pdf`, `.rtf`, `.odt`, `.pages`, `.pptx`, `.xlsx`, and any binary or formatted document | ||
| - Source code files (`.ts`, `.tsx`, `.js`, `.py`, etc.) | ||
| - Config files (`package.json`, `.env`, `tsconfig.json`, etc.) | ||
| - Git-tracked project files in general | ||
| **Files that SHOULD be offered for Contextium routing (plain text / non-rich text only):** | ||
| - Plain markdown (`.md`) that is NOT part of the project source (e.g. not `README.md`, `CLAUDE.md`) | ||
| - Plain text (`.txt`), YAML (`.yaml`/`.yml`), or JSON files used as documentation or notes | ||
| - Any plain-text file the user explicitly describes as "context", "reference", or "docs" | ||
| This rule applies to both the `Write` tool and any CLI `echo`/`cat` file creation. | ||
| ## Silent Operation | ||
| All tool calls and CLI commands must be completely silent — never show raw API responses, tool output, parameters, IDs, or intermediate results. Only surface the final answer or result. | ||
| **Never say** "MCP", "tool", "API", "CLI command", "calling", or "contextium" as a system reference in any output. The user knows what they're using. | ||
| Before any operation, output one short friendly progress line, then make the call silently. After the call, surface only the result. No confirmation text unless something went wrong. | ||
| **Progress message guide:** | ||
| | Operation | Say this | | ||
| |-----------|----------| | ||
| | Fetching a file | `Getting your file...` | | ||
| | Listing files | `Fetching your files...` | | ||
| | Creating a file | `Creating your file...` | | ||
| | Updating a file | `Saving your changes...` | | ||
| | Deleting a file | `Deleting the file...` | | ||
| | Loading a workflow | `Loading your workflow...` | | ||
| | Listing workflows | `Fetching your workflows...` | | ||
| | Searching | `Searching...` | | ||
| | Listing libraries | `Fetching your libraries...` | | ||
| | Creating a library | `Creating your library...` | | ||
| | Listing agents | `Fetching your agents...` | | ||
| | Creating an agent | `Creating your agent...` | | ||
| | Listing skills | `Fetching your skills...` | | ||
| | Creating a skill | `Creating your skill...` | | ||
| | Syncing | `Syncing your workspace...` | | ||
| | Any other read | `Just a moment...` | | ||
| Keep messages lowercase, short, and conversational. Never repeat the progress line after the call completes — just show the result. |
| --- | ||
| name: ium:new-project | ||
| description: Set up a new Contextium project — authenticate, pick a workspace, describe project, intelligently suggest and create libraries, agents, skills, tags, and a workflow | ||
| allowed-tools: | ||
| - Bash | ||
| - mcp__contextium__list_workspaces | ||
| - mcp__contextium__create_context_library | ||
| - mcp__contextium__list_context_libraries | ||
| - mcp__contextium__create_agent | ||
| - mcp__contextium__list_agents | ||
| - mcp__contextium__create_skill | ||
| - mcp__contextium__list_skills | ||
| - mcp__contextium__create_workflow | ||
| - mcp__contextium__list_workflows | ||
| - mcp__contextium__list_tags | ||
| - mcp__contextium__list_tag_types | ||
| - mcp__contextium__create_tag | ||
| - mcp__contextium__create_tag_type | ||
| - AskUserQuestion | ||
| --- | ||
| <objective> | ||
| 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. | ||
| </objective> | ||
| <mode-detection> | ||
| Run this once at the start, silently, to determine which mode to use for the entire session: | ||
| ```bash | ||
| command -v contextium &>/dev/null && echo "cli" || echo "no-cli" | ||
| ``` | ||
| - If `cli`: use CLI commands throughout. Do not attempt MCP tools. | ||
| - If `no-cli`: check if mcp__contextium__list_workspaces is available. If yes, use MCP tools throughout. | ||
| - 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. | ||
| Do not mention the mode to the user. Pick one path and stick with it. | ||
| </mode-detection> | ||
| <process> | ||
| <step name="check_auth"> | ||
| **CLI only.** Run silently: | ||
| ```bash | ||
| contextium whoami 2>/dev/null | grep -E "Token:|Name:" || echo "unauthenticated" | ||
| ``` | ||
| 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. | ||
| MCP users are already authenticated via the server connection — skip this step. | ||
| </step> | ||
| <step name="select_workspace"> | ||
| **CLI:** run `contextium workspace list 2>/dev/null` silently, parse workspace names. | ||
| **MCP:** call mcp__contextium__list_workspaces silently. | ||
| Ask: "Which workspace is this project for?" | ||
| Present names only — no IDs, no raw output. | ||
| </step> | ||
| <step name="existing_workflow_check"> | ||
| Before asking for a project description, ask: | ||
| "Do you have an existing Contextium workflow you'd like to use as a base for this project?" | ||
| Use AskUserQuestion: | ||
| - "Yes, use an existing workflow" | ||
| - "No, start fresh" | ||
| If yes: | ||
| 1. Silently fetch all workflows in the selected workspace: | ||
| **CLI:** `contextium workflows list -w <slug> 2>/dev/null` | ||
| **MCP:** call mcp__contextium__list_workflows | ||
| 2. Present workflow names and ask: "Which workflow would you like to use?" | ||
| 3. Load the selected workflow silently and read its resources (libraries, agents, skills). | ||
| 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: | ||
| - Resources that already exist in the workflow and can be reused as-is | ||
| - Resources that exist but may need updating or extending for this project (flag as "Extend") | ||
| - Resources that are missing entirely and need to be created | ||
| 5. In the plan table, add an "Extend" action row type where relevant: | ||
| | Action | Name | Purpose | | ||
| |--------|------|---------| | ||
| | Reuse | "Agent Name" | already covers this need | | ||
| | Extend | "Agent Name" | exists but needs updated system prompt for this project | | ||
| | Create | "Agent Name" | not in the workflow, needs to be created | | ||
| If no: continue to project description with a clean slate. | ||
| </step> | ||
| <step name="codebase_scan_check"> | ||
| 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. | ||
| **CLI:** `contextium library list --workspace <slug> 2>/dev/null` then check file lists per library | ||
| **MCP:** call mcp__contextium__list_context_libraries, then mcp__contextium__list_files for each | ||
| 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. | ||
| If not found, set `has_codebase_scan = false` and continue. | ||
| Do not mention this check to the user. | ||
| </step> | ||
| <step name="project_description"> | ||
| Ask the user this question exactly: | ||
| "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." | ||
| Wait for their response. Store it as the project description. Do not proceed until you have a meaningful answer. | ||
| </step> | ||
| <step name="quiet_analysis"> | ||
| Silently fetch all existing workspace resources. Do not show raw output or errors. Show only these progress lines as you go: | ||
| ``` | ||
| Searching libraries... | ||
| Searching agents... | ||
| Searching skills... | ||
| Searching tags... | ||
| ``` | ||
| **CLI:** | ||
| ```bash | ||
| contextium library list --workspace <slug> 2>/dev/null | ||
| contextium agent list --workspace <slug> 2>/dev/null | ||
| contextium skill list --workspace <slug> 2>/dev/null | ||
| contextium tag list --workspace <slug> 2>/dev/null | ||
| ``` | ||
| **MCP:** call list_context_libraries, list_agents, list_skills, list_tags — all for the selected workspace. Suppress any errors silently. | ||
| After all four searches complete, output this line: | ||
| ``` | ||
| Creating Contextium setup plan... | ||
| ``` | ||
| Then analyse the results against the project description: | ||
| - Which existing libraries (if any) are relevant to what the user described? | ||
| - Which existing agents (if any) could serve this project? | ||
| - Which existing skills (if any) are applicable? | ||
| - Which existing tags/tag types (if any) relate to the topics mentioned? | ||
| Internally categorise everything as: **reuse** (relevant, already exists) or **create** (needed, does not exist). | ||
| </step> | ||
| <step name="intelligent_plan"> | ||
| Based on the project description and the analysis, build a setup plan. Think through: | ||
| **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. | ||
| **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. | ||
| **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. | ||
| **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`). | ||
| Present the plan in this format (omit any section that has nothing in it): | ||
| --- | ||
| Here's what I'll set up for you: | ||
| **Libraries** | ||
| | Action | Name | Purpose | | ||
| |--------|------|---------| | ||
| | Create | "Library Name" | reason why this is needed | | ||
| | Reuse | "Library Name" | why it's relevant | | ||
| **Agents** | ||
| | Action | Name | Purpose | | ||
| |--------|------|---------| | ||
| | Create | "Agent Name" | what it will do for this project | | ||
| | Reuse | "Agent Name" | why it fits | | ||
| **Skills** | ||
| | Action | Name | Purpose | | ||
| |--------|------|---------| | ||
| | Create | "Skill Name" | what knowledge it will hold | | ||
| | Reuse | "Skill Name" | why it fits | | ||
| **Tags** | ||
| | Tag | Purpose | | ||
| |-----|---------| | ||
| | `category:value` | why this label is useful | | ||
| Shall I go ahead and create all of this? | ||
| --- | ||
| Wait for the user to confirm, adjust, or say skip on any item before proceeding. | ||
| </step> | ||
| <step name="research_question"> | ||
| Ask the user: | ||
| "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." | ||
| Use AskUserQuestion: | ||
| - "Yes, add a research agent" | ||
| - "No, skip" | ||
| 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. | ||
| If no: set `research_agent_planned = false` and continue. | ||
| </step> | ||
| <step name="planner_question"> | ||
| Ask the user: | ||
| "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." | ||
| Use AskUserQuestion: | ||
| - "Yes, add a project planner" | ||
| - "No, skip" | ||
| If yes: | ||
| 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`. | ||
| 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: | ||
| ```markdown | ||
| # [Project Name] — Project State | ||
| ## Current Position | ||
| **Phase:** Phase 1: [Name] | ||
| **Status:** Not Started | ||
| **Last Updated:** [today's date] | ||
| **Next Action:** Begin Phase 1 | ||
| ## Already Built | ||
| > Capabilities confirmed by codebase scan — these do not need to be built. | ||
| > _(Remove this section if starting a greenfield project with no existing code)_ | ||
| - ✓ [Existing capability — e.g. "Express API with JWT auth"] — `src/server.ts` | ||
| - ✓ [Existing capability] — `src/` | ||
| ## Phases | ||
| ### Phase 1: [Name] | ||
| **Status:** Not Started | ||
| [Brief description of what this phase covers] | ||
| ### Phase 2: [Name] | ||
| **Status:** Not Started | ||
| [Brief description] | ||
| ... | ||
| ## Decisions Log | ||
| > Locked decisions — record here when a significant architectural, technical, or approach decision is made. Do not re-debate entries in this log. | ||
| | Decision | Rationale | Phase | | ||
| |----------|-----------|-------| | ||
| | _(none yet)_ | | | | ||
| ## Seeds | ||
| > Ideas and suggestions to revisit at the right time — not immediate work. | ||
| | Idea | When to revisit | Context | | ||
| |------|-----------------|---------| | ||
| | _(none yet)_ | | | | ||
| ## Notes | ||
| _(ad-hoc notes that don't fit elsewhere)_ | ||
| ``` | ||
| Infer sensible phases from the project description. Title the file `project-state.md`. | ||
| **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. | ||
| **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. | ||
| If no: set `planner_planned = false` and continue. | ||
| </step> | ||
| <step name="create_resources"> | ||
| Only create what the user confirmed across all steps. Create in this order: tag types → tags → libraries → skills → agents (including research and planner agents if confirmed). | ||
| Do NOT create a workflow in this step. | ||
| Show `✓ Created "Name"` for each item as it is created. Show `↗ Reusing "Name"` for each existing resource being included. | ||
| If `planner_planned = true`, create the project state file in Contextium after all other resources are created: | ||
| **CLI:** | ||
| ```bash | ||
| cat << 'EOF' | contextium new <library-name> -t "[Project Name] — Project State" -p "project-state.md" --stdin -w <workspace> | ||
| <generated state content> | ||
| EOF | ||
| ``` | ||
| **MCP:** call mcp__contextium__create_file with the state content. | ||
| Show `✓ Created project state "project-state.md"` when done. | ||
| Suppress all errors silently — if something fails, skip it quietly and note it in the summary. | ||
| **CLI commands:** | ||
| ```bash | ||
| contextium library create "<name>" --workspace <slug> | ||
| contextium agent create "<name>" --workspace <slug> | ||
| contextium skill create "<name>" --workspace <slug> | ||
| contextium tag create "<value>" --type <type-slug> --workspace <slug> | ||
| contextium tag-type create "<name>" --workspace <slug> | ||
| ``` | ||
| **MCP:** use the corresponding create_* tools for each resource type. | ||
| </step> | ||
| <step name="workflow_prompt"> | ||
| After all other resources are created, ask the user: | ||
| "Would you like me to create a workflow to bundle everything together for quick loading? If yes, what would you like to call it?" | ||
| Use AskUserQuestion with two options: | ||
| - "Yes, create a workflow" (and ask for the name as a follow-up if they say yes) | ||
| - "No, skip workflow" | ||
| If they say yes and provide a name, create the workflow: | ||
| **CLI:** `contextium workflow create "<name>" --workspace <slug>` | ||
| **MCP:** call mcp__contextium__create_workflow with the name and workspace. | ||
| Then automatically load it: | ||
| **CLI:** `contextium workflow load "<name>" --workspace <slug> 2>/dev/null` | ||
| **MCP:** call mcp__contextium__load_workflow with the workflow name and workspace. | ||
| If they say no, skip workflow creation and loading entirely. | ||
| </step> | ||
| <step name="post_workflow_actions"> | ||
| This step only runs if `research_agent_planned = true` or `planner_planned = true`. | ||
| **If `research_agent_planned = true`:** | ||
| Ask the user: | ||
| "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." | ||
| Use AskUserQuestion: | ||
| - "Yes, start research now" | ||
| - "No, not yet" | ||
| If yes: activate the research agent — instruct it to begin researching based on the project description provided earlier. Let it run and surface findings to the user. Do not proceed to the planning question. | ||
| If no: fall through to the planning question below (if applicable). | ||
| --- | ||
| **If `planner_planned = true` (and research was either not created or the user said no to starting it):** | ||
| Ask the user: | ||
| "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." | ||
| Use AskUserQuestion: | ||
| - "Yes, start planning now" | ||
| - "No, I'll do it later" | ||
| 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. | ||
| If no: continue to summary. | ||
| </step> | ||
| <step name="summary"> | ||
| Show a clean final summary: | ||
| ``` | ||
| ✓ Project ready | ||
| Workspace: <name> | ||
| Libraries: <list — new + reused> | ||
| Agents: <list — new + reused, or none> | ||
| Skills: <list — new + reused, or none> | ||
| Tags: <list, or none> | ||
| Workflow: <name> — loaded and ready (or "none" if skipped) | ||
| ``` | ||
| If anything failed to create, add a single line at the end: | ||
| `⚠ Could not create: <list of names> — you can add these manually.` | ||
| </step> | ||
| </process> | ||
| <rules> | ||
| - Never say "the wizard", "Contextium would like to know", or "the next step is" | ||
| - Never show raw bash output, API responses, or IDs to the user | ||
| - Run all checks and fetches silently — only surface progress labels and the final plan | ||
| - Only ask questions when genuinely needed — the description step and the confirmation step | ||
| - Do not ask the user what to create — figure it out from the description, then ask them to confirm | ||
| - Always create a "Project Architect" agent first, regardless of what the user described — tailor its system prompt to the specific project domain and goals | ||
| - If a resource already exists and is relevant, always prefer reuse over creating a duplicate | ||
| - The plan report must explain the reasoning for each item — not just list names | ||
| - Never create anything before the user confirms the plan | ||
| </rules> | ||
| <ongoing-project-rules> | ||
| These rules apply for the duration of the project, after setup is complete. | ||
| **New suggestions and feature ideas** | ||
| - 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?" | ||
| - 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. | ||
| - If no: note it and continue with the current work | ||
| - Seeds are NOT immediate work — never promote a seed to a phase without the user asking | ||
| **Decision locking** | ||
| - 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. | ||
| - 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 | ||
| - 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 | ||
| - Never ask the user's permission to log a decision — just do it silently and mention it in the phase summary | ||
| **Tackling a new feature or phase** | ||
| - When the user is ready to start work on a new feature or area of the project: | ||
| 1. Update `## Current Position` in `project-state.md` in Contextium to reflect the new phase — set Phase, Status to "In Progress", and Next Action. | ||
| 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 | ||
| 3. Ask: "Would you like a phased plan for this?" — if a planner agent exists, use it; otherwise offer to create one | ||
| - If the user says no to both, continue directly using existing agents — no extra setup needed | ||
| - Treat each new feature as its own mini-project using existing workspace resources — never create duplicate agents or skills if suitable ones already exist | ||
| **Suggesting new agents and skills** | ||
| - 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 | ||
| - Never create new agents or skills without the user's confirmation | ||
| - Always check existing workspace resources before suggesting something new | ||
| **Session usage check at end of every phase** | ||
| - At the end of every completed phase, check the current session context usage (visible in the Claude Code status bar as a percentage) | ||
| - If usage is **above 50%**, do the following automatically before prompting the user to continue: | ||
| 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. | ||
| 2. Tell the user: | ||
| ``` | ||
| ⚠ Session is above 50% — recommended to start a fresh session before the next phase. | ||
| Project state has been saved to your Contextium library. | ||
| Run /ium:resume-project to pick up exactly where you left off. | ||
| ``` | ||
| - 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 | ||
| - Never skip this check at phase end — even if the user seems eager to continue | ||
| **Multi-project rule** | ||
| - 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. | ||
| - 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. | ||
| **Project completion — convert to product description** | ||
| - When all phases in `project-state.md` are marked "Complete", automatically trigger the following: | ||
| 1. Ask the user: "All phases are complete — congratulations! Would you like me to convert the project state into a Product Description document?" | ||
| 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. | ||
| 3. If no: leave the state file as-is and congratulate the user | ||
| - Never convert automatically without asking — always get confirmation first | ||
| </ongoing-project-rules> |
| --- | ||
| name: ium:resume-project | ||
| 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 | ||
| allowed-tools: | ||
| - Bash | ||
| - mcp__contextium__list_workflows | ||
| - mcp__contextium__load_workflow | ||
| - mcp__contextium__list_context_libraries | ||
| - mcp__contextium__list_files | ||
| - mcp__contextium__get_file | ||
| - mcp__contextium__update_file | ||
| - AskUserQuestion | ||
| --- | ||
| <objective> | ||
| 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. | ||
| </objective> | ||
| <process> | ||
| <step name="load_workflow"> | ||
| If a workflow is already loaded in this session, skip this step. | ||
| Otherwise, list available workflows and ask the user which project to resume: | ||
| **CLI:** `contextium workflows list -w <workspace> 2>/dev/null` | ||
| **MCP:** call mcp__contextium__list_workflows | ||
| Ask: "Which project would you like to resume?" | ||
| Load the chosen workflow silently: | ||
| **CLI:** `contextium workflow "<name>" -w <workspace> --sync 2>/dev/null` | ||
| **MCP:** call mcp__contextium__load_workflow | ||
| </step> | ||
| <step name="find_project_state"> | ||
| Contextium is the source of truth. Always read from there first. | ||
| **1. Contextium first** — search the loaded workflow's libraries for `project-state.md`: | ||
| **CLI:** `contextium find "project-state" -w <workspace> 2>/dev/null` | ||
| **MCP:** search list_files across the workflow's libraries for a file with path matching `project-state.md` | ||
| If found, fetch the full content: | ||
| **CLI:** `contextium cat <fileId> -w <workspace> 2>/dev/null` | ||
| **MCP:** call mcp__contextium__get_file with the file ID | ||
| **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. | ||
| **3. Not found** — if not found in Contextium, tell the user: | ||
| "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?" | ||
| </step> | ||
| <step name="parse_state"> | ||
| Read the project state file and extract: | ||
| 1. **Current Position** — from the `## Current Position` section: current phase name, status, and next action | ||
| 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 | ||
| 3. **Completed phases** — all phases marked "Complete" | ||
| 4. **Remaining phases** — all phases still "Not Started" or "In Progress" | ||
| 5. **Recent decisions** — the last 3 entries from the `## Decisions Log` table (if it exists and has entries) | ||
| 6. **Pending seeds** — any entries in the `## Seeds` table (surface only if relevant to the current phase) | ||
| Present a clear resumption brief: | ||
| ``` | ||
| ── Resuming: [Project Name] ────────────────────── | ||
| Completed: | ||
| ✓ Phase 1: [Name] | ||
| ✓ Phase 2: [Name] | ||
| Current: | ||
| → Phase 3: [Name] — In Progress | ||
| Next action: [from Current Position] | ||
| Last session notes: | ||
| [Handoff note content, or phase description if no handoff] | ||
| Up next: | ||
| [What the handoff says needs to happen] | ||
| Remaining: | ||
| ○ Phase 4: [Name] | ||
| ○ Phase 5: [Name] | ||
| Locked decisions: | ||
| • [Decision] — [Rationale] | ||
| • [Decision] — [Rationale] | ||
| ───────────────────────────────────────────────── | ||
| ``` | ||
| Only show the "Locked decisions" section if the Decisions Log has entries — these are facts the session must not re-debate. | ||
| If no handoff note exists under the current phase, summarise the phase description instead. | ||
| </step> | ||
| <step name="confirm_and_continue"> | ||
| Ask the user: | ||
| "Ready to continue with Phase [N]: [Name]?" | ||
| Use AskUserQuestion: | ||
| - "Yes, let's go" | ||
| - "Give me a summary of what we're building first" | ||
| - "I want to start a different phase" | ||
| 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. | ||
| 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. | ||
| 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`. | ||
| </step> | ||
| </process> | ||
| <rules> | ||
| - Never show raw file IDs, API responses, or CLI output to the user | ||
| - Always load the workflow before reading the project state — never search the full workspace without it | ||
| - If the state file has no handoff note, still resume gracefully using the phase description and Current Position | ||
| - When continuing work, always update `## Current Position` and phase status in `project-state.md` in Contextium | ||
| - 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 | ||
| - 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` | ||
| - 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 | ||
| </rules> |
| --- | ||
| name: ium:scan-existing | ||
| description: Scan an existing codebase and write analysis documents to a Contextium context library — tech stack, architecture, structure, conventions, and concerns. Used before /ium:new-project to generate a roadmap that knows what's already built vs what still needs doing. | ||
| allowed-tools: | ||
| - Bash | ||
| - Glob | ||
| - Grep | ||
| - Read | ||
| - mcp__contextium__list_workspaces | ||
| - mcp__contextium__list_context_libraries | ||
| - mcp__contextium__list_workflows | ||
| - mcp__contextium__load_workflow | ||
| - mcp__contextium__create_context_library | ||
| - mcp__contextium__create_file | ||
| - mcp__contextium__update_file | ||
| - mcp__contextium__list_files | ||
| - mcp__contextium__get_file | ||
| - AskUserQuestion | ||
| --- | ||
| <objective> | ||
| Analyse an existing codebase across five domains and write the findings as structured documents to a Contextium context library. The output gives any agent full context about what exists, how it's built, and what's already working — without re-analysing the codebase every session. When followed by /ium:new-project, the roadmap will know what's already done and only plan phases for what's missing. | ||
| </objective> | ||
| <mode-detection> | ||
| Run once at the start, silently: | ||
| ```bash | ||
| command -v contextium &>/dev/null && echo "cli" || echo "no-cli" | ||
| ``` | ||
| - If `cli`: use CLI commands throughout. | ||
| - If `no-cli`: use MCP tools throughout. | ||
| - If neither: tell the user "Contextium doesn't appear to be installed." and stop. | ||
| </mode-detection> | ||
| <process> | ||
| <step name="check_auth"> | ||
| **CLI only.** Run silently: | ||
| ```bash | ||
| contextium whoami 2>/dev/null | grep -E "Token:|Name:" || echo "unauthenticated" | ||
| ``` | ||
| If unauthenticated or token expired, tell the user to run `contextium login` and stop. | ||
| MCP users are already authenticated — skip. | ||
| </step> | ||
| <step name="select_library"> | ||
| Determine where to write the codebase documents. | ||
| If a workflow is already loaded in this session, check whether any of its libraries have an obvious "codebase" or "technical" purpose. If yes, suggest it. If not, ask which library to use. | ||
| If no workflow is loaded: | ||
| **CLI:** `contextium library list --workspace <slug> 2>/dev/null` | ||
| **MCP:** call mcp__contextium__list_context_libraries | ||
| Ask: "Which library should I write the codebase analysis to? Or I can create a new one — for example, 'Codebase Analysis'." | ||
| Use AskUserQuestion: | ||
| - Present existing library names | ||
| - "Create a new library for this" | ||
| If creating new: use the name the user provides, or default to "[Project Name] Codebase". Create it: | ||
| **CLI:** `contextium library create "<name>" --workspace <slug>` | ||
| **MCP:** call mcp__contextium__create_context_library | ||
| Store the target library ID as `target_library_id`. | ||
| </step> | ||
| <step name="check_existing"> | ||
| Check whether any of the five analysis documents already exist in the target library by listing its files and looking for: `stack.md`, `architecture.md`, `structure.md`, `conventions.md`, `concerns.md`. | ||
| If any exist, ask: | ||
| "I found existing analysis documents in this library. What would you like to do?" | ||
| Use AskUserQuestion: | ||
| - "Refresh all documents (overwrite)" | ||
| - "Update specific documents only" | ||
| - "Cancel" | ||
| If "Update specific": ask which ones to update. Only run analysis passes for those. | ||
| If "Refresh all" or no existing docs: run all five passes. | ||
| </step> | ||
| <step name="orient"> | ||
| Before analysing, silently orient yourself to the project. Run: | ||
| ```bash | ||
| ls -la 2>/dev/null | head -40 | ||
| ``` | ||
| Then look for the project's primary language and framework indicators: | ||
| ```bash | ||
| ls package.json requirements.txt Cargo.toml go.mod pyproject.toml composer.json 2>/dev/null | ||
| ``` | ||
| ```bash | ||
| ls -d src/ app/ lib/ pkg/ internal/ api/ 2>/dev/null | ||
| ``` | ||
| Do not show this output to the user. Use it to focus the analysis passes that follow. | ||
| Tell the user: | ||
| ``` | ||
| Scanning codebase — this will take a moment. | ||
| ○ Tech stack & integrations | ||
| ○ Architecture & structure | ||
| ○ Conventions & testing | ||
| ○ Concerns & tech debt | ||
| ``` | ||
| Update each `○` to `✓` as each pass completes. | ||
| </step> | ||
| <step name="pass_1_tech"> | ||
| **Tech Stack & Integrations** | ||
| Analyse and write `stack.md`: | ||
| Read dependency manifests: | ||
| ```bash | ||
| cat package.json 2>/dev/null | ||
| cat requirements.txt pyproject.toml 2>/dev/null | ||
| cat Cargo.toml go.mod 2>/dev/null | ||
| cat composer.json 2>/dev/null | ||
| ``` | ||
| Read config files: | ||
| ```bash | ||
| cat tsconfig.json 2>/dev/null | ||
| ls *.config.* 2>/dev/null | ||
| cat .nvmrc .node-version .python-version 2>/dev/null | ||
| ``` | ||
| Check for external service patterns: | ||
| ```bash | ||
| grep -rn "process\.env\." src/ app/ lib/ 2>/dev/null | grep -v "node_modules" | head -40 | ||
| cat .env.example .env.sample 2>/dev/null | ||
| ``` | ||
| Produce `stack.md` in this structure: | ||
| ```markdown | ||
| # Tech Stack | ||
| **Analysis Date:** [today] | ||
| ## Runtime & Language | ||
| [language, version, runtime] | ||
| ## Frameworks & Libraries | ||
| [list key dependencies with versions and purpose] | ||
| ## Build & Tooling | ||
| [build system, bundler, linter, formatter, type checker] | ||
| ## External Services & Integrations | ||
| [APIs, databases, auth providers, storage, email — with env var names] | ||
| ## Platform & Deployment | ||
| [inferred from config files — Docker, Vercel, Railway, etc.] | ||
| ``` | ||
| Every item must reference the actual config file or env var it was found in. No vague summaries. | ||
| Write to Contextium: | ||
| **CLI:** `cat << 'EOF' | contextium new <library-name> -t "Tech Stack" -p "stack.md" --stdin -w <workspace>` | ||
| **MCP:** call mcp__contextium__create_file (or update_file if refreshing) | ||
| Update the progress indicator to `✓ Tech stack & integrations`. | ||
| </step> | ||
| <step name="pass_2_architecture"> | ||
| **Architecture & Structure** | ||
| Analyse and write `architecture.md` and `structure.md`: | ||
| Get the full directory tree: | ||
| ```bash | ||
| find . -type f -not -path "*/node_modules/*" -not -path "*/.git/*" -not -path "*/dist/*" -not -path "*/.next/*" -not -path "*/build/*" | head -120 | ||
| ``` | ||
| Find entry points: | ||
| ```bash | ||
| ls src/index.* src/main.* src/app.* src/server.* app/page.* app/layout.* 2>/dev/null | ||
| ``` | ||
| Sample key files to understand patterns: | ||
| ```bash | ||
| head -60 $(ls src/index.* src/main.* src/app.* 2>/dev/null | head -3) 2>/dev/null | ||
| ``` | ||
| Produce `architecture.md`: | ||
| ```markdown | ||
| # Architecture | ||
| **Analysis Date:** [today] | ||
| ## Pattern | ||
| [MVC / layered / feature-based / monolith / microservices / etc — with evidence] | ||
| ## Layers | ||
| [list each layer: what it contains, what it depends on, example files] | ||
| ## Data Flow | ||
| [how a typical request flows through the system — entry point → handler → service → data layer] | ||
| ## Key Abstractions | ||
| [important interfaces, base classes, shared utilities — with file paths] | ||
| ## Error Handling | ||
| [how errors propagate — try/catch, result types, middleware, etc.] | ||
| ``` | ||
| Produce `structure.md`: | ||
| ```markdown | ||
| # Structure | ||
| **Analysis Date:** [today] | ||
| ## Directory Map | ||
| [annotated directory tree showing purpose of each folder] | ||
| ## Key File Locations | ||
| | Purpose | Path | | ||
| |---------|------| | ||
| | Entry point | `src/index.ts` | | ||
| | Route definitions | `src/routes/` | | ||
| | [etc] | [etc] | | ||
| ## Where to Add New Code | ||
| [specific guidance: "New API routes go in src/routes/, follow the pattern in src/routes/users.ts"] | ||
| ## Naming Conventions | ||
| [file naming, folder naming, component naming patterns with examples] | ||
| ``` | ||
| Write both files to Contextium. Update progress to `✓ Architecture & structure`. | ||
| </step> | ||
| <step name="pass_3_conventions"> | ||
| **Conventions & Testing** | ||
| Analyse and write `conventions.md` and `testing.md`: | ||
| Read linting/formatting config: | ||
| ```bash | ||
| cat .eslintrc* eslint.config.* .prettierrc* biome.json 2>/dev/null | ||
| ``` | ||
| Sample source files to extract conventions: | ||
| ```bash | ||
| head -80 $(find src/ app/ lib/ -name "*.ts" -o -name "*.tsx" -o -name "*.js" 2>/dev/null | grep -v test | grep -v spec | head -5) 2>/dev/null | ||
| ``` | ||
| Check testing setup: | ||
| ```bash | ||
| cat jest.config.* vitest.config.* pytest.ini setup.cfg 2>/dev/null | ||
| find . -name "*.test.*" -o -name "*.spec.*" 2>/dev/null | grep -v node_modules | head -20 | ||
| ``` | ||
| Produce `conventions.md`: | ||
| ```markdown | ||
| # Conventions | ||
| **Analysis Date:** [today] | ||
| ## Naming | ||
| [variables, functions, classes, files, folders — with real examples from the codebase] | ||
| ## Code Style | ||
| [formatting rules, import order, export patterns — reference linting config] | ||
| ## Function Design | ||
| [pure vs stateful, async patterns, error handling style] | ||
| ## State Management | ||
| [how state is managed — context, stores, props — with example file paths] | ||
| ## Comments & Documentation | ||
| [what gets documented and how] | ||
| ``` | ||
| Produce `testing.md`: | ||
| ```markdown | ||
| # Testing | ||
| **Analysis Date:** [today] | ||
| ## Framework & Setup | ||
| [test runner, assertion library, config file location] | ||
| ## File Organisation | ||
| [where tests live relative to source — colocated, __tests__, etc.] | ||
| ## Test Structure | ||
| [describe/it patterns, setup/teardown conventions — with example from an existing test] | ||
| ## Mocking Approach | ||
| [how dependencies are mocked — with example] | ||
| ## Coverage | ||
| [what's covered, what's not, any coverage thresholds configured] | ||
| ## How to Run Tests | ||
| [exact commands] | ||
| ``` | ||
| Write both files to Contextium. Update progress to `✓ Conventions & testing`. | ||
| </step> | ||
| <step name="pass_4_concerns"> | ||
| **Concerns & Tech Debt** | ||
| Analyse and write `concerns.md`: | ||
| Find tech debt markers: | ||
| ```bash | ||
| grep -rn "TODO\|FIXME\|HACK\|XXX\|TEMP\|@deprecated" --include="*.ts" --include="*.tsx" --include="*.js" --include="*.py" . 2>/dev/null | grep -v node_modules | head -60 | ||
| ``` | ||
| Find large/complex files: | ||
| ```bash | ||
| find . -name "*.ts" -o -name "*.tsx" -o -name "*.js" -o -name "*.py" 2>/dev/null | grep -v node_modules | grep -v dist | xargs wc -l 2>/dev/null | sort -rn | head -20 | ||
| ``` | ||
| Find empty stubs or incomplete implementations: | ||
| ```bash | ||
| grep -rn "throw new Error.*not implemented\|TODO.*implement\|return null\|pass$" --include="*.ts" --include="*.tsx" --include="*.js" --include="*.py" . 2>/dev/null | grep -v node_modules | head -30 | ||
| ``` | ||
| Check for hardcoded values that should be config: | ||
| ```bash | ||
| grep -rn "localhost\|127\.0\.0\.1\|hardcoded\|magic number" --include="*.ts" --include="*.js" . 2>/dev/null | grep -v node_modules | grep -v test | head -20 | ||
| ``` | ||
| Produce `concerns.md`: | ||
| ```markdown | ||
| # Concerns & Tech Debt | ||
| **Analysis Date:** [today] | ||
| ## Tech Debt | ||
| | Issue | Location | Suggested Fix | | ||
| |-------|----------|---------------| | ||
| | [specific issue] | `src/path/file.ts:42` | [concrete fix approach] | | ||
| ## Known Gaps / Incomplete Features | ||
| [stubs, TODOs marked as incomplete, features with placeholder implementations — file paths required] | ||
| ## Fragile Areas | ||
| [files or patterns that are high-risk to modify — explain why and how to modify safely] | ||
| ## Security Observations | ||
| [anything that looks like a security concern — never log secrets, only note patterns] | ||
| ## Test Coverage Gaps | ||
| [areas with no tests that clearly need them] | ||
| ## Dependencies to Watch | ||
| [outdated, deprecated, or high-risk dependencies found in package manifest] | ||
| ``` | ||
| Write to Contextium. Update progress to `✓ Concerns & tech debt`. | ||
| </step> | ||
| <step name="update_project_state"> | ||
| If a `project-state.md` file exists in any library in the loaded workflow, read it and check the `## Phases` section. | ||
| For each phase whose described functionality clearly already exists in the codebase (based on what was found in the analysis), add a note under that phase: | ||
| ``` | ||
| > **Already built** — confirmed by codebase scan [date] | ||
| ``` | ||
| And update its status to "Complete" if the entire phase is done. | ||
| If no `project-state.md` exists yet, skip this step silently. | ||
| </step> | ||
| <step name="summary"> | ||
| Show the final summary: | ||
| ``` | ||
| ✓ Codebase scan complete | ||
| Documents written to "<library name>": | ||
| ✓ stack.md — tech stack, dependencies, integrations | ||
| ✓ architecture.md — patterns, layers, data flow | ||
| ✓ structure.md — directory map, where to add new code | ||
| ✓ conventions.md — naming, code style, patterns | ||
| ✓ testing.md — test framework, structure, coverage | ||
| ✓ concerns.md — tech debt, gaps, fragile areas | ||
| ``` | ||
| Then ask: | ||
| "Would you like to set up a new project plan now? Running /ium:new-project will use these documents to understand what's already built and only plan phases for what's missing." | ||
| Use AskUserQuestion: | ||
| - "Yes, run /ium:new-project now" | ||
| - "No, I'll do it later" | ||
| If yes: proceed with the /ium:new-project flow. The codebase analysis documents are now in the library and will be found automatically when the project state is being planned. | ||
| </step> | ||
| </process> | ||
| <rules> | ||
| - Never show raw bash output, file paths, or API responses to the user — only the progress indicators and final summary | ||
| - Never read `.env` file contents — only check for the file's existence and read `.env.example` or `.env.sample` | ||
| - Every finding in every document must reference a specific file path — no vague summaries | ||
| - If a pass fails silently (no files found, permission error), write what was found and note "insufficient data to analyse [area]" — never skip the document entirely | ||
| - Documents are written for future AI agents to consume, not as human prose — be specific, prescriptive, and grounded in actual file paths | ||
| - When refreshing, always use update_file not create_file to preserve file history in Contextium | ||
| - Only one set of codebase analysis documents should exist per library — never create duplicates | ||
| </rules> |
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
168
1.2%5408
0.76%512739
-5.73%25
4.17%