@mengde1231/rudder 0.6.21 → 0.6.22

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.
Files changed (22) hide show
  1. package/README.md +148 -148
  2. package/bin/rudder.js +0 -0
  3. package/dist/migrations/manifests/0.6.22.json +9 -0
  4. package/dist/templates/claude/agents/rudder-check.md +170 -170
  5. package/dist/templates/codex/agents/rudder-check.toml +95 -95
  6. package/dist/templates/codex/config.toml +30 -30
  7. package/dist/templates/common/bundled-skills/rudder-meta/references/customize-local/change-workflow.md +5 -4
  8. package/dist/templates/common/bundled-skills/rudder-meta/references/local-architecture/task-system.md +7 -2
  9. package/dist/templates/common/bundled-skills/rudder-spec-bootstarp/SKILL.md +41 -41
  10. package/dist/templates/common/bundled-skills/rudder-spec-bootstarp/references/mcp-setup.md +90 -90
  11. package/dist/templates/common/bundled-skills/rudder-spec-bootstarp/references/repository-analysis.md +59 -59
  12. package/dist/templates/common/bundled-skills/rudder-spec-bootstarp/references/spec-task-planning.md +61 -61
  13. package/dist/templates/common/bundled-skills/rudder-spec-bootstarp/references/spec-writing.md +70 -70
  14. package/dist/templates/common/commands/continue.md +9 -5
  15. package/dist/templates/common/commands/start.md +8 -8
  16. package/dist/templates/common/skills/brainstorm.md +28 -27
  17. package/dist/templates/rudder/scripts/common/task_readiness.py +12 -5
  18. package/dist/templates/rudder/scripts/common/task_store.py +15 -36
  19. package/dist/templates/rudder/scripts/common/workflow_phase.py +45 -0
  20. package/dist/templates/rudder/scripts/task.py +18 -5
  21. package/dist/templates/rudder/workflow.md +41 -16
  22. package/package.json +26 -27
@@ -53,6 +53,7 @@ from .task_utils import (
53
53
  resolve_task_dir,
54
54
  run_task_hooks,
55
55
  )
56
+ from .workflow_phase import requires_task_context
56
57
 
57
58
 
58
59
  # =============================================================================
@@ -87,25 +88,6 @@ def ensure_tasks_dir(repo_root: Path) -> Path:
87
88
  # Sub-agent platform detection + JSONL seeding
88
89
  # =============================================================================
89
90
 
