work-record
Use when the work on a task or story is finished - resolve the task, write work.md into its task folder, set the task status to done and open a merge request.
- License 许可
- MIT
- 最近更新
- 2026-10-30
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- work-record
- description
- Use when the work on a task or story is finished - resolve the task, write work.md into its task folder, set the task status to done and open a merge request.
03 SKILL.md 正文
Close a finished task with a work record
Steps
- Go to the workspace root: the nearest directory, walking up from where you are, where
test -f .agents/kit.jsonsucceeds. Run every command below from there. - Ask the person for the task: a tracker id, a
task:<slug>key, or a story keystory:<project>/<domain>/<slug>. Resolve it to exactly one task file<task file>; the task folder<folder>is the directory holding that file, and the task key is the frontmatterkeyof<task file>. When resolution finds nothing, stop: it is not in this workspace. When it finds several tasks, stop and list them. Change nothing.task:<slug>: runtest -f tasks/<slug>/task.md. When it fails, the task is not in this workspace.story:<project>/<domain>/<slug>: take the value of the key from.agents/index.json. When the index has no value, ortest -f <value>fails, runls projects/<project>/domains/<domain>/streams/*/stories/<slug>/story.md 2>/dev/nullinstead; exactly one printed path is<task file>(also remember for the report that the index is stale; the fix ispython3 tools/generate.py). Empty output means the story is not in this workspace.- A tracker id
<raw>: validate it first (step 3). Then take the value of<raw>from.agents/index.json. When the index has no value, rungrep -rlE "^tracker: [\"']?<raw>[\"']?$" projects tasks 2>/dev/null: exactly one printed path is<task file>(remember the stale-index line for the report), empty output means the id is not in this workspace, and several paths mean the id is used by more than one task - stop and list them.
- Validate a tracker id (only for a tracker-id input): read
tracker/trackers.json. Every entry oftrackerscarrieskeyandid_pattern; JSON doubles every backslash, so\\din the file means\d. Rewrite each pattern forgrep -E(write every\das[0-9]) and runprintf '%s\n' '<raw>' | grep -Ex '<rewritten pattern>'entry by entry until one matches. The-xmakes the whole id match, not a part of it. When no entry matches, stop: the id is not in this workspace. - Read the frontmatter of
<task file>:status,tracker. Whenstatusis notin_progress, stop and change nothing: awaitingtask must be started first and adonetask must be reopened - tell the person to run thetask-startskill in both cases. - Set
<ID>: the task'strackervalue when it is not empty, otherwise the task's slug (the<slug>oftask:<slug>, or the story slug). The branch below iswork/<ID>and the draft is.local/drafts/<ID>.md. - Read
.local/drafts/<ID>.md. If it does not exist, ask the person four questions: what changed, which decisions were taken, what is still open, and what was verified. Wait for the answers before going on. - Find the workspace default branch: run
git symbolic-ref --short refs/remotes/origin/HEADand remove theorigin/prefix; when the command fails, usemain. Call it<default>. Then run, one by one:git status --porcelain --untracked-files=no. When it prints anything, stop and tell the person: the workspace has uncommitted tracked changes. Commit nothing.git switch <default>GIT_TERMINAL_PROMPT=0 git pull --ff-only
- Collect commits. Read
repos.json: the pull has just made it the manifest of<default>, and the record is checked against it - a repository that is not in the manifest cannot go intorepos. For each entry ofrepositorieswhose directoryrepos/<name>exists, with<default_branch>from the entry:- Run
git -C repos/<name> fetch --prune. - Run
git -C repos/<name> for-each-ref --format='%(refname:short)' refs/heads refs/remotes | grep -E '(^|[^A-Za-z0-9])<ID>([^0-9]|$)'. Each printed line is one<branch>, used as printed. The grep keeps only names where<ID>is a whole token, soTASK-1does not matchfeat/TASK-10-y. - For every
<branch>, rungit -C repos/<name> log --format=%H origin/<default_branch>..<branch>. - Run
git -C repos/<name> log --format=%H -E --grep='<ID>([^0-9]|$)' origin/<default_branch>to find work that is already merged. - Write each sha as
<name>@<sha>. Keep each value once, in the order found. - A repository with at least one sha goes into
repos.
- Run
- If no repository gave a sha, ask the person which repositories and branches hold the work, and repeat step 8 for them. A repository that is not in the manifest cannot go into
repos; tell the person it must be merged into<default>first. - Collect merge requests. For each repository in
repos, look at itsforgein the manifest:gitlab: ifcommand -v glabandglab auth statusboth succeed, runglab mr list --search "<ID>" --all --output jsoninsiderepos/<name>and take everyweb_urlvalue that contains/-/merge_requests/(the otherweb_urlvalues are user profiles). Otherwise addglabto themissinglist.github: ifcommand -v ghandgh auth statusboth succeed, rungh pr list --search "<ID>" --state all --json url --jq ".[].url"insiderepos/<name>and take every printed URL. Otherwise addghto themissinglist.git: there is no merge request data; add nothing.- Keep each URL once, in the order found. Keep each name in
missingonce.
- Bring the branch
work/<ID>up:- If
git rev-parse --verify --quiet work/<ID>orgit rev-parse --verify --quiet origin/work/<ID>succeeds, the branch already exists:- For each of
work/<ID>andorigin/work/<ID>that exists, rungit diff --name-only origin/<default>...<that branch>. A generated file in the list (the list of step 15) is expected on the branch - step 15 commits those files itself, for exampleSTATUS.md- and never stops the skill. If any other printed path does not start with<folder>/, stop and tell the person which paths they are: the branch may touch the task folder and generated files only. Commit nothing. - If
origin/work/<ID>exists, the branch is already pushed. Its commits must never be rewritten. Then:- When
git rev-parse --verify --quiet work/<ID>succeeds, rungit switch work/<ID>, thengit branch --set-upstream-to=origin/work/<ID>. - Otherwise run
git switch --track origin/work/<ID>. - Run
git pull --ff-only. If it fails, stop and tell the person that the local and pushedwork/<ID>differ. Commit nothing.
- When
- If only the local
work/<ID>exists, rungit switch work/<ID>. - Bring the branch up to date: run
GIT_EDITOR=true git merge --no-edit origin/<default>. The branch may predate a repository merged into<default>; after the merge itsrepos.jsonequals the manifest of step 8, which the check tests the record against. The branch changes only<folder>/and generated files, so the merge is clean. On a conflict, follow## Conflicts. - Skip the rest of this step.
- For each of
- Otherwise run
git switch -c work/<ID>.
- If
- Write
<folder>/work.mdfrom.agents/templates/work.md:- Run
date +%Fand put its output into the frontmatter linerecorded:. repos,merge_requestsandcommitsas block lists: the linekey:, then one line- valueper value. Writekey: []when the list is empty.- Replace
<task key>in the title line with the task key and<one-line summary>with one line about the work. - Fill
## Changed,## Decisionsand## Verificationfrom the draft or the answers. Write "None." in a section with nothing to say. ## Open questionsgets exactlyNone.: a done task keeps no open questions. When the draft names an open question, ask the person to resolve it first; when they cannot, stop and leave the taskin_progress.- Write a stand as a link to its key,
[stand:<name>](<relative path from <folder> to environments.json>), never as an address. The path takes one..per folder level of<folder>: fromtasks/<slug>/(two levels) it is../../environments.json, from a story folderprojects/<p>/domains/<d>/streams/<s>/stories/<slug>/(eight levels) it is../../../../../../../../environments.json. - Never link into
.local/.
- Run
- Flip the task status in
<task file>: change thestatus:line tostatus: doneand empty theowner:andstarted:lines (the check requires them empty once the status is notin_progress; the history keeps who worked when). Change no other line. - Update the generated files and run the check. First run
command -v python3.- When it prints a path: run
python3 tools/generate.py(the record moves the task from the## In progresssection ofSTATUS.mdto## Done recently), thenpython3 tools/check.py, at most three runs in total. After each run, look only at findings that name a file this skill changed:<folder>/work.md,<task file>andSTATUS.md.- Fix such a finding when the fix needs no new value, for example a wrong list form or a missing section. Then run both commands again.
- One finding is expected and is not yours to fix:
task-state"merge_requests must not be empty when the task is done", when step 10 found no merge request. Do not stop for it; keep it for the report. - When another finding on these files needs a value only the person has, or survives the third run: stop, do not commit, list the findings, and wait.
- Findings in other files: do not fix them; list them in the report.
- When it prints nothing: apply
## Recipe: STATUS.md done fliptoSTATUS.mdand remember the linecheck not run: python3 missingfor the report.
- When it prints a path: run
- Commit: run
git status --short --untracked-files=all. Stage<folder>/- the record and the task file. Then stage every other listed path that is a generated file: its path starts with.claude/,.opencode/or.cursor/, or it is exactlyCLAUDE.md,.agents/index.json,REPOSITORIES.mdorSTATUS.md, or it matchesprojects/*/domains/*/streams/*/BREAKDOWN.md. Normally that isSTATUS.mdalone. Do not stage any other path; mention it in the report instead. Rungit commit -m "docs(work): record <ID>". - Update from the default branch:
- When step 11 found
origin/work/<ID>: runGIT_EDITOR=true git merge --no-edit origin/<default>. - Otherwise: run
GIT_TERMINAL_PROMPT=0 git pull --rebase origin <default>. - On conflicts follow
## Conflicts.
- When step 11 found
- Push and open the merge request by
params.forgein.agents/kit.json:gitlab: runGIT_TERMINAL_PROMPT=0 git push -u origin work/<ID> -o merge_request.create -o merge_request.title="Work record <ID>".github: runGIT_TERMINAL_PROMPT=0 git push -u origin work/<ID>, thengh pr create --title "Work record <ID>" --body "<folder>/work.md". Ifghis missing or the command fails, print its error and ask the person to open the pull request for branchwork/<ID>.git: runGIT_TERMINAL_PROMPT=0 git push -u origin work/<ID>, print the branch namework/<ID>and ask the person to open the merge request.- Never push with
--forceor--force-with-lease.
- If the push is rejected, print the error and these commands to finish by hand, then stop:
- When step 11 found
origin/work/<ID>:git pull --no-rebase --no-edit origin work/<ID>, thenGIT_EDITOR=true git merge --no-edit origin/<default>. - Otherwise:
git pull --rebase origin <default>. After fixing a conflict, rungit add <file>, thenGIT_EDITOR=true git rebase --continue. - Then the push for the forge:
gitlab:git push -u origin work/<ID> -o merge_request.create -o merge_request.title="Work record <ID>"github:git push -u origin work/<ID>, thengh pr create --title "Work record <ID>" --body "<folder>/work.md"git:git push -u origin work/<ID>, then open the merge request for branchwork/<ID>in the forge web page.
- When step 11 found
- Report to the person:
- the record path
<folder>/work.md; - the task file
<task file>and that itsstatusis nowdone; - the branch
work/<ID>; - the merge request link, or the instruction to open it;
missing: <names from the missing list, joined with ", ">, ormissing: none; when the list namesglaborgh, name the CLI and say thatmerge_requestsstays empty until a person installs it and adds the merge request URLs to<folder>/work.md;- the expected
merge_requests must not be empty when the task is donefinding, when step 10 found no merge request; - the check findings left in other files, if any;
- as the last line, the check result, or
check not run: python3 missing.
- the record path
Conflicts
The branch touches the task folder and the generated files of step 15, so a conflict almost always lands in a generated file.
- List all conflicted files:
git diff --name-only --diff-filter=U. - A file is generated when its path starts with
.claude/,.opencode/or.cursor/, or it is exactlyCLAUDE.md,.agents/index.json,REPOSITORIES.mdorSTATUS.md, or it matchesprojects/*/domains/*/streams/*/BREAKDOWN.md. - When every conflicted file is generated: take the default-branch version of each -
git checkout --theirs -- <file>during a merge,git checkout --ours -- <file>during a rebase (there--oursis the default branch) - then regenerate withpython3 tools/generate.py, or apply## Recipe: STATUS.md done flipwithout Python. Rungit add <file>for each file, then continue withGIT_EDITOR=true git rebase --continueorgit commit --no-edit. - When some conflicted file is not generated: run
git merge --abortorgit rebase --abort(the command of the running step). For each file that is not generated, show the person both versions with their labels: "default branch" is the output ofgit show origin/<default>:<file>, and "your branch" is the output ofgit show work/<ID>:<file>. Then stop and wait.
Example record
projects/demo/domains/operations/streams/migration/stories/documents/work.md for the story story:demo/operations/documents with tracker TASK-1, work in repository demo-bff:
---
repos:
- demo-bff
merge_requests:
- https://gitlab.example/ops/demo-bff/-/merge_requests/42
commits:
- demo-bff@2c0efd7072c42fb1df4dce53f4c284baf338a035
recorded: 2026-09-20
---
# story:demo/operations/documents: Show client documents in the new interface
## Changed
demo-bff: the `/documents` endpoint now streams files straight from object storage.
## Decisions
Files are fetched on demand; the nightly copy job stays for the audit export only.
## Open questions
None.
## Verification
Unit tests pass in demo-bff. The screen was opened on [stand:test](../../../../../../../../environments.json) and downloaded a test document.
Without Python
- Skip
python3 tools/generate.pyandpython3 tools/check.pyeverywhere in the steps. - Update
STATUS.mdby## Recipe: STATUS.md done flip. A task that was started without Python carries a row written by## Recipe: STATUS.md start flipin.agents/skills/task-start/SKILL.md; that row is what step 1 of the recipe below deletes. - End the report with the line:
check not run: python3 missing
Recipe: STATUS.md done flip
Use this only when python3 is missing. The result equals what python3 tools/generate.py writes. Only the text between the <!-- status:... --> markers changes; the drift section stays empty.
## In progress: delete the row| [<task key>](<task file>) | <started> |, where<started>is thestartedvalue of the task file. When no row is left in that owner group, delete the whole group: the### <owner>line, the blank line, its two table lines| Task | Started |and|---|---|, and one neighbouring blank line when there is one, so no two blank lines stay together.## Done recently:<recorded>is today, the newest date the section keeps. When the section holds no rows between its markers, insert directly below the begin marker:
Otherwise insert the row| Task | Recorded | |---|---| | [<task key>](<task file>) | <recorded> || [<task key>](<task file>) | <recorded> |directly below the|---|---|line; when rows dated<recorded>already exist, insert it above the first of them whose key comes after the task key, or below the last of them when none does. Keys compare character by character from the left; the first different character decides in this order:-, then.,/, digits0to9,:, upper-case lettersAtoZ,_, lower-case lettersatoz. When one key is the start of the other, the shorter one comes first.- Change nothing else in the file.
Example
maxim records story:demo/operations/documents on 2026-09-20, and the section already holds a row of the same day for story:demo/operations/documents-export, whose key comes after. Step 2 inserts the new row above it:
| Task | Recorded |
|---|---|
| [story:demo/operations/documents](projects/demo/domains/operations/streams/migration/stories/documents/story.md) | 2026-09-20 |
| [story:demo/operations/documents-export](projects/demo/domains/operations/streams/migration/stories/documents-export/story.md) | 2026-09-20 |
04 同仓库更多 Skills
verify
Use when a change in __SERVICE__ must be checked before review
work-record
Use when you finished work on a tracker task and it must be recorded in the workspace through a merge request.
task-new
Use to create one story in a stream from the stream profile's story template, link it from its scope screens and open a merge request.
task-decompose
Use to split a stream at the decomposition stage into stories - list scope screens without a story, create the accepted stories and close the stage through a merge request.
task-context
Use to gather the context of a story key or a tracker id - its story, stream stage, scope screens, repositories, decisions, mockups and work records.
repos-sync
Use to update clones of your repositories under repos/ and see their branch, lag and uncommitted changes.