-
Notifications
You must be signed in to change notification settings - Fork 0
docs(agents): 优化 Astra 自主执行、授权与完成规则 #39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
e2bc313
docs(agents): streamline Astra task authorization and completion
CubePlus1 a29d719
fix(trellis): align session-start hints with authorization policy
CubePlus1 4511206
docs(trellis): make spec checks and research persistence conditional
CubePlus1 066b34c
fix(trellis): align generated task and subagent instructions
CubePlus1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,56 +1,32 @@ | ||
| # Continue Current Task | ||
|
|
||
| Resume work on the current task — pick up at the right phase/step in `.trellis/workflow.md`. | ||
| Resume the first unfinished applicable step in `.trellis/workflow.md`. Preserve the original objective, accepted decisions, and existing authorization. A status or phase change does not require another approval. | ||
|
|
||
| --- | ||
|
|
||
| ## Step 1: Load Current Context | ||
| ## Load Context | ||
|
|
||
| ```bash | ||
| python3 ./.trellis/scripts/get_context.py | ||
| ``` | ||
|
|
||
| Confirms: current task, git state, recent commits. | ||
|
|
||
| ## Step 2: Load the Phase Index | ||
|
|
||
| ```bash | ||
| python3 ./.trellis/scripts/get_context.py --mode phase | ||
| ``` | ||
|
|
||
| Shows the Phase Index (Plan / Execute / Finish) with routing + skill mapping. | ||
| Inspect current task, relevant artifacts, git state, and prior authorization. A request to continue an implementation task resumes implementation. If the prior scope was explicitly planning-only or a consequential decision remains unresolved, keep that boundary and continue independent preparation. | ||
|
|
||
| ## Step 3: Decide Where You Are | ||
| ## Route by Remaining Work | ||
|
|
||
| `get_context.py` shows the active task's `status` field. Route by `status` + artifact presence. This command replaces the user needing to remember the Trellis flow; it does not itself approve implementation. | ||
| - No active task: follow request triage; reuse/create a suitable task when useful or proceed inline for taskless work. Do not ask for process consent. | ||
| - `planning` with insufficient goal/acceptance: **1.1**, inspecting evidence before clarifying consequential gaps. | ||
| - `planning` with sufficient scope/acceptance: **1.4**, run `task.py start` and proceed if implementation is authorized. Extra documents are needed only for a concrete purpose; JSONL context is needed only for agents actually consuming it. | ||
| - `in_progress` with implementation unfinished: **2.1**. | ||
| - Implementation done but required verification missing: **2.2**. | ||
| - Verification passed: **3.3** assess useful spec updates, **3.4** perform authorized commits, then **3.5** execute wrap-up. | ||
| - `completed` but not archived: verify acceptance and run authorized finish-work steps. Never archive merely because the status says completed. | ||
|
|
||
| - `status=planning` + no `prd.md` → **1.1** (load `trellis-brainstorm`) | ||
| - `status=planning` + `prd.md` only → decide whether the task is lightweight or complex. Lightweight can move to **1.4** review; complex returns to **1.1** to add `design.md` + `implement.md`. | ||
| - `status=planning` + complex artifacts complete + sub-agent jsonl not curated (only the seed `_example` row) → **1.3** | ||
| - `status=planning` + required artifacts complete + required jsonl curated or inline mode → **1.4** (ask for start review; only run `task.py start` after user confirms) | ||
| - `status=in_progress` + implementation not started → **2.1** | ||
| - `status=in_progress` + implementation done, not yet checked → **2.2** | ||
| - `status=in_progress` + check passed → **3.3** (spec update) → **3.4** (commit) | ||
| - `status=completed` (rare; usually archived immediately) → archive flow | ||
| Skip applicable steps whose outputs are already valid. Revisit only facts affected by new evidence or scope; do not restart planning or repeat passing checks without cause. | ||
|
|
||
| Phase rules (full detail in `.trellis/workflow.md`): | ||
|
|
||
| 1. Run steps **in order** within a phase — `[required]` steps must not be skipped | ||
| 2. `[once]` steps are already done if the required output exists. `prd.md` alone can be enough only for lightweight tasks; complex tasks also need `design.md` and `implement.md`. | ||
| 3. You may go back to an earlier phase if discoveries require it | ||
|
|
||
| ## Step 4: Load the Specific Step | ||
|
|
||
| Once you know which step to resume at: | ||
| ## Execute | ||
|
|
||
| ```bash | ||
| python3 ./.trellis/scripts/get_context.py --mode phase --step <X.X> --platform claude | ||
| python3 ./.trellis/scripts/get_context.py --mode phase --step <X.Y> | ||
| ``` | ||
|
|
||
| Follow the loaded instructions. After each `[required]` step completes, move to the next. | ||
|
|
||
| --- | ||
|
|
||
| ## Reference | ||
|
|
||
| Full workflow and detailed phase steps live in `.trellis/workflow.md`. This command is only an entry point — the canonical guidance is there. | ||
| Load the relevant guidance and keep progressing to the requested outcome. Use available skills/tools; unavailable slash commands or agent types have an inline equivalent. Report an exact blocker only after independent authorized work is done. Local completion, commits, review, merge, and deployment are separate states. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,66 +1,45 @@ | ||
| # Finish Work | ||
|
|
||
| Wrap up the current session: archive the active task (and any other completed-but-unarchived tasks the user wants to clean up) and record the session journal. Code commits are NOT done here — those happen in workflow Phase 3.4 before you invoke this command. | ||
| Complete the current request's authorized wrap-up. Check acceptance before task bookkeeping; a session ending or a commit existing does not establish task completion. Apply `.trellis/workflow.md` and AGENTS.md for authorization, branches, and PR review. | ||
|
|
||
| ## Step 1: Survey current state | ||
| ## Step 1: Inspect Current State | ||
|
|
||
| ```bash | ||
| python3 ./.trellis/scripts/get_context.py --mode record | ||
| git status --porcelain | ||
| ``` | ||
|
|
||
| This prints: | ||
| Read the current task's acceptance and verification evidence. Inspect the task-owned diff and actual commits. Leave unrelated tasks alone unless the user asked to clean them up; do not introduce an unsolicited archive-confirmation prompt. | ||
|
|
||
| - **My active tasks** — review whether any besides the current one are actually done (code merged, AC met) and should be archived this round. | ||
| - **Git status** — quick visual on what's dirty. | ||
| - **Recent commits** — you'll need their hashes in Step 4 for `--commit`. | ||
| ## Step 2: Finish the Deliverable | ||
|
|
||
| If `--mode record` surfaces other completed tasks not tied to the current session, surface them to the user with a one-shot confirmation: "These N tasks look done — archive them too in this round? [y/N]". Default is no; the current active task is always archived in Step 3 regardless. | ||
| - If implementation or required checks remain, execute the applicable workflow step directly, then return here. Do not send the user away to invoke another command. | ||
| - If task changes are uncommitted and commits are authorized, perform Phase 3.4 directly. Otherwise retain the verified local diff and report commit status separately. An unrequested commit is not a local-delivery gate. | ||
| - Preserve unrelated dirty paths. Inspect mixed files/hunks before classifying ownership; stage only attributable task changes. Ask only if essential ownership cannot be established and the requested next action would affect unknown work. | ||
| - A requested PR/merge/release must satisfy its own authorization and latest-commit review requirements. Pending external work does not erase completed local work, but remains incomplete when included in the requested outcome. | ||
|
|
||
| ## Step 2: Sanity check — classify dirty paths | ||
| ## Step 3: Archive Only Completed Tasks | ||
|
|
||
| Run: | ||
| Archive a task only when its own acceptance is met, including merge/release if that task requires them. Archive only the current task or others explicitly included in the requested cleanup. Never archive an unfinished task to clear the active pointer. | ||
|
|
||
| ```bash | ||
| git status --porcelain | ||
| python3 ./.trellis/scripts/task.py archive --help | ||
| ``` | ||
|
|
||
| Filter out paths under `.trellis/workspace/` and `.trellis/tasks/` — those are managed by `add_session.py` and `task.py archive` auto-commits and will appear dirty as part of this skill's own work. | ||
|
|
||
| For each remaining dirty path, decide whether it belongs to **the current task** or to **other parallel work** (e.g., another terminal window editing the same repo). Heuristics: | ||
|
|
||
| - Paths referenced in the current task's `prd.md` / `implement.jsonl` / `check.jsonl` → current task | ||
| - Paths in code areas matching the task's stated scope, or that you remember editing this session → current task | ||
| - Paths in unrelated areas you have no recollection of touching this session → other parallel work | ||
|
|
||
| Then route: | ||
|
|
||
| - **Any remaining path looks like current-task work** — bail out with: | ||
| > "Working tree has uncommitted code changes from this task: `<list>`. Return to workflow Phase 3.4 to commit them before running `/trellis:finish-work`." | ||
|
|
||
| Do NOT run `git commit` here. Do NOT prompt the user to commit. The user goes back to Phase 3.4 and the AI drives the batched commit there. | ||
| - **All remaining paths look unrelated** (other parallel-window work) — report them once and continue to Step 3: | ||
| > "FYI, dirty files outside this task's scope — leaving them for the other window: `<list>`." | ||
| - **Genuinely unsure** — ask the user once: "Are `<list>` this task's work I forgot to commit, or another window's? (commit / ignore)" — then route per their answer. | ||
|
|
||
| ## Step 3: Archive task(s) | ||
| Inspect script/configuration side effects first. Archive can auto-commit: use a supported no-commit option when requested/needed, or leave the task unarchived if the operation cannot honor current constraints. Run permitted archive operations on a task branch only: | ||
|
|
||
| ```bash | ||
| python3 ./.trellis/scripts/task.py archive <task-name> | ||
| ``` | ||
|
|
||
| At minimum: the current active task (if any). Plus any extra tasks the user confirmed in Step 1. Each archive produces a `chore(task): archive ...` commit via the script's auto-commit. | ||
| If the user only asks to clear active state, `task.py finish` clears the session pointer without declaring completion. No active task means no archive step; do not manufacture one for this command. | ||
|
|
||
| If there is no active task and the user did not confirm any cleanup archives, skip this step. | ||
| ## Step 4: Preserve Useful Context and Report | ||
|
|
||
| ## Step 4: Record session journal | ||
| Record a journal only when it adds useful cross-session context and its side effects are authorized. Inspect `add_session.py --help` and auto-commit settings. Use actual task commit hashes; omit unsupported claims or fabricated hashes. Do not create commits merely to make a journal possible. | ||
|
|
||
| ```bash | ||
| python3 ./.trellis/scripts/add_session.py \ | ||
| --title "Session Title" \ | ||
| --commit "hash1,hash2" \ | ||
| --summary "Brief summary" | ||
| python3 ./.trellis/scripts/add_session.py --title "Session Title" --commit "<actual-task-hashes>" --summary "Useful decisions and verified outcome" | ||
| ``` | ||
|
|
||
| Use the work-commit hashes produced in Phase 3.4 (visible in Step 1's `Recent commits` list, or via `git log --oneline`) for `--commit`. Do not include the archive commit hashes from Step 3. This produces a `chore: record journal` commit. | ||
|
|
||
| Final git log order: `<work commits from 3.4>` → `chore(task): archive ...` (one or more) → `chore: record journal`. | ||
| Remove only this session's disposable temporary files. Report what was delivered, the meaningful verification, and any requested step still blocked. Distinguish local delivery, commits, PR review, merge, deployment, and task archive where relevant. Finish authorized actions yourself rather than ending with a reminder for the user to run this command. |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For a taskless or brief read-only lookup, the new contract permits returning findings directly without creating an artifact, but
.claude/skills/trellis-meta/references/platform-files/agents.md:15still defines this agent as writing into the current task'sresearch/, andcustomize-local/change-agents.md:44still says research always persists. Becausetrellis-metais the guidance used when maintaining these agent definitions, following it can reintroduce mandatory persistence or leave the agent requiring a nonexistent task directory; update those references to match this conditional contract.AGENTS.md reference: AGENTS.md:L56-L56
Useful? React with 👍 / 👎.