90
- # Config directories of platforms that consume implement.jsonl / check.jsonl.
91
- # Keep in sync with src/types/ai-tools.ts AI_TOOLS entries — these are the
92
- # platforms listed in workflow.md's "agent-capable" Skill Routing block
93
- # (Class-1 hook-inject + Class-2 pull-based preludes). Kilo / Antigravity /
94
- # Windsurf are NOT in this list: they do not consume JSONL.
95
- _SUBAGENT_CONFIG_DIRS: tuple[str, ...] = (
96
- ".claude",
97
- ".cursor",
98
- ".codex",
99
- ".kiro",
100
- ".gemini",
101
- ".opencode",
102
- ".qoder",
103
- ".codebuddy",
104
- ".factory", # Factory Droid
105
- ".github/copilot",
106
- ".pi", # Pi Agent
107
- )
108
-
109
91
  _SEED_EXAMPLE = (
110
92
  "Fill with {\"file\": \"<path>\", \"reason\": \"<why>\"}. "
111
93
  "Put spec/research files only — no code paths. "
@@ -114,19 +96,6 @@ _SEED_EXAMPLE = (
114
96
  )
115
97
 
116
98
 
117
- def _has_subagent_platform(repo_root: Path) -> bool:
118
- """Return True if any sub-agent-capable platform is configured.
119
-
120
- Detected by probing well-known config directories at the repo root. Used
121
- only to decide whether ``task.py create`` should seed empty
122
- ``implement.jsonl`` / ``check.jsonl`` files.
123
- """
124
- for config_dir in _SUBAGENT_CONFIG_DIRS:
125
- if (repo_root / config_dir).is_dir():
126
- return True
127
- return False
128
-
129
-
130
99
  def _write_seed_jsonl(path: Path) -> None:
131
100
  """Write a one-line seed JSONL file with a self-describing ``_example``.
132
101
 
@@ -146,6 +115,15 @@ def cmd_create(args: argparse.Namespace) -> int:
146
115
  """Create a new task."""
147
116
  repo_root = get_repo_root()
148
117
 
118
+ # Resolve before writing task files; an invalid platform must not leave a
119
+ # partially created task behind.
120
+ platform = getattr(args, "platform", None)
121
+ try:
122
+ context_required = requires_task_context(repo_root, platform)
123
+ except ValueError as exc:
124
+ print(colored(f"Error: {exc}", Colors.RED), file=sys.stderr)
125
+ return 1
126
+
149
127
  if not args.title:
150
128
  print(colored("Error: title is required", Colors.RED), file=sys.stderr)
151
129
  return 1
@@ -239,12 +217,12 @@ def cmd_create(args: argparse.Namespace) -> int:
239
217
 
240
218
  write_json(task_json_path, task_data)
241
219
 
242
- # Seed implement.jsonl / check.jsonl for sub-agent-capable platforms.
220
+ # Seed implement.jsonl / check.jsonl only for this execution mode.
243
221
  # Agent curates real entries in Phase 1.3 (see .rudder/workflow.md).
244
222
  # Agent-less platforms (Kilo / Antigravity / Windsurf) skip this — they
245
223
  # load specs via the rudder-before-dev skill instead of JSONL.
246
224
  seeded_jsonl = False
247
- if _has_subagent_platform(repo_root):
225
+ if context_required:
248
226
  for jsonl_name in ("implement.jsonl", "check.jsonl"):
249
227
  jsonl_path = task_dir / jsonl_name
250
228
  if not jsonl_path.exists():
@@ -292,6 +270,7 @@ def cmd_create(args: argparse.Namespace) -> int:
292
270
  print(colored(f"Created task: {dir_name}", Colors.GREEN), file=sys.stderr)
293
271
  print("", file=sys.stderr)
294
272
  print(colored("Next steps:", Colors.BLUE), file=sys.stderr)
273
+ platform_option = f" --platform {platform}" if platform else ""
295
274
  print(" 1. Create prd.md with requirements", file=sys.stderr)
296
275
  if seeded_jsonl:
297
276
  print(
@@ -300,10 +279,10 @@ def cmd_create(args: argparse.Namespace) -> int:
300
279
  file=sys.stderr,
301
280
  )
302
281
  print(" 3. Run: python3 task.py confirm <dir>", file=sys.stderr)
303
- print(" 4. Run: python3 task.py start <dir>", file=sys.stderr)
282
+ print(f" 4. Run: python3 task.py start <dir>{platform_option}", file=sys.stderr)
304
283
  else:
305
284
  print(" 2. Run: python3 task.py confirm <dir>", file=sys.stderr)
306
- print(" 3. Run: python3 task.py start <dir>", file=sys.stderr)
285
+ print(f" 3. Run: python3 task.py start <dir>{platform_option}", file=sys.stderr)
307
286
  print("", file=sys.stderr)
308
287
 
309
288
  # Output relative path for script chaining
@@ -16,13 +16,19 @@ Provides:
16
16
  get_phase_index - Extract the Phase Index section (no --step)
17
17
  get_step - Extract a single step (#### X.X) section
18
18
  filter_platform - Strip platform blocks that don't include the given name
19
+ requires_task_context - Shared create/start JSONL policy for the invoking mode
19
20
  """
20
21
 
21
22
  from __future__ import annotations
22
23
 
24
+ import os
23
25
  import re
26
+ from pathlib import Path
27
+ from typing import get_args
24
28
 
29
+ from .cli_adapter import Platform
25
30
  from .paths import DIR_WORKFLOW, get_repo_root
31
+ from .rudder_config import read_rudder_config
26
32
 
27
33
 
28
34
  def _workflow_md_path():
@@ -171,6 +177,45 @@ def resolve_effective_platform(platform: str, config: dict) -> str:
171
177
  return platform
172
178
 
173
179
 
180
+ # Keep the platform directories here so task creation and readiness use the
181
+ # same policy. Shared .agents/skills is not a platform-specific signal.
182
+ _SUBAGENT_CONFIG_DIRS: tuple[tuple[str, str], ...] = (
183
+ ("claude", ".claude"),
184
+ ("cursor", ".cursor"),
185
+ ("codex", ".codex"),
186
+ ("kiro", ".kiro"),
187
+ ("gemini", ".gemini"),
188
+ ("opencode", ".opencode"),
189
+ ("qoder", ".qoder"),
190
+ ("codebuddy", ".codebuddy"),
191
+ ("droid", ".factory"),
192
+ ("copilot", ".github/copilot"),
193
+ ("pi", ".pi"),
194
+ )
195
+ _INLINE_PLATFORMS = {"codex-inline", "kilo", "antigravity", "windsurf"}
196
+
197
+
198
+ def requires_task_context(repo_root: Path, platform: str | None = None) -> bool:
199
+ """Whether this invocation needs curated implement/check JSONL context.
200
+
201
+ Explicit --platform wins over RUDDER_PLATFORM. Without either, preserve
202
+ directory-based detection conservatively: any configured sub-agent mode
203
+ requires context. Mixed-platform repositories should pass --platform so a
204
+ Codex inline session cannot inherit another platform's requirements.
205
+ """
206
+ config = read_rudder_config(repo_root)
207
+ selected = platform or os.environ.get("RUDDER_PLATFORM", "").strip().lower()
208
+ if selected:
209
+ if selected not in get_args(Platform):
210
+ raise ValueError(f"Unsupported platform: {selected}")
211
+ return resolve_effective_platform(selected, config) not in _INLINE_PLATFORMS
212
+ return any(
213
+ (repo_root / config_dir).is_dir()
214
+ and resolve_effective_platform(name, config) not in _INLINE_PLATFORMS
215
+ for name, config_dir in _SUBAGENT_CONFIG_DIRS
216
+ )
217
+
218
+
174
219
  def filter_platform(content: str, platform: str) -> str:
175
220
  """Keep lines outside any `[...]` block + lines inside blocks that include platform.
176
221
 
@@ -4,12 +4,12 @@
4
4
  Task Management Script.
5
5
 
6
6
  Usage:
7
- python3 task.py create "<title>" [--slug <name>] [--assignee <dev>] [--priority P0|P1|P2|P3] [--parent <dir>] [--package <pkg>]
7
+ python3 task.py create "<title>" [--slug <name>] [--assignee <dev>] [--priority P0|P1|P2|P3] [--parent <dir>] [--package <pkg>] [--platform <platform>]
8
8
  python3 task.py add-context <dir> <file> <path> [reason] # Add jsonl entry
9
9
  python3 task.py validate <dir> # Validate jsonl files
10
10
  python3 task.py confirm <dir> # Confirm PRD requirements
11
11
  python3 task.py list-context <dir> # List jsonl entries
12
- python3 task.py start <dir> # Set active task
12
+ python3 task.py start <dir> [--platform <platform>] # Validate readiness and set active task
13
13
  python3 task.py current [--source] # Show active task
14
14
  python3 task.py finish # Clear active task
15
15
  python3 task.py set-branch <dir> <branch> # Set git branch
@@ -26,7 +26,9 @@ from __future__ import annotations
26
26
 
27
27
  import argparse
28
28
  import sys
29
+ from typing import get_args
29
30
 
31
+ from common.cli_adapter import Platform
30
32
  from common.log import Colors, colored
31
33
  from common.paths import (
32
34
  DIR_WORKFLOW,
@@ -106,7 +108,13 @@ def cmd_start(args: argparse.Namespace) -> int:
106
108
  print(colored(f"Error: task.json is invalid at {full_path}", Colors.RED))
107
109
  return 1
108
110
  if task_data and task_data.get("status") == "planning":
109
- readiness_errors = validate_task_readiness(full_path, repo_root, task_data)
111
+ try:
112
+ readiness_errors = validate_task_readiness(
113
+ full_path, repo_root, task_data, getattr(args, "platform", None),
114
+ )
115
+ except ValueError as exc:
116
+ print(colored(f"Error: {exc}", Colors.RED))
117
+ return 1
110
118
  if readiness_errors:
111
119
  print(colored("Task is not ready for implementation:", Colors.RED))
112
120
  for error in readiness_errors:
@@ -153,7 +161,7 @@ def cmd_start(args: argparse.Namespace) -> int:
153
161
  print(colored("✓ Status: planning → in_progress", Colors.GREEN))
154
162
 
155
163
  print()
156
- print(colored("The hook will now inject context from this task's jsonl files.", Colors.BLUE))
164
+ print(colored("Task selected. Follow the workflow for the current execution mode.", Colors.BLUE))
157
165
 
158
166
  run_task_hooks("after_start", task_json_path, repo_root)
159
167
  return 0
@@ -328,12 +336,13 @@ def show_usage() -> None:
328
336
  Usage:
329
337
  python3 task.py create <title> Create new task directory
330
338
  python3 task.py create <title> --package <pkg> Create task for a specific package
339
+ python3 task.py create <title> --platform codex Create using Codex dispatch mode
331
340
  python3 task.py create <title> --parent <dir> Create task as child of parent
332
341
  python3 task.py add-context <dir> <jsonl> <path> [reason] Add entry to jsonl
333
342
  python3 task.py validate <dir> Validate jsonl files
334
343
  python3 task.py confirm <dir> Confirm requirements and PRD
335
344
  python3 task.py list-context <dir> List jsonl entries
336
- python3 task.py start <dir> Set active task
345
+ python3 task.py start <dir> [--platform <platform>] Validate readiness and set active task
337
346
  python3 task.py current [--source] Show active task
338
347
  python3 task.py finish Clear active task
339
348
  python3 task.py set-branch <dir> <branch> Set git branch
@@ -421,6 +430,8 @@ def main() -> int:
421
430
  p_create.add_argument("--description", "-d", help="Task description")
422
431
  p_create.add_argument("--parent", help="Parent task directory (establishes subtask link)")
423
432
  p_create.add_argument("--package", help="Package name for monorepo projects")
433
+ p_create.add_argument("--platform", choices=get_args(Platform),
434
+ help="Invoking platform; determines whether to seed JSONL context")
424
435
 
425
436
  # add-context
426
437
  p_add = subparsers.add_parser("add-context", help="Add context entry")
@@ -444,6 +455,8 @@ def main() -> int:
444
455
  # start
445
456
  p_start = subparsers.add_parser("start", help="Set active task")
446
457
  p_start.add_argument("dir", help="Task directory")
458
+ p_start.add_argument("--platform", choices=get_args(Platform),
459
+ help="Invoking platform; determines JSONL readiness requirements")
447
460
 
448
461
  # current
449
462
  p_current = subparsers.add_parser("current", help="Show active task")
@@ -43,8 +43,8 @@ Every task has its own directory under `.rudder/tasks/{MM-DD-name}/` holding `pr
43
43
 
44
44
  ```bash
45
45
  # Task lifecycle
46
- python3 ./.rudder/scripts/task.py create "<title>" [--slug <name>] [--parent <dir>]
47
- python3 ./.rudder/scripts/task.py start <name> # set active task (session-scoped when available)
46
+ python3 ./.rudder/scripts/task.py create "<title>" [--slug <name>] [--parent <dir>] --platform <platform>
47
+ python3 ./.rudder/scripts/task.py start <name> --platform <platform> # validate readiness and enter implementation
48
48
  python3 ./.rudder/scripts/task.py current --source # show active task and source
49
49
  python3 ./.rudder/scripts/task.py finish # clear active task (triggers after_finish hooks)
50
50
  python3 ./.rudder/scripts/task.py archive <name> # move to archive/{year-month}/
@@ -73,6 +73,8 @@ python3 ./.rudder/scripts/task.py create-pr [name] [--dry-run]
73
73
 
74
74
  > Run `python3 ./.rudder/scripts/task.py --help` to see the authoritative, up-to-date list.
75
75
 
76
+ Replace `<platform>` with the invoking CLI flag (e.g. `codex`, `claude`, `cursor`). Creation and startup share the same context policy: explicit `--platform` takes precedence over `RUDDER_PLATFORM`; without either, any configured sub-agent mode requires JSONL. Pass the invoking platform in mixed-platform repositories. Codex resolves `codex.dispatch_mode` (default `inline`); inline execution does not require JSONL even when old seed files exist, while sub-agent execution requires both curated context files even when they are missing.
77
+
76
78
  **Current-task mechanism**: `task.py create` creates the task directory and (when session identity is available) auto-sets the per-session active-task pointer so the planning breadcrumb fires immediately. After the final PRD is confirmed with `task.py confirm`, `task.py start` writes the same pointer (idempotent if already set) and flips `task.json.status` from `planning` to `in_progress`; it refuses to start when the PRD, confirmation hash, acceptance criteria, or applicable JSONL context is incomplete. State is stored under `.rudder/.runtime/sessions/`. If no context key is available, start still performs the readiness gate and then uses degraded mode without persisting a session pointer. `task.py finish` deletes the current session file (status unchanged). `task.py archive <task>` writes `status=completed`, moves the directory to `archive/`, and deletes any runtime session files that still point at the archived task.
77
79
 
78
80
  ### Workspace System
@@ -147,12 +149,28 @@ Phase 2: Execute → write code and pass quality checks
147
149
  Phase 3: Finish → distill lessons + wrap-up
148
150
  ```
149
151
 
152
+ ### Request routing (before every phase)
153
+
154
+ Decide what the user is asking for before following an active task's phase. Task boundaries follow **business objective and acceptance scope**, not the conversation, module, file count, or mere presence of an active pointer.
155
+
156
+ Apply these rules in order:
157
+
158
+ 1. **Direct answer/action**: questions, explanations, code inspection, scheduler/Cron administration, and commit-message drafting do not create or advance a task. Only provide the requested output/action; a request for commit wording is not permission to commit or archive. Developing a scheduled business feature still follows the rules below. Read depth and answer length do not determine whether a task is needed.
159
+ 2. **Reuse related unfinished work**: read the candidate task's goal, requirements, acceptance criteria, and status. Supplements, corrections, fixes before acceptance, continuation, and moving from design to development reuse that task and update relevant artifacts. Check current and other unfinished tasks as needed; same session/module alone does not establish relevance. Reuse takes priority over treating a related correction as a separate quick edit. If ownership is genuinely ambiguous, ask one focused question.
160
+ 3. **Direct low-risk edit**: a clear, local, low-risk independent change can be made directly with the relevant guidelines and smallest meaningful validation. No special bypass phrase is required. Assess behavior and contracts, not number of files; changes to permissions, data structures, API contracts, transactions, caches, or cross-module business rules need the task workflow.
161
+ 4. **New tracked objective**: create a task for an independent business objective needing durable planning and its own acceptance outcome. An unrelated active task must not absorb it. Leave the previous task's artifacts/status intact; task creation can switch this session's pointer. For defects after a task was completed/archived, normally create a linked follow-up rather than rewriting historical acceptance.
162
+
163
+ **Approval reuse**: an explicit instruction such as “implement this plan” / “按方案开发” approves the clearly agreed requirements. Record that approval with `task.py confirm` and proceed; do not ask the same question again at each phase. Ask only when a new business decision or a material scope/acceptance change needs user input. Implementation details do not need repeated approval. The existing PRD hash gate still applies: update the confirmation record while planning when the agreed PRD changes; never invent approval for new requirements.
164
+
150
165
  <!-- Per-turn breadcrumb: shown when there is no active task (before Phase 1) -->
151
166
 
152
167
  [workflow-state:no_task]
153
- No active task. **A Direct answer** — pure Q&A / explanation / lookup / chat; no file writes + one-line answer + repo reads ≤ 2 files → AI judges, no override needed.
154
- **B Create a task** — implementation / code change / build / refactor work that is not an explicit Fast Path or requires a durable task record. Entry sequence: create the task, load `rudder-brainstorm`, complete the PRD and required context, then run `task.py start <task-dir>`.
155
- **C Inline change** (per-turn fast path) — the user's CURRENT message may explicitly contain one of: "skip rudder" / "no task" / "just do it" / "don't create a task" / "跳过 rudder" / "别走流程" / "小修一下" / "直接改" / "先别建任务". When present, acknowledge briefly, skip task creation and per-turn workflow injection, then make the requested low-risk change and run the smallest relevant validation. This is not permission to bypass safety checks for database, API, permission, transaction, cache, or cross-module changes.
168
+ No active task. Apply Request routing by business objective and acceptance scope.
169
+ For development requests, check related unfinished work (B) before choosing a direct independent edit (A) or creating a task (C).
170
+ **A Direct work** — questions, code inspection, scheduler administration, commit-message drafting, or clear/local/low-risk independent edits: answer or act directly with necessary validation; no task, no phase advancement, no file-count/read-depth limits. Commit wording alone never authorizes a Git commit.
171
+ **B Reuse** — supplements, corrections, fixes, continuation, or design-to-development serving an existing unfinished goal reuse that task and its PRD; same session/module alone is insufficient. Check unfinished tasks before creating another.
172
+ **C New task** — an independent objective needing durable planning and its own acceptance outcome gets a new task. Create → complete PRD and applicable context → confirm already-approved requirements → start with `--platform <platform>`. Do not repeat approval already given for the agreed plan.
173
+ An explicit per-turn bypass (e.g. "skip rudder", "no task", "直接改", "先别建任务") also allows the requested low-risk edit. It does not bypass necessary safety checks for database, API, permission, transaction, cache, or cross-module changes.
156
174
  [/workflow-state:no_task]
157
175
 
158
176
  ### Phase 1: Plan
@@ -167,10 +185,11 @@ No active task. **A Direct answer** — pure Q&A / explanation / lookup / chat;
167
185
  <!-- Per-turn breadcrumb: shown throughout Phase 1 (status='planning') -->
168
186
 
169
187
  [workflow-state:planning]
188
+ First apply Request routing: questions/inspection/scheduler administration/commit wording are direct requests; related work reuses this task; an unrelated objective needs its own task unless it is a clear/local/low-risk direct edit. Never infer task ownership from session/module alone.
170
189
  Load the `rudder-brainstorm` skill and iterate on prd.md with the user.
171
190
  Phase 1.0.5 (conditional, once): if this task involves DDL operations (create/alter tables, add/drop columns, migration scripts), create `{TASK_DIR}/sql/` via `mkdir -p .rudder/tasks/<task-dir>/sql/`. Skip if no database changes.
172
191
  Phase 1.3 (required, once): before `task.py start`, you MUST curate `implement.jsonl` and `check.jsonl` — list the spec / research files sub-agents need so they get the right context injected. You may skip only if the jsonl already has agent-curated entries (the seed `_example` row alone doesn't count).
173
- Before `task.py start`, run `task.py confirm <task-dir>` after the user approves the final `prd.md`; this records the PRD hash and blocks stale or unconfirmed requirements. Then run `task.py start <task-dir>` to flip status to in_progress.
192
+ Before `task.py start`, run `task.py confirm <task-dir>` after the user approves the final `prd.md`; an existing instruction to implement the agreed plan counts, so do not ask again. This records the PRD hash and blocks stale or unconfirmed requirements. Then run `task.py start <task-dir> --platform <platform>` to flip status to in_progress. PRD existence alone does not mean planning is complete.
174
193
  [/workflow-state:planning]
175
194
 
176
195
  <!-- Per-turn breadcrumb: shown throughout Phase 1 when codex.dispatch_mode=inline.
@@ -180,10 +199,11 @@ Before `task.py start`, run `task.py confirm <task-dir>` after the user approves
180
199
  into a sub-agent. -->
181
200
 
182
201
  [workflow-state:planning-inline]
202
+ First apply Request routing: questions/inspection/scheduler administration/commit wording are direct requests; related work reuses this task; an unrelated objective needs its own task unless it is a clear/local/low-risk direct edit. Never infer task ownership from session/module alone.
183
203
  Load the `rudder-brainstorm` skill and iterate on prd.md with the user.
184
204
  Phase 1.0.5 (conditional, once): if this task involves DDL operations (create/alter tables, add/drop columns, migration scripts), create `{TASK_DIR}/sql/` via `mkdir -p .rudder/tasks/<task-dir>/sql/`. Skip if no database changes.
185
205
  Phase 1.3 jsonl curation is **skipped** in inline dispatch mode — the main session loads `rudder-before-dev` directly in Phase 2 and reads spec context itself, so there is no sub-agent to inject jsonl into.
186
- Before `task.py start`, run `task.py confirm <task-dir>` after the user approves the final `prd.md`; this records the PRD hash and blocks stale or unconfirmed requirements. Then run `task.py start <task-dir>` to flip status to in_progress.
206
+ Before `task.py start`, run `task.py confirm <task-dir>` after the user approves the final `prd.md`; an existing instruction to implement the agreed plan counts, so do not ask again. This records the PRD hash and blocks stale or unconfirmed requirements. Then run `task.py start <task-dir> --platform codex` to flip status to in_progress. Existing JSONL seed files do not block inline startup. PRD existence alone does not mean planning is complete.
187
207
  [/workflow-state:planning-inline]
188
208
 
189
209
  ### Phase 2: Execute
@@ -198,6 +218,7 @@ Before `task.py start`, run `task.py confirm <task-dir>` after the user approves
198
218
  commit, including Phase 3.3 spec update and Phase 3.4 commit. -->
199
219
 
200
220
  [workflow-state:in_progress]
221
+ First apply Request routing: questions/inspection/scheduler administration/commit wording do not advance this task; related corrections/continuation reuse it; unrelated objectives get their own task unless they qualify for direct low-risk work. Same session/module does not establish relevance. Already-approved requirements do not need another approval.
201
222
  **Flow**: finish all implementation work → rudder-check review → Verify (lint/type-check/tests/build) → fix all findings → rerun Verify if needed → conditional rudder-update-spec → commit (Phase 3.4) → `/rudder:finish-work`.
202
223
  **Main-session default (no override)**: dispatch the `rudder-implement` / `rudder-check` sub-agents — the main agent does NOT edit code by default. Phase 3.4 commit (required, once): after rudder-update-spec, or whenever implementation is verifiably complete, the main agent **drives the commit** — run `git diff --stat` to show changes, state the proposed commit message, then check `code_auto_commit` in `.rudder/config.yaml`: if **false** (default), **ask the user for confirmation (Y/n)** before running `git commit`; if **true**, commit directly without prompting. Only after commit, suggest `/rudder:finish-work`. `/finish-work` refuses to run on a dirty working tree (paths outside `.rudder/workspace/` and `.rudder/tasks/`).
203
224
  **Sub-agent self-exemption**: if you are already running as `rudder-implement`, implement directly from the loaded task context and do NOT spawn another `rudder-implement`; if you are already running as `rudder-check`, review/fix directly and do NOT spawn another `rudder-check`. The default dispatch rule applies to the main session only.
@@ -211,6 +232,7 @@ Before `task.py start`, run `task.py confirm <task-dir>` after the user approves
211
232
  instead of dispatching sub-agents. -->
212
233
 
213
234
  [workflow-state:in_progress-inline]
235
+ First apply Request routing: questions/inspection/scheduler administration/commit wording do not advance this task; related corrections/continuation reuse it; unrelated objectives get their own task unless they qualify for direct low-risk work. Same session/module does not establish relevance. Already-approved requirements do not need another approval.
214
236
  **Flow** (inline mode): main session loads `rudder-before-dev` → main session finishes all code changes → main session loads `rudder-check` for the full task diff → Verify lint / type-check / tests / build → fix all findings → rerun Verify if needed → conditional `rudder-update-spec` → commit (Phase 3.4) → `/rudder:finish-work`.
215
237
  **Main-session default (inline dispatch_mode)**: the main agent edits code directly. Do NOT dispatch `rudder-implement` / `rudder-check` sub-agents. Load the `rudder-before-dev` skill before writing code; load the `rudder-check` skill before reporting completion.
216
238
  Phase 3.4 commit (required, once): after `rudder-update-spec`, or whenever implementation is verifiably complete, the main agent **drives the commit** — run `git diff --stat` to show changes, state the proposed commit message, then check `code_auto_commit` in `.rudder/config.yaml`: if **false** (default), **ask the user for confirmation (Y/n)** before running `git commit`; if **true**, commit directly without prompting. Only after commit, suggest `/rudder:finish-work`. `/finish-work` refuses to run on a dirty working tree (paths outside `.rudder/workspace/` and `.rudder/tasks/`).
@@ -232,6 +254,7 @@ Phase 3.4 commit (required, once): after `rudder-update-spec`, or whenever imple
232
254
  channel as the live blocks. -->
233
255
 
234
256
  [workflow-state:completed]
257
+ First apply Request routing. Answer questions/inspection/commit-wording requests directly; do not attach independent new work to this completed task. Normally track post-completion defects as linked follow-ups.
235
258
  Code committed via Phase 3.4; run `/rudder:finish-work` to wrap up (archive the task + record session).
236
259
  If you reach this state with uncommitted code, return to Phase 3.4 first — `/finish-work` refuses to run on a dirty working tree.
237
260
  `task.py archive` deletes any runtime session files that still point at the archived task.
@@ -239,14 +262,14 @@ If you reach this state with uncommitted code, return to Phase 3.4 first — `/f
239
262
 
240
263
  ### Rules
241
264
 
242
- 1. Identify which Phase you're in, then continue from the next step there
265
+ 1. Apply Request routing, establish task relevance, then identify the phase and next step
243
266
  2. Run steps in order inside each Phase; `[required]` steps can't be skipped
244
267
  3. Phases can roll back (e.g., Execute reveals a prd defect → return to Plan to fix, then re-enter Execute)
245
- 4. Steps tagged `[once]` are skipped if the output already exists; don't re-run
268
+ 4. Skip `[once]` steps only when their completion conditions hold. PRD existence alone is insufficient; require resolved requirements, current approval/confirmation, and both valid curated JSONL files when applicable.
246
269
 
247
270
  ### Skill Routing
248
271
 
249
- When a user request matches one of these intents, load the corresponding skill (or dispatch the corresponding sub-agent) first — do not skip skills.
272
+ After Request routing selects tracked work, use the skill/sub-agent routes below. Direct low-risk edits read relevant guidelines (via `rudder-before-dev` where available) and run the smallest meaningful validation; they do not enter task creation, sub-agent dispatch, or finish/commit phases automatically.
250
273
 
251
274
  [Claude Code, Cursor, OpenCode, codex-sub-agent, Kiro, Gemini, Qoder, CodeBuddy, Copilot, Droid, Pi]
252
275
 
@@ -318,7 +341,7 @@ Goal: figure out what to build, produce a clear requirements doc and the context
318
341
  Create the task directory (status enters `planning`, the session active-task pointer auto-targets the new task when session identity is available):
319
342
 
320
343
  ```bash
321
- python3 ./.rudder/scripts/task.py create "<task title>" --slug <name>
344
+ python3 ./.rudder/scripts/task.py create "<task title>" --slug <name> --platform <platform>
322
345
  ```
323
346
 
324
347
  `--slug` is the human-readable name only. Do **not** include the `MM-DD-` date prefix; `task.py create` adds that prefix automatically.
@@ -327,7 +350,7 @@ After this command succeeds, the per-turn breadcrumb auto-switches to `[workflow
327
350
 
328
351
  ⚠️ **Run only `create` here — do not also run `start`**. `start` flips status to `in_progress`, which switches the breadcrumb to the implementation phase before brainstorm + jsonl are done — the AI will silently skip them. Save `start` for step 1.4, after jsonl curation is complete.
329
352
 
330
- Skip when `python3 ./.rudder/scripts/task.py current --source` already points to a task.
353
+ Skip creation only when the request belongs to a related unfinished task. Read its goal and acceptance scope before reusing it; a current pointer alone is not sufficient. Design-to-development work keeps the same task.
331
354
 
332
355
  #### 1.0.5 Prepare SQL directory `[conditional · once]`
333
356
 
@@ -347,6 +370,8 @@ mkdir -p .rudder/tasks/<task-dir>/sql/
347
370
 
348
371
  Load the `rudder-brainstorm` skill and explore requirements interactively with the user per the skill's guidance.
349
372
 
373
+ If the user already approved the clearly agreed plan, persist it and proceed without another approval question. Revisit only unresolved business decisions or material scope/acceptance changes.
374
+
350
375
  The brainstorm skill will guide you to:
351
376
  - Ask one question at a time
352
377
  - Prefer researching over asking the user
@@ -425,7 +450,7 @@ python3 ./.rudder/scripts/task.py add-context "$TASK_DIR" check "<path>" "<reaso
425
450
 
426
451
  Delete the seed `_example` line once real entries exist (optional — it's skipped automatically by consumers).
427
452
 
428
- Skip when: `implement.jsonl` has agent-curated entries (the seed row alone doesn't count).
453
+ Skip when: both `implement.jsonl` and `check.jsonl` already have valid agent-curated entries (seed rows alone do not count).
429
454
 
430
455
  [/Claude Code, Cursor, OpenCode, codex-sub-agent, Kiro, Gemini, Qoder, CodeBuddy, Copilot, Droid, Pi]
431
456
 
@@ -441,12 +466,12 @@ Once prd.md is complete, the user has confirmed it, and 1.3 jsonl curation is do
441
466
 
442
467
  ```bash
443
468
  python3 ./.rudder/scripts/task.py confirm <task-dir>
444
- python3 ./.rudder/scripts/task.py start <task-dir>
469
+ python3 ./.rudder/scripts/task.py start <task-dir> --platform <platform>
445
470
  ```
446
471
 
447
472
  After this command succeeds, the breadcrumb auto-switches to `[workflow-state:in_progress]`, and the rest of Phase 2 / 3 follows.
448
473
 
449
- If `task.py start` errors with a session-identity message (no context key from hook input, `RUDDER_CONTEXT_ID`, or platform-native session env), follow the hint in the error to set up session identity, then retry.
474
+ Use the invoking platform; Codex inline skips JSONL curation and validation even if seed files remain, while sub-agent modes require both curated files. A readiness failure leaves the task in planning: resolve its reported PRD/approval/context blockers and retry. When session identity is unavailable, start still validates readiness and enters implementation in degraded mode without persisting a session pointer.
450
475
 
451
476
  #### 1.5 Completion criteria
452
477
 
@@ -461,7 +486,7 @@ If `task.py start` errors with a session-identity message (no context key from h
461
486
 
462
487
  [Claude Code, Cursor, OpenCode, codex-sub-agent, Kiro, Gemini, Qoder, CodeBuddy, Copilot, Droid, Pi]
463
488
 
464
- | `implement.jsonl` has agent-curated entries (not just the seed row) | ✅ |
489
+ | Both `implement.jsonl` and `check.jsonl` have valid agent-curated entries (not just seed rows) | ✅ |
465
490
 
466
491
  [/Claude Code, Cursor, OpenCode, codex-sub-agent, Kiro, Gemini, Qoder, CodeBuddy, Copilot, Droid, Pi]
467
492
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mengde1231/rudder",
3
- "version": "0.6.21",
3
+ "version": "0.6.22",
4
4
  "description": "AI capabilities grow like ivy — Rudder provides the structure to guide them along a disciplined path",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -12,31 +12,6 @@
12
12
  "publishConfig": {
13
13
  "access": "public"
14
14
  },
15
- "scripts": {
16
- "build": "pnpm run clean && tsc && pnpm run copy-templates",
17
- "clean": "node -e \"require('node:fs').rmSync('dist', { recursive: true, force: true })\"",
18
- "copy-templates": "node scripts/copy-templates.js",
19
- "dev": "tsc --watch",
20
- "start": "node ./dist/cli/index.js",
21
- "test": "vitest run",
22
- "test:watch": "vitest",
23
- "test:coverage": "vitest run --coverage",
24
- "lint": "eslint src/ test/",
25
- "lint:fix": "eslint src/ test/ --fix",
26
- "format": "prettier --write src/",
27
- "format:check": "prettier --check src/",
28
- "typecheck": "tsc --noEmit",
29
- "lint:py": "basedpyright",
30
- "lint:all": "pnpm lint && pnpm lint:py",
31
- "prepublishOnly": "pnpm test && pnpm run build && node -e \"const fs=require('node:fs'); fs.copyFileSync('../../README.md','README.md'); fs.copyFileSync('../../LICENSE','LICENSE')\"",
32
- "release": "node scripts/check-manifest-continuity.js && pnpm test && git add -A -- ':!docs-site' && (git diff-index --quiet HEAD || git commit -m 'chore: pre-release updates') && pnpm version --no-git-tag-version patch && V=$(node -p \"require('./package.json').version\") && git add package.json && git commit -m \"$V\" && git tag \"v$V\" && git push origin main --tags",
33
- "release:minor": "node scripts/check-manifest-continuity.js && pnpm test && git add -A -- ':!docs-site' && (git diff-index --quiet HEAD || git commit -m 'chore: pre-release updates') && pnpm version --no-git-tag-version minor && V=$(node -p \"require('./package.json').version\") && git add package.json && git commit -m \"$V\" && git tag \"v$V\" && git push origin main --tags",
34
- "release:major": "node scripts/check-manifest-continuity.js && pnpm test && git add -A -- ':!docs-site' && (git diff-index --quiet HEAD || git commit -m 'chore: pre-release updates') && pnpm version --no-git-tag-version major && V=$(node -p \"require('./package.json').version\") && git add package.json && git commit -m \"$V\" && git tag \"v$V\" && git push origin main --tags",
35
- "release:beta": "node scripts/check-manifest-continuity.js && node scripts/check-docs-changelog.js --type beta && pnpm test && git add -A -- ':!docs-site' && (git diff-index --quiet HEAD || git commit -m 'chore: pre-release updates') && pnpm version --no-git-tag-version prerelease --preid beta && V=$(node -p \"require('./package.json').version\") && git add package.json && git commit -m \"$V\" && git tag \"v$V\" && git push origin HEAD --tags",
36
- "release:rc": "node scripts/check-manifest-continuity.js && node scripts/check-docs-changelog.js --type rc && pnpm test && git add -A -- ':!docs-site' && (git diff-index --quiet HEAD || git commit -m 'chore: pre-release updates') && pnpm version --no-git-tag-version prerelease --preid rc && V=$(node -p \"require('./package.json').version\") && git add package.json && git commit -m \"$V\" && git tag \"v$V\" && git push origin HEAD --tags",
37
- "release:promote": "node scripts/check-manifest-continuity.js && node scripts/check-docs-changelog.js --type promote && pnpm test && git add -A -- ':!docs-site' && (git diff-index --quiet HEAD || git commit -m 'chore: pre-release updates') && pnpm version --no-git-tag-version \"$(node -p \"require('./package.json').version.replace(/-.*/, '')\")\" && V=$(node -p \"require('./package.json').version\") && git add package.json && git commit -m \"$V\" && git tag \"v$V\" && git push origin main --tags",
38
- "manifest": "node scripts/create-manifest.js"
39
- },
40
15
  "keywords": [
41
16
  "ai",
42
17
  "workflow",
@@ -84,5 +59,29 @@
84
59
  "repository": {
85
60
  "type": "git",
86
61
  "url": "https://github.com/MengDe1231/Rudder.git"
62
+ },
63
+ "scripts": {
64
+ "build": "pnpm run clean && tsc && pnpm run copy-templates",
65
+ "clean": "node -e \"require('node:fs').rmSync('dist', { recursive: true, force: true })\"",
66
+ "copy-templates": "node scripts/copy-templates.js",
67
+ "dev": "tsc --watch",
68
+ "start": "node ./dist/cli/index.js",
69
+ "test": "vitest run",
70
+ "test:watch": "vitest",
71
+ "test:coverage": "vitest run --coverage",
72
+ "lint": "eslint src/ test/",
73
+ "lint:fix": "eslint src/ test/ --fix",
74
+ "format": "prettier --write src/",
75
+ "format:check": "prettier --check src/",
76
+ "typecheck": "tsc --noEmit",
77
+ "lint:py": "basedpyright",
78
+ "lint:all": "pnpm lint && pnpm lint:py",
79
+ "release": "node scripts/check-manifest-continuity.js && pnpm test && git add -A -- ':!docs-site' && (git diff-index --quiet HEAD || git commit -m 'chore: pre-release updates') && pnpm version --no-git-tag-version patch && V=$(node -p \"require('./package.json').version\") && git add package.json && git commit -m \"$V\" && git tag \"v$V\" && git push origin main --tags",
80
+ "release:minor": "node scripts/check-manifest-continuity.js && pnpm test && git add -A -- ':!docs-site' && (git diff-index --quiet HEAD || git commit -m 'chore: pre-release updates') && pnpm version --no-git-tag-version minor && V=$(node -p \"require('./package.json').version\") && git add package.json && git commit -m \"$V\" && git tag \"v$V\" && git push origin main --tags",
81
+ "release:major": "node scripts/check-manifest-continuity.js && pnpm test && git add -A -- ':!docs-site' && (git diff-index --quiet HEAD || git commit -m 'chore: pre-release updates') && pnpm version --no-git-tag-version major && V=$(node -p \"require('./package.json').version\") && git add package.json && git commit -m \"$V\" && git tag \"v$V\" && git push origin main --tags",
82
+ "release:beta": "node scripts/check-manifest-continuity.js && node scripts/check-docs-changelog.js --type beta && pnpm test && git add -A -- ':!docs-site' && (git diff-index --quiet HEAD || git commit -m 'chore: pre-release updates') && pnpm version --no-git-tag-version prerelease --preid beta && V=$(node -p \"require('./package.json').version\") && git add package.json && git commit -m \"$V\" && git tag \"v$V\" && git push origin HEAD --tags",
83
+ "release:rc": "node scripts/check-manifest-continuity.js && node scripts/check-docs-changelog.js --type rc && pnpm test && git add -A -- ':!docs-site' && (git diff-index --quiet HEAD || git commit -m 'chore: pre-release updates') && pnpm version --no-git-tag-version prerelease --preid rc && V=$(node -p \"require('./package.json').version\") && git add package.json && git commit -m \"$V\" && git tag \"v$V\" && git push origin HEAD --tags",
84
+ "release:promote": "node scripts/check-manifest-continuity.js && node scripts/check-docs-changelog.js --type promote && pnpm test && git add -A -- ':!docs-site' && (git diff-index --quiet HEAD || git commit -m 'chore: pre-release updates') && pnpm version --no-git-tag-version \"$(node -p \"require('./package.json').version.replace(/-.*/, '')\")\" && V=$(node -p \"require('./package.json').version\") && git add package.json && git commit -m \"$V\" && git tag \"v$V\" && git push origin main --tags",
85
+ "manifest": "node scripts/create-manifest.js"
87
86
  }
88
- }
87
+ }