illusion-code 0.1.0__py3-none-any.whl
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.
- illusion/__init__.py +24 -0
- illusion/__main__.py +15 -0
- illusion/_frontend/dist/index.mjs +39208 -0
- illusion/_frontend/package.json +27 -0
- illusion/_frontend/src/App.tsx +624 -0
- illusion/_frontend/src/components/CommandPicker.tsx +98 -0
- illusion/_frontend/src/components/Composer.tsx +55 -0
- illusion/_frontend/src/components/ComposerController.tsx +128 -0
- illusion/_frontend/src/components/ConversationView.tsx +750 -0
- illusion/_frontend/src/components/Footer.tsx +25 -0
- illusion/_frontend/src/components/MarkdownContent.tsx +537 -0
- illusion/_frontend/src/components/MarkdownTable.tsx +245 -0
- illusion/_frontend/src/components/ModalHost.tsx +425 -0
- illusion/_frontend/src/components/MultilineTextInput.tsx +250 -0
- illusion/_frontend/src/components/PromptInput.tsx +64 -0
- illusion/_frontend/src/components/SelectModal.tsx +78 -0
- illusion/_frontend/src/components/SidePanel.tsx +175 -0
- illusion/_frontend/src/components/Spinner.tsx +77 -0
- illusion/_frontend/src/components/StatusBar.tsx +142 -0
- illusion/_frontend/src/components/SwarmPanel.tsx +141 -0
- illusion/_frontend/src/components/TodoPanel.tsx +126 -0
- illusion/_frontend/src/components/ToolCallDisplay.tsx +202 -0
- illusion/_frontend/src/components/TranscriptPane.tsx +79 -0
- illusion/_frontend/src/components/WelcomeBanner.tsx +37 -0
- illusion/_frontend/src/hooks/useBackendSession.ts +468 -0
- illusion/_frontend/src/hooks/useTerminalSize.ts +9 -0
- illusion/_frontend/src/i18n.ts +78 -0
- illusion/_frontend/src/index.tsx +42 -0
- illusion/_frontend/src/theme/ThemeContext.tsx +19 -0
- illusion/_frontend/src/theme/builtinThemes.ts +89 -0
- illusion/_frontend/src/types.ts +110 -0
- illusion/_frontend/src/utils/markdown.ts +33 -0
- illusion/_frontend/src/utils/thinking.ts +191 -0
- illusion/_frontend/tsconfig.json +13 -0
- illusion/_web_dist/assets/index-BseIw-ik.css +10 -0
- illusion/_web_dist/assets/index-C_0ZWMuW.js +82 -0
- illusion/_web_dist/index.html +16 -0
- illusion/api/__init__.py +36 -0
- illusion/api/client.py +568 -0
- illusion/api/codex_client.py +563 -0
- illusion/api/compat.py +138 -0
- illusion/api/effort.py +128 -0
- illusion/api/errors.py +57 -0
- illusion/api/openai_client.py +819 -0
- illusion/api/provider.py +148 -0
- illusion/api/registry.py +479 -0
- illusion/api/usage.py +45 -0
- illusion/auth/__init__.py +50 -0
- illusion/auth/copilot.py +419 -0
- illusion/auth/external.py +612 -0
- illusion/auth/flows.py +58 -0
- illusion/auth/manager.py +214 -0
- illusion/auth/storage.py +372 -0
- illusion/bridge/__init__.py +38 -0
- illusion/bridge/manager.py +190 -0
- illusion/bridge/session_runner.py +84 -0
- illusion/bridge/types.py +113 -0
- illusion/bridge/work_secret.py +131 -0
- illusion/cli.py +1228 -0
- illusion/commands/__init__.py +32 -0
- illusion/commands/registry.py +1934 -0
- illusion/config/__init__.py +39 -0
- illusion/config/i18n.py +522 -0
- illusion/config/paths.py +259 -0
- illusion/config/settings.py +564 -0
- illusion/coordinator/__init__.py +41 -0
- illusion/coordinator/agent_definitions.py +1093 -0
- illusion/coordinator/coordinator_mode.py +127 -0
- illusion/engine/__init__.py +95 -0
- illusion/engine/cost_tracker.py +55 -0
- illusion/engine/messages.py +369 -0
- illusion/engine/query.py +632 -0
- illusion/engine/query_engine.py +343 -0
- illusion/engine/stream_events.py +169 -0
- illusion/hooks/__init__.py +67 -0
- illusion/hooks/events.py +43 -0
- illusion/hooks/executor.py +397 -0
- illusion/hooks/hot_reload.py +74 -0
- illusion/hooks/loader.py +133 -0
- illusion/hooks/schemas.py +121 -0
- illusion/hooks/types.py +86 -0
- illusion/mcp/__init__.py +104 -0
- illusion/mcp/client.py +377 -0
- illusion/mcp/config.py +140 -0
- illusion/mcp/types.py +175 -0
- illusion/memory/__init__.py +36 -0
- illusion/memory/manager.py +94 -0
- illusion/memory/memdir.py +58 -0
- illusion/memory/paths.py +57 -0
- illusion/memory/scan.py +120 -0
- illusion/memory/search.py +83 -0
- illusion/memory/types.py +43 -0
- illusion/output_styles/__init__.py +15 -0
- illusion/output_styles/loader.py +64 -0
- illusion/permissions/__init__.py +39 -0
- illusion/permissions/checker.py +174 -0
- illusion/permissions/modes.py +38 -0
- illusion/platforms.py +148 -0
- illusion/plugins/__init__.py +71 -0
- illusion/plugins/bundled/__init__.py +0 -0
- illusion/plugins/installer.py +59 -0
- illusion/plugins/loader.py +301 -0
- illusion/plugins/schemas.py +51 -0
- illusion/plugins/types.py +56 -0
- illusion/prompts/__init__.py +29 -0
- illusion/prompts/claudemd.py +74 -0
- illusion/prompts/context.py +187 -0
- illusion/prompts/environment.py +189 -0
- illusion/prompts/system_prompt.py +155 -0
- illusion/py.typed +0 -0
- illusion/sandbox/__init__.py +29 -0
- illusion/sandbox/adapter.py +174 -0
- illusion/services/__init__.py +59 -0
- illusion/services/compact/__init__.py +1015 -0
- illusion/services/cron.py +338 -0
- illusion/services/cron_scheduler.py +715 -0
- illusion/services/file_history.py +258 -0
- illusion/services/lsp/__init__.py +455 -0
- illusion/services/session_storage.py +237 -0
- illusion/services/token_estimation.py +72 -0
- illusion/skills/__init__.py +60 -0
- illusion/skills/bundled/__init__.py +110 -0
- illusion/skills/bundled/content/batch.md +86 -0
- illusion/skills/bundled/content/coding-guidelines.md +70 -0
- illusion/skills/bundled/content/debug.md +38 -0
- illusion/skills/bundled/content/loop.md +82 -0
- illusion/skills/bundled/content/remember.md +105 -0
- illusion/skills/bundled/content/simplify.md +53 -0
- illusion/skills/bundled/content/skillify.md +113 -0
- illusion/skills/bundled/content/stuck.md +54 -0
- illusion/skills/bundled/content/update-config.md +329 -0
- illusion/skills/bundled/content/verify.md +74 -0
- illusion/skills/loader.py +219 -0
- illusion/skills/registry.py +40 -0
- illusion/skills/types.py +24 -0
- illusion/state/__init__.py +18 -0
- illusion/state/app_state.py +67 -0
- illusion/state/store.py +93 -0
- illusion/swarm/__init__.py +71 -0
- illusion/swarm/agent_executor.py +857 -0
- illusion/swarm/in_process.py +259 -0
- illusion/swarm/subprocess_backend.py +136 -0
- illusion/swarm/team_helpers.py +123 -0
- illusion/swarm/types.py +159 -0
- illusion/swarm/worktree.py +347 -0
- illusion/tasks/__init__.py +33 -0
- illusion/tasks/local_agent_task.py +42 -0
- illusion/tasks/local_shell_task.py +27 -0
- illusion/tasks/manager.py +377 -0
- illusion/tasks/stop_task.py +21 -0
- illusion/tasks/types.py +88 -0
- illusion/tools/__init__.py +126 -0
- illusion/tools/agent_tool.py +388 -0
- illusion/tools/ask_user_question_tool.py +186 -0
- illusion/tools/base.py +149 -0
- illusion/tools/bash_tool.py +413 -0
- illusion/tools/config_tool.py +90 -0
- illusion/tools/cron_tool.py +473 -0
- illusion/tools/enter_plan_mode_tool.py +147 -0
- illusion/tools/enter_worktree_tool.py +188 -0
- illusion/tools/exit_plan_mode_tool.py +69 -0
- illusion/tools/exit_worktree_tool.py +225 -0
- illusion/tools/file_edit_tool.py +283 -0
- illusion/tools/file_read_tool.py +294 -0
- illusion/tools/file_write_tool.py +184 -0
- illusion/tools/glob_tool.py +165 -0
- illusion/tools/grep_tool.py +190 -0
- illusion/tools/list_mcp_resources_tool.py +80 -0
- illusion/tools/lsp_tool.py +333 -0
- illusion/tools/mcp_auth_tool.py +100 -0
- illusion/tools/mcp_tool.py +75 -0
- illusion/tools/notebook_edit_tool.py +242 -0
- illusion/tools/powershell_tool.py +334 -0
- illusion/tools/read_mcp_resource_tool.py +63 -0
- illusion/tools/repl_tool.py +100 -0
- illusion/tools/send_message_tool.py +112 -0
- illusion/tools/shell_common.py +187 -0
- illusion/tools/skill_tool.py +86 -0
- illusion/tools/sleep_tool.py +62 -0
- illusion/tools/structured_output_tool.py +58 -0
- illusion/tools/task_create_tool.py +98 -0
- illusion/tools/task_get_tool.py +94 -0
- illusion/tools/task_list_tool.py +94 -0
- illusion/tools/task_output_tool.py +55 -0
- illusion/tools/task_stop_tool.py +52 -0
- illusion/tools/task_update_tool.py +224 -0
- illusion/tools/team_create_tool.py +236 -0
- illusion/tools/team_delete_tool.py +104 -0
- illusion/tools/todo_write_tool.py +198 -0
- illusion/tools/tool_search_tool.py +156 -0
- illusion/tools/web_fetch_tool.py +264 -0
- illusion/tools/web_search_tool.py +186 -0
- illusion/ui/__init__.py +23 -0
- illusion/ui/app.py +258 -0
- illusion/ui/backend_host.py +1180 -0
- illusion/ui/input.py +86 -0
- illusion/ui/output.py +363 -0
- illusion/ui/permission_dialog.py +47 -0
- illusion/ui/permission_store.py +99 -0
- illusion/ui/protocol.py +384 -0
- illusion/ui/react_launcher.py +280 -0
- illusion/ui/runtime.py +787 -0
- illusion/ui/textual_app.py +603 -0
- illusion/ui/web/__init__.py +10 -0
- illusion/ui/web/server.py +87 -0
- illusion/ui/web/ws_host.py +1197 -0
- illusion/utils/__init__.py +0 -0
- illusion/utils/ripgrep.py +299 -0
- illusion/utils/shell.py +248 -0
- illusion_code-0.1.0.dist-info/METADATA +1159 -0
- illusion_code-0.1.0.dist-info/RECORD +214 -0
- illusion_code-0.1.0.dist-info/WHEEL +4 -0
- illusion_code-0.1.0.dist-info/entry_points.txt +2 -0
- illusion_code-0.1.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: loop
|
|
3
|
+
description: Run a prompt or slash command on a recurring interval (e.g. /loop 5m /foo, defaults to 10m)
|
|
4
|
+
argument-hint: "[interval] <prompt>"
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# /loop — schedule a recurring prompt
|
|
8
|
+
|
|
9
|
+
Parse the input below into `[interval] <prompt…>` and schedule it with the `cron` tool.
|
|
10
|
+
|
|
11
|
+
## Parsing (in priority order)
|
|
12
|
+
|
|
13
|
+
1. **Leading token**: if the first whitespace-delimited token matches `^\d+[smhd]$` (e.g. `5m`, `2h`), that's the interval; the rest is the prompt.
|
|
14
|
+
2. **Trailing "every" clause**: otherwise, if the input ends with `every <N><unit>` or `every <N> <unit-word>` (e.g. `every 20m`, `every 5 minutes`, `every 2 hours`), extract that as the interval and strip it from the prompt. Only match when what follows "every" is a time expression — `check every PR` has no interval.
|
|
15
|
+
3. **Default**: otherwise, interval is `10m` and the entire input is the prompt.
|
|
16
|
+
|
|
17
|
+
If the resulting prompt is empty, show usage `/loop [interval] <prompt>` and stop — do not call the `cron` tool.
|
|
18
|
+
|
|
19
|
+
## Interval → cron
|
|
20
|
+
|
|
21
|
+
Supported suffixes: `s` (seconds, rounded up to nearest minute, min 1), `m` (minutes), `h` (hours), `d` (days). Convert:
|
|
22
|
+
|
|
23
|
+
| Interval pattern | Cron expression | Notes |
|
|
24
|
+
|-----------------------|---------------------|------------------------------------------|
|
|
25
|
+
| `Nm` where N ≤ 59 | `*/N * * * *` | every N minutes |
|
|
26
|
+
| `Nm` where N ≥ 60 | `0 */H * * *` | round to hours (H = N/60, must divide 24)|
|
|
27
|
+
| `Nh` where N ≤ 23 | `0 */N * * *` | every N hours |
|
|
28
|
+
| `Nd` | `0 0 */N * *` | every N days at midnight local |
|
|
29
|
+
| `Ns` | treat as `ceil(N/60)m` | cron minimum granularity is 1 minute |
|
|
30
|
+
|
|
31
|
+
**If the interval doesn't cleanly divide its unit** (e.g. `7m` → `*/7 * * * *` gives uneven gaps at :56→:00; `90m` → 1.5h which cron can't express), pick the nearest clean interval and tell the user what you rounded to before scheduling.
|
|
32
|
+
|
|
33
|
+
## Action
|
|
34
|
+
|
|
35
|
+
1. Call the `cron` tool with:
|
|
36
|
+
- `action`: `"add"`
|
|
37
|
+
- `schedule`: the cron expression from the table above
|
|
38
|
+
- `prompt`: the parsed prompt from above, verbatim (slash commands are passed through unchanged)
|
|
39
|
+
- `recurring`: `true`
|
|
40
|
+
- `name`: a descriptive name for the job (optional, auto-generated if omitted)
|
|
41
|
+
|
|
42
|
+
2. Briefly confirm: what's scheduled, the cron expression, the human-readable cadence, and that they can cancel with `cron` tool `action="remove"` (include the job name/ID).
|
|
43
|
+
|
|
44
|
+
3. **Then immediately execute the parsed prompt now** — don't wait for the first cron fire. If it's a slash command, invoke it via the Skill tool; otherwise act on it directly.
|
|
45
|
+
|
|
46
|
+
## Usage
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
/loop [interval] <prompt>
|
|
50
|
+
|
|
51
|
+
Run a prompt or slash command on a recurring interval.
|
|
52
|
+
|
|
53
|
+
Intervals: Ns, Nm, Nh, Nd (e.g. 5m, 30m, 2h, 1d). Minimum granularity is 1 minute.
|
|
54
|
+
If no interval is specified, defaults to 10m.
|
|
55
|
+
|
|
56
|
+
Examples:
|
|
57
|
+
/loop 5m /babysit-prs
|
|
58
|
+
/loop 30m check the deploy
|
|
59
|
+
/loop 1h /standup 1
|
|
60
|
+
/loop check the deploy (defaults to 10m)
|
|
61
|
+
/loop check the deploy every 20m
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Cron Tool Reference
|
|
65
|
+
|
|
66
|
+
The `cron` tool supports these actions:
|
|
67
|
+
- `add`: Create a new scheduled job (requires `schedule`, `prompt`; optional `name`)
|
|
68
|
+
- `update`: Modify an existing job (requires `name`)
|
|
69
|
+
- `remove`: Delete a job (requires `name`)
|
|
70
|
+
- `list`: List all scheduled jobs
|
|
71
|
+
- `status`: Check scheduler status
|
|
72
|
+
- `run`: Manually trigger a job immediately (requires `name`)
|
|
73
|
+
|
|
74
|
+
**Important**: Recurring jobs do NOT auto-expire. Delete them manually with `action="remove"` when no longer needed.
|
|
75
|
+
|
|
76
|
+
## Rules
|
|
77
|
+
|
|
78
|
+
- Minimum interval is 1 minute
|
|
79
|
+
- Recurring jobs do not auto-expire — user must delete manually
|
|
80
|
+
- The prompt is executed immediately, not waiting for the first cron fire
|
|
81
|
+
- Slash commands are passed through unchanged
|
|
82
|
+
- Use `name` parameter to make jobs easier to identify and manage
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: remember
|
|
3
|
+
description: Review memory entries and propose promotions, cleanup, or reorganization. Detects outdated, conflicting, and duplicate entries.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Memory Review
|
|
7
|
+
|
|
8
|
+
## Goal
|
|
9
|
+
Review the user's memory landscape and produce a clear report of proposed changes, grouped by action type. Do NOT apply changes — present proposals for user approval.
|
|
10
|
+
|
|
11
|
+
## Memory System Overview
|
|
12
|
+
|
|
13
|
+
Illusion Code uses a file-based memory system:
|
|
14
|
+
- **Memory directory**: `~/.illusion/data/memory/<project-name>-<hash>/`
|
|
15
|
+
- **Entry point**: `MEMORY.md` (index file with links to memory files)
|
|
16
|
+
- **Memory files**: Individual `.md` files with optional YAML frontmatter
|
|
17
|
+
|
|
18
|
+
### Memory File Format
|
|
19
|
+
```markdown
|
|
20
|
+
---
|
|
21
|
+
name: short-kebab-case-slug
|
|
22
|
+
description: One-line summary for relevance matching
|
|
23
|
+
type: user|feedback|project|reference
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
Memory content here. For feedback/project types, structure as:
|
|
27
|
+
- Rule/fact
|
|
28
|
+
- **Why:** Reason
|
|
29
|
+
- **How to apply:** When/where this guidance applies
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Memory Types
|
|
33
|
+
- **user**: User role, goals, preferences, knowledge
|
|
34
|
+
- **feedback**: Guidance on how to approach work (corrections and confirmations)
|
|
35
|
+
- **project**: Ongoing work, goals, initiatives, bugs
|
|
36
|
+
- **reference**: Pointers to external resources
|
|
37
|
+
|
|
38
|
+
## Steps
|
|
39
|
+
|
|
40
|
+
### 1. Gather all memory layers
|
|
41
|
+
- Read the `MEMORY.md` entry point from the project memory directory
|
|
42
|
+
- Read all `.md` files in the memory directory (excluding MEMORY.md itself)
|
|
43
|
+
- Check for any project-level configuration in `.illusion/` directory
|
|
44
|
+
|
|
45
|
+
**Success criteria**: You have the contents of all memory files and can compare them.
|
|
46
|
+
|
|
47
|
+
### 2. Classify each memory entry
|
|
48
|
+
For each substantive memory entry, evaluate its current placement:
|
|
49
|
+
|
|
50
|
+
| Check | What to look for |
|
|
51
|
+
|-------|------------------|
|
|
52
|
+
| **Staleness** | Is the information still accurate? Does it reference things that no longer exist? |
|
|
53
|
+
| **Duplicates** | Is the same information captured in multiple places? |
|
|
54
|
+
| **Conflicts** | Do any entries contradict each other? |
|
|
55
|
+
| **Type accuracy** | Is the `type` field correct (user/feedback/project/reference)? |
|
|
56
|
+
| **Description quality** | Does the description accurately summarize the content for relevance matching? |
|
|
57
|
+
|
|
58
|
+
**Success criteria**: Each entry has been evaluated for the above checks.
|
|
59
|
+
|
|
60
|
+
### 3. Identify cleanup opportunities
|
|
61
|
+
Scan across all memory files for:
|
|
62
|
+
- **Outdated entries**: Information contradicted by newer entries or current codebase state
|
|
63
|
+
- **Duplicates**: Same information in multiple files
|
|
64
|
+
- **Conflicts**: Contradictions between entries → propose resolution, noting which is more recent
|
|
65
|
+
- **Orphaned entries**: Memory files not linked from MEMORY.md
|
|
66
|
+
- **Missing descriptions**: Files without proper `description` field in frontmatter
|
|
67
|
+
|
|
68
|
+
**Success criteria**: All issues identified.
|
|
69
|
+
|
|
70
|
+
### 4. Present the report
|
|
71
|
+
Output a structured report grouped by action type:
|
|
72
|
+
|
|
73
|
+
1. **Updates** — entries that need content or metadata corrections
|
|
74
|
+
- Include: file name, what needs to change, why
|
|
75
|
+
2. **Cleanup** — duplicates, outdated entries, conflicts to resolve
|
|
76
|
+
- Include: file names involved, recommendation
|
|
77
|
+
3. **Reorganization** — entries that should be split, merged, or retyped
|
|
78
|
+
- Include: current file, proposed changes
|
|
79
|
+
4. **No action needed** — brief note on entries that are fine as-is
|
|
80
|
+
|
|
81
|
+
If memory is empty, say so and offer to help create initial memory entries.
|
|
82
|
+
|
|
83
|
+
**Success criteria**: User can review and approve/reject each proposal individually.
|
|
84
|
+
|
|
85
|
+
## Proposing Changes
|
|
86
|
+
|
|
87
|
+
When proposing changes, use the memory file format:
|
|
88
|
+
|
|
89
|
+
```markdown
|
|
90
|
+
---
|
|
91
|
+
name: proposed-slug
|
|
92
|
+
description: One-line summary
|
|
93
|
+
type: user|feedback|project|reference
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
Proposed content here.
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Rules
|
|
100
|
+
- Present ALL proposals before making any changes
|
|
101
|
+
- Do NOT modify files without explicit user approval
|
|
102
|
+
- Do NOT create new files unless the target doesn't exist yet
|
|
103
|
+
- Preserve the YAML frontmatter format when creating or updating files
|
|
104
|
+
- Use `add_memory_entry` to create new memory files (handles slug generation and MEMORY.md indexing)
|
|
105
|
+
- Use `remove_memory_entry` to delete memory files (handles MEMORY.md cleanup)
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: simplify
|
|
3
|
+
description: Review changed code for reuse, quality, and efficiency, then fix any issues found.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Simplify: Code Review and Cleanup
|
|
7
|
+
|
|
8
|
+
Review all changed files for reuse, quality, and efficiency. Fix any issues found.
|
|
9
|
+
|
|
10
|
+
## Phase 1: Identify Changes
|
|
11
|
+
|
|
12
|
+
Run `git diff` (or `git diff HEAD` if there are staged changes) to see what changed. If there are no git changes, review the most recently modified files that the user mentioned or that you edited earlier in this conversation.
|
|
13
|
+
|
|
14
|
+
## Phase 2: Launch Three Review Agents in Parallel
|
|
15
|
+
|
|
16
|
+
Use the `agent` tool to launch all three agents concurrently in a single message. Pass each agent the full diff so it has the complete context.
|
|
17
|
+
|
|
18
|
+
### Agent 1: Code Reuse Review
|
|
19
|
+
|
|
20
|
+
For each change:
|
|
21
|
+
|
|
22
|
+
1. **Search for existing utilities and helpers** that could replace newly written code. Look for similar patterns elsewhere in the codebase — common locations are utility directories, shared modules, and files adjacent to the changed ones.
|
|
23
|
+
2. **Flag any new function that duplicates existing functionality.** Suggest the existing function to use instead.
|
|
24
|
+
3. **Flag any inline logic that could use an existing utility** — hand-rolled string manipulation, manual path handling, custom environment checks, ad-hoc type guards, and similar patterns are common candidates.
|
|
25
|
+
|
|
26
|
+
### Agent 2: Code Quality Review
|
|
27
|
+
|
|
28
|
+
Review the same changes for hacky patterns:
|
|
29
|
+
|
|
30
|
+
1. **Redundant state**: state that duplicates existing state, cached values that could be derived, observers/effects that could be direct calls
|
|
31
|
+
2. **Parameter sprawl**: adding new parameters to a function instead of generalizing or restructuring existing ones
|
|
32
|
+
3. **Copy-paste with slight variation**: near-duplicate code blocks that should be unified with a shared abstraction
|
|
33
|
+
4. **Leaky abstractions**: exposing internal details that should be encapsulated, or breaking existing abstraction boundaries
|
|
34
|
+
5. **Stringly-typed code**: using raw strings where constants, enums (string unions), or branded types already exist in the codebase
|
|
35
|
+
6. **Unnecessary comments**: comments explaining WHAT the code does (well-named identifiers already do that), narrating the change, or referencing the task/caller — delete; keep only non-obvious WHY (hidden constraints, subtle invariants, workarounds)
|
|
36
|
+
|
|
37
|
+
### Agent 3: Efficiency Review
|
|
38
|
+
|
|
39
|
+
Review the same changes for efficiency:
|
|
40
|
+
|
|
41
|
+
1. **Unnecessary work**: redundant computations, repeated file reads, duplicate network/API calls, N+1 patterns
|
|
42
|
+
2. **Missed concurrency**: independent operations run sequentially when they could run in parallel
|
|
43
|
+
3. **Hot-path bloat**: new blocking work added to startup or per-request/per-render hot paths
|
|
44
|
+
4. **Recurring no-op updates**: state/store updates inside polling loops, intervals, or event handlers that fire unconditionally — add a change-detection guard so downstream consumers aren't notified when nothing changed
|
|
45
|
+
5. **Unnecessary existence checks**: pre-checking file/resource existence before operating (TOCTOU anti-pattern) — operate directly and handle the error
|
|
46
|
+
6. **Memory**: unbounded data structures, missing cleanup, event listener leaks
|
|
47
|
+
7. **Overly broad operations**: reading entire files when only a portion is needed, loading all items when filtering for one
|
|
48
|
+
|
|
49
|
+
## Phase 3: Fix Issues
|
|
50
|
+
|
|
51
|
+
Wait for all three agents to complete. Aggregate their findings and fix each issue directly. If a finding is a false positive or not worth addressing, note it and move on — do not argue with the finding, just skip it.
|
|
52
|
+
|
|
53
|
+
When done, briefly summarize what was fixed (or confirm the code was already clean).
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: skillify
|
|
3
|
+
description: "Capture this session's repeatable process into a skill. Call at end of the process you want to capture with an optional description."
|
|
4
|
+
argument-hint: "[description of the process you want to capture]"
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Skillify
|
|
8
|
+
|
|
9
|
+
You are capturing this session's repeatable process as a reusable skill.
|
|
10
|
+
|
|
11
|
+
## Your Task
|
|
12
|
+
|
|
13
|
+
### Step 1: Analyze the Session
|
|
14
|
+
|
|
15
|
+
Before asking any questions, analyze the session to identify:
|
|
16
|
+
- What repeatable process was performed
|
|
17
|
+
- What the inputs/parameters were
|
|
18
|
+
- The distinct steps (in order)
|
|
19
|
+
- The success artifacts/criteria (e.g. not just "writing code," but "an open PR with CI fully passing") for each step
|
|
20
|
+
- Where the user corrected or steered you
|
|
21
|
+
- What tools and permissions were needed
|
|
22
|
+
- What agents were used
|
|
23
|
+
- What the goals and success artifacts were
|
|
24
|
+
|
|
25
|
+
### Step 2: Interview the User
|
|
26
|
+
|
|
27
|
+
You will use the `ask_user_question` tool to understand what the user wants to automate. Important notes:
|
|
28
|
+
- Use `ask_user_question` for ALL questions! Never ask questions via plain text.
|
|
29
|
+
- For each round, iterate as much as needed until the user is happy.
|
|
30
|
+
- The user always has a freeform "Other" option to type edits or feedback -- do NOT add your own "Needs tweaking" or "I'll provide edits" option. Just offer the substantive choices.
|
|
31
|
+
|
|
32
|
+
**Round 1: High level confirmation**
|
|
33
|
+
- Suggest a name and description for the skill based on your analysis. Ask the user to confirm or rename.
|
|
34
|
+
- Suggest high-level goal(s) and specific success criteria for the skill.
|
|
35
|
+
|
|
36
|
+
**Round 2: More details**
|
|
37
|
+
- Present the high-level steps you identified as a numbered list. Tell the user you will dig into the detail in the next round.
|
|
38
|
+
- If you think the skill will require arguments, suggest arguments based on what you observed. Make sure you understand what someone would need to provide.
|
|
39
|
+
- If it's not clear, ask if this skill should run inline (in the current conversation) or forked (as a sub-agent with its own context). Forked is better for self-contained tasks that don't need mid-process user input; inline is better when the user wants to steer mid-process.
|
|
40
|
+
- Ask where the skill should be saved. Suggest a default based on context:
|
|
41
|
+
- **This repo** (`.illusion/skills/<name>/<name>.md`) — for workflows specific to this project
|
|
42
|
+
- **Personal** (`~/.illusion/skills/<name>.md`) — follows you across all repos
|
|
43
|
+
|
|
44
|
+
**Round 3: Breaking down each step**
|
|
45
|
+
For each major step, if it's not glaringly obvious, ask:
|
|
46
|
+
- What does this step produce that later steps need? (data, artifacts, IDs)
|
|
47
|
+
- What proves that this step succeeded, and that we can move on?
|
|
48
|
+
- Should the user be asked to confirm before proceeding? (especially for irreversible actions like merging, sending messages, or destructive operations)
|
|
49
|
+
- Are any steps independent and could run in parallel? (e.g., posting to Slack and monitoring CI at the same time)
|
|
50
|
+
- How should the skill be executed? (e.g. always use a Task agent to conduct code review, or invoke an agent team for a set of concurrent steps)
|
|
51
|
+
- What are the hard constraints or hard preferences? Things that must or must not happen?
|
|
52
|
+
|
|
53
|
+
You may do multiple rounds of AskUserQuestion here, one round per step, especially if there are more than 3 steps or many clarification questions. Iterate as much as needed.
|
|
54
|
+
|
|
55
|
+
IMPORTANT: Pay special attention to places where the user corrected you during the session, to help inform your design.
|
|
56
|
+
|
|
57
|
+
**Round 4: Final questions**
|
|
58
|
+
- Confirm when this skill should be invoked, and suggest/confirm trigger phrases too. (e.g. For a cherrypick workflow you could say: Use when the user wants to cherry-pick a PR to a release branch. Examples: 'cherry-pick to release', 'CP this PR', 'hotfix.')
|
|
59
|
+
- You can also ask for any other gotchas or things to watch out for, if it's still unclear.
|
|
60
|
+
|
|
61
|
+
Stop interviewing once you have enough information. IMPORTANT: Don't over-ask for simple processes!
|
|
62
|
+
|
|
63
|
+
### Step 3: Write the SKILL.md
|
|
64
|
+
|
|
65
|
+
Create the skill directory and file at the location the user chose in Round 2.
|
|
66
|
+
|
|
67
|
+
Use this format:
|
|
68
|
+
|
|
69
|
+
```markdown
|
|
70
|
+
---
|
|
71
|
+
name: {{skill-name}}
|
|
72
|
+
description: {{one-line description}}
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
# {{Skill Title}}
|
|
76
|
+
|
|
77
|
+
Description of when to use this skill.
|
|
78
|
+
|
|
79
|
+
## Goal
|
|
80
|
+
Clearly stated goal for this workflow. Best if you have clearly defined artifacts or criteria for completion.
|
|
81
|
+
|
|
82
|
+
## Steps
|
|
83
|
+
|
|
84
|
+
### 1. Step Name
|
|
85
|
+
What to do in this step. Be specific and actionable. Include commands when appropriate.
|
|
86
|
+
|
|
87
|
+
**Success criteria**: ALWAYS include this! This shows that the step is done and we can move on. Can be a list.
|
|
88
|
+
|
|
89
|
+
...
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
**Note on frontmatter**: The skill loader only parses `name` and `description` from YAML frontmatter. Other fields (allowed-tools, when_to_use, arguments, context) are not currently supported but can be included as comments for documentation purposes.
|
|
93
|
+
|
|
94
|
+
**Per-step annotations**:
|
|
95
|
+
- **Success criteria** is REQUIRED on every step. This helps the model understand what the user expects from their workflow, and when it should have the confidence to move on.
|
|
96
|
+
- **Execution**: `Direct` (default), `Task agent` (straightforward subagents), or `[human]` (user does it). Only needs specifying if not Direct.
|
|
97
|
+
- **Artifacts**: Data this step produces that later steps need (e.g., PR number, commit SHA). Only include if later steps depend on it.
|
|
98
|
+
- **Human checkpoint**: When to pause and ask the user before proceeding. Include for irreversible actions (merging, sending messages), error judgment (merge conflicts), or output review.
|
|
99
|
+
- **Rules**: Hard rules for the workflow. User corrections during the reference session can be especially useful here.
|
|
100
|
+
|
|
101
|
+
**Step structure tips:**
|
|
102
|
+
- Steps that can run concurrently use sub-numbers: 3a, 3b
|
|
103
|
+
- Steps requiring the user to act get `[human]` in the title
|
|
104
|
+
- Keep simple skills simple — a 2-step skill doesn't need annotations on every step
|
|
105
|
+
|
|
106
|
+
### Step 4: Confirm and Save
|
|
107
|
+
|
|
108
|
+
Before writing the file, output the complete SKILL.md content as a yaml code block in your response so the user can review it with proper syntax highlighting. Then ask for confirmation using `ask_user_question` with a simple question like "Does this SKILL.md look good to save?" — do NOT use the body field, keep the question concise.
|
|
109
|
+
|
|
110
|
+
After writing, tell the user:
|
|
111
|
+
- Where the skill was saved
|
|
112
|
+
- How to invoke it: `/{{skill-name}} [arguments]`
|
|
113
|
+
- That they can edit the SKILL.md directly to refine it
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: stuck
|
|
3
|
+
description: Diagnose frozen/stuck/slow Illusion Code sessions on this machine and provide diagnostic report.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# /stuck — diagnose frozen/slow Illusion Code sessions
|
|
7
|
+
|
|
8
|
+
The user thinks another Illusion Code session on this machine is frozen, stuck, or very slow. Investigate and provide a diagnostic report.
|
|
9
|
+
|
|
10
|
+
## What to look for
|
|
11
|
+
|
|
12
|
+
Scan for other Illusion Code processes (excluding the current one). The command name is `illusion`.
|
|
13
|
+
|
|
14
|
+
Signs of a stuck session:
|
|
15
|
+
- **High CPU (≥90%) sustained** — likely an infinite loop. Sample twice, 1-2s apart, to confirm it's not a transient spike.
|
|
16
|
+
- **Process state `D` (uninterruptible sleep)** — often an I/O hang. The `state` column in `ps` output; first character matters (ignore modifiers like `+`, `s`, `<`).
|
|
17
|
+
- **Process state `T` (stopped)** — user probably hit Ctrl+Z by accident.
|
|
18
|
+
- **Process state `Z` (zombie)** — parent isn't reaping.
|
|
19
|
+
- **Very high RSS (≥4GB)** — possible memory leak making the session sluggish.
|
|
20
|
+
- **Stuck child process** — a hung `git`, `node`, or shell subprocess can freeze the parent. Check `pgrep -lP <pid>` for each session.
|
|
21
|
+
|
|
22
|
+
## Investigation steps
|
|
23
|
+
|
|
24
|
+
1. **List all Illusion Code processes** (macOS/Linux):
|
|
25
|
+
```
|
|
26
|
+
ps -axo pid=,pcpu=,rss=,etime=,state=,comm=,command= | grep -E 'illusion' | grep -v grep
|
|
27
|
+
```
|
|
28
|
+
Filter to rows where `comm` is `illusion` or command contains "illusion".
|
|
29
|
+
|
|
30
|
+
2. **For anything suspicious**, gather more context:
|
|
31
|
+
- Child processes: `pgrep -lP <pid>`
|
|
32
|
+
- If high CPU: sample again after 1-2s to confirm it's sustained
|
|
33
|
+
- If a child looks hung (e.g., a git command), note its full command line with `ps -p <child_pid> -o command=`
|
|
34
|
+
- Check the session's debug log if you can infer the session ID: `~/.illusion/logs/<session-id>.log` (the last few hundred lines often show what it was doing before hanging)
|
|
35
|
+
|
|
36
|
+
3. **Consider a stack dump** for a truly frozen process (advanced, optional):
|
|
37
|
+
- macOS: `sample <pid> 3` gives a 3-second native stack sample
|
|
38
|
+
- Linux: `kill -QUIT <pid>` sends a thread dump to stderr
|
|
39
|
+
- This is big — only grab it if the process is clearly hung and you want to know *why*
|
|
40
|
+
|
|
41
|
+
## Report
|
|
42
|
+
|
|
43
|
+
Format the report as a structured diagnostic:
|
|
44
|
+
|
|
45
|
+
1. **Summary** — one short line: hostname, Illusion Code version, and a terse symptom (e.g. "session PID 12345 pegged at 100% CPU for 10min")
|
|
46
|
+
2. **Details** — the full diagnostic dump:
|
|
47
|
+
- PID, CPU%, RSS, state, uptime, command line, child processes
|
|
48
|
+
- Your diagnosis of what's likely wrong
|
|
49
|
+
- Relevant debug log tail if you captured it
|
|
50
|
+
|
|
51
|
+
## Notes
|
|
52
|
+
- Don't kill or signal any processes — this is diagnostic only.
|
|
53
|
+
- If the user gave an argument (e.g., a specific PID or symptom), focus there first.
|
|
54
|
+
- If no processes are stuck, tell the user directly that everything looks healthy.
|