@rt-tools/agent-kit 0.35.0 → 0.37.0

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.
@@ -221,6 +221,12 @@ skill_for_default() {
221
221
  rt_gate_invokes "$target" "(gh[[:space:]]+pr|glab[[:space:]]+mr)[[:space:]]+merge" \
222
222
  && printf '%s\n' 'task-flow'
223
223
 
224
+ # Declaring an epic and creating its tasks follow the rule of the epic: the card, the
225
+ # plan and every task at once. Required as the SECOND layer, on top of the delivery rule.
226
+ rt_gate_invokes "$target" "[^[:space:]]*task:new" \
227
+ && printf '%s' "$target" | grep -qE -- '--epic(-of)?([[:space:]=]|$)' \
228
+ && printf '%s\n' 'epic-flow'
229
+
224
230
  # A request to a running application: what lies here is not the code but what answers on
225
231
  # the port. The reply of the previous session's build is indistinguishable from the
226
232
  # reply of the live branch. Both signs are needed — the client call AND the address: the
@@ -10,7 +10,7 @@ mandatory action is done, the work stays in the same state.
10
10
  ## States and mandatory actions
11
11
 
12
12
  - `просьба-не-разобрана` — explore the tree, then ask; leads `task-flow-start`
13
- - `эпик-заведён` — take the epic branch from the main branch; leads `task-flow-start`
13
+ - `эпик-заведён` — take the epic branch from the main branch; leads `epic-flow-declare`
14
14
  - `разбор-закрыт` — the product agreement or the reason there is none; leads `task-flow-start`
15
15
  - `договорённость-записана` — create the task, the branch from the epic branch, and the folder; leads `task-flow-start`
16
16
  - `задача-взята` — write the plan; leads `task-flow-start`
@@ -28,6 +28,8 @@ sections through the override; they merge here by heading, and a package edit do
28
28
  - **Layout** — the transfer of a resource from the package into the tree, by its kind and by the layer settings
29
29
  - **Laid-out file** — a file in the tree with the package header. Edited through the override, not in place: an in-place edit is lost on the next layout
30
30
  - **Override** — a file of the tree that merges with the laid-out file by section headings
31
+ - **Trait** — what a tree has: a storage, an admin, an application, a code graph. Named in a list in the tree settings; a resource that needs a trait is laid out only to a tree that named it
32
+ - **Code graph** — a build artefact next to the tree: which file calls, imports and contains what. Answers relations, not numbers or behaviour; it is fresh when it was built from the head
31
33
  - **Disabled role** — a role whose call the tree no longer treats as mandatory: the guard stays silent about it. Named in a list in the tree settings, not removed from the layout, and called by hand
32
34
  - **Observation** — a line about an event of the rules layer: a rule was loaded, a gate refused, a guard declined. Written by a guard, lives in the tree, leaves as counters. Not called a log
33
35
  - **Digest** — what the observations say over a span of days: what was used, what never was, what people stumbled on
@@ -24,7 +24,7 @@
24
24
  # Its own name in the observations: the refusal is written by the shared deny tail, not by the
25
25
  # guard itself.
26
26
  RT_GUARD_NAME=epic-stop-guard
27
- RT_GUARD_RULE=task-flow
27
+ RT_GUARD_RULE=turn-conduct
28
28
 
29
29
  . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/utf8.sh" 2>/dev/null || true
30
30
  . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/hook-input.sh" 2>/dev/null || true
@@ -116,13 +116,48 @@ if [ -n "$taken" ] && [ -n "$transcript" ] && [ -f "$transcript" ]; then
116
116
  [ "$named" = "true" ] && exit 0
117
117
  fi
118
118
 
119
+ # A created task has no number yet, so no menu answer can name it, and the owner's answer to «create
120
+ # a task for these findings?» left the call refused. The word of the owner here is their latest
121
+ # answer to a menu: no message of theirs stands after it, the answer agrees to a task — a word of a
122
+ # task, of creating it, or a plain «yes» — and it is not a refusal. Any answer was too wide: «not
123
+ # now» and an answer about a button colour passed alike. A new epic needs the word of an epic.
124
+ if [ -z "$taken" ] && [ -n "$transcript" ] && [ -f "$transcript" ] \
125
+ && printf '%s' "$cmd" | grep -qE 'task:new|task-new\.mjs' 2>/dev/null; then
126
+ consent='задач|карточ|task|issue|заве|завод|созда|create|^\s*(да|yes|ок|ok)([^[:alpha:]]|$)'
127
+ if printf '%s' "$cmd" | grep -qE -- '--epic([[:space:]=]|$)' 2>/dev/null; then
128
+ consent='эпик|epic'
129
+ fi
130
+ latest="$(tail -n 400 "$transcript" 2>/dev/null | jq -s -r --arg consent "$consent" '
131
+ [.[] | select(.type == "user")
132
+ | select(((.isMeta // false) or (.isCompactSummary // false)) | not)
133
+ | (.message.content // "")
134
+ | if type == "string" then {said: .}
135
+ elif type == "array" then (map(
136
+ if .type == "text" then {said: (.text // "")}
137
+ elif .type == "tool_result" then ((.content
138
+ | if type == "string" then . elif type == "array"
139
+ then (map(if type == "object" then (.text // "") else "" end) | join(" ")) else "" end)
140
+ | if test("^(The user answered|Your questions have been answered):")
141
+ then {menu: ([match("\"=\"([^\"]*)\""; "g") | .captures[0].string] | first // "")}
142
+ else empty end)
143
+ else empty end) | .[])
144
+ else empty end]
145
+ | (last // {})
146
+ | if (.menu // "") != ""
147
+ and (.menu | test($consent; "i"))
148
+ and ((.menu | test("^\\s*(нет|не\\s|нельзя|no\\b|стоп|stop|отмен|cancel|подожд|wait|позже|later|пока ничего|ничего|nothing)"; "i")) | not)
149
+ then "yes" else "no" end
150
+ ' 2>/dev/null)"
151
+ [ "$latest" = "yes" ] && exit 0
152
+ fi
153
+
119
154
  root="$(git rev-parse --show-toplevel 2>/dev/null)"
120
155
  checks="$(jq -r '.layout.checks // "tools"' "$root/.claude/rt-kit.json" 2>/dev/null)"
121
156
  if [ -z "$checks" ] || [ "$checks" = null ]; then
122
157
  checks=tools
123
158
  fi
124
159
 
125
- reason="Refused: the epic is over — every task of it is merged or handed over by a request, and this call takes new work. The end of an epic is a stop: print the table by «npm run epic:table» (or «node $checks/epic-table.mjs»), tell the owner what was done on each task and what confirms it, and say outright that the session waits for their orders. New work is taken by their word, not by the count of what is left: their message or their answer to a menu that names the number of this work releases the call. A new epic the owner has declared needs the bypass line in the calls that create its card, its tasks and its branch; once the branch of the new epic is taken, the guard reads that epic and stops refusing."
160
+ reason="Refused: the epic is over — every task of it is merged or handed over by a request, and this call takes new work. The end of an epic is a stop: print the table by «npm run epic:table» (or «node $checks/epic-table.mjs»), tell the owner what was done on each task and what confirms it, and say outright that the session waits for their orders. New work is taken by their word, not by the count of what is left: their message or their answer to a menu that names the number of this work releases the call; a task being created has no number yet, and it is released by the latest answer of the owner to a menu when that answer agrees to a task and is not a refusal. A new epic the owner has declared needs the bypass line in the calls that create its card, its tasks and its branch; once the branch of the new epic is taken, the guard reads that epic and stops refusing."
126
161
 
127
162
  # shellcheck disable=SC1090
128
163
  [ -f "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/deny-tail.sh" ] \
@@ -51,6 +51,16 @@ for map in "$rt_hooks_dir/../rt-kit/defaults/gate-map.sh" "$rt_hooks_dir/../defa
51
51
  done
52
52
  command -v skill_for >/dev/null 2>&1 || exit 0
53
53
 
54
+ # A working copy of the tree lies inside the tree's own agent directory, and the map branch for
55
+ # that directory caught every file of the copy: the gate demanded nothing there. The path is
56
+ # brought to the form it has in the main copy before the map reads it.
57
+ rt_gate_copy_path() {
58
+ case "$1" in
59
+ */.claude/worktrees/*/*) printf '%s' "$1" | sed -E 's#/\.claude/worktrees/[^/]+/#/#' ;;
60
+ *) printf '%s' "$1" ;;
61
+ esac
62
+ }
63
+
54
64
  req=""
55
65
  target=""
56
66
  kind=""
@@ -72,6 +82,7 @@ case "$tool" in
72
82
  "${CLAUDE_PROJECT_DIR:-.}"/*) ;;
73
83
  *) exit 0 ;;
74
84
  esac
85
+ target="$(rt_gate_copy_path "$target")"
75
86
  # The edit text goes to the map as a second argument: there are rules that come into
76
87
  # force not from WHAT file is edited but from WHAT is written into it — a call to the
77
88
  # runtime arrives in an ordinary service, and a setting number in an ordinary class.
@@ -127,6 +138,7 @@ case "$tool" in
127
138
  "${CLAUDE_PROJECT_DIR:-.}"/*) ;;
128
139
  *) continue ;;
129
140
  esac
141
+ written_path="$(rt_gate_copy_path "$written_path")"
130
142
  more="$(skill_for edit "$written_path" "" 2>/dev/null)"
131
143
  [ -n "$more" ] && req="$req $more"
132
144
  done <<EOF
@@ -20,7 +20,7 @@
20
20
  # Its own name in the observations: the refusal is written by the shared deny tail, not by the
21
21
  # guard itself.
22
22
  RT_GUARD_NAME=tree-assignment-guard
23
- RT_GUARD_RULE=task-flow
23
+ RT_GUARD_RULE=epic-flow
24
24
 
25
25
  . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/utf8.sh" 2>/dev/null || true
26
26
  . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/hook-input.sh" 2>/dev/null || true
@@ -0,0 +1,71 @@
1
+ ---
2
+ name: epic-flow-declare
3
+ kind: pattern
4
+ rule: epic-flow
5
+ description: Pattern of rule epic-flow. Load when the grill gave a series of tasks — declaring the epic with its card, plan and all its tasks at once, then taking its branch from the main branch. One task — pattern task-flow-start.
6
+ ---
7
+
8
+ # Declaring an epic
9
+
10
+ Pattern of the rule `epic-flow`. What must be true meanwhile — the law
11
+ `docs/constitution/work-conduct.md`.
12
+
13
+ ## When to use
14
+
15
+ - The grill ended with several tasks, and the order between them matters.
16
+ - The epic is declared, and its branch is not taken yet.
17
+
18
+ ## State `договорённость-записана`: a series of tasks is declared an epic
19
+
20
+ The grill ended with one task — the step is skipped. Several came out, and the order between them
21
+ matters — the epic is declared here, before the first of them, and twice. As a card in the work
22
+ queue with the epic label, and as a plan next to it.
23
+
24
+ ```bash
25
+ npm run task:new -- --epic --title '<Возможность, которая разрабатывается>' --slug <slug> < тело.md
26
+ ```
27
+
28
+ The call puts the epic label on the card, lays a draft of the plan in the tree's directory of plans
29
+ and writes the path to it into the body: the audit reads the plan by that path, and a card without
30
+ it points into emptiness. Everything the epic cannot be created without is asked before the card is
31
+ made — an administrator alone can take a made one off the board. What the call does not write — a
32
+ file of epics, an index of plans — the tree lists as hand steps of the same commit as the plan.
33
+
34
+ The draft is filled in by hand, and three things in it are derived from nothing: the opportunity in
35
+ one phrase, the makeup of the tasks in order, and how the branches of the tasks stand. A set without
36
+ an order is no order: two tasks whose order rested on understanding went into work the other way
37
+ round, and the second was redone under the first. The assigned order holds to the end of the epic; a
38
+ revision is the owner's decision.
39
+
40
+ The cards for all the tasks are created at once, right here — by the same call with `--epic-of`, for
41
+ every row of the makeup. The issued numbers return to the same table: "take the next" answers with a
42
+ number from now on.
43
+
44
+ **Next move:** the declared epic is committed together with the task numbers, and in the same turn
45
+ its branch is taken.
46
+
47
+ ## State `эпик-заведён`: the branch of the epic
48
+
49
+ ```bash
50
+ git checkout -b <КЛЮЧ>-<номер эпика>-<slug> origin/main
51
+ ```
52
+
53
+ The branch is taken before the first task of the epic, not with it: taken later, it leaves the first
54
+ task standing on the main branch, and the epic starts as half of itself already merged.
55
+
56
+ The plan of the epic is committed into it and the branch is pushed at once — the branches of the
57
+ tasks are taken from it, and one that exists only on the machine is a base nobody else has. The card
58
+ names the branch: the reader comes to the epic from the queue, and the queue holds no branches.
59
+
60
+ Nothing else is committed into the epic branch: it carries the plan and the merges of the tasks; an
61
+ edit made in it directly reaches the main branch unreviewed.
62
+
63
+ **Next move:** the first task of the epic is taken — the branch of the task from the branch of the
64
+ epic, and the folder: pattern `task-flow-start`, state `договорённость-записана`.
65
+
66
+ ## Common misses
67
+
68
+ - The epic branch taken together with the first task, not before it: the first task stands on the
69
+ main branch, and the epic starts as half of itself already merged.
70
+ - The cards of the tasks created one at a time as the work reaches them: the volume of the epic is
71
+ hidden, and "take the next" has no number to answer with.
@@ -260,3 +260,7 @@ reference — it changes how a story is written.
260
260
  next to it. The same pass checks the shape of the code — a sample declaring fields unlike the
261
261
  tree declares them teaches breaking the language rule, and the rule that forbids it will not
262
262
  know.
263
+ - A split left a pointer under the old state heading and cut its next-move line together with the
264
+ moved text. A heading of the form «State `name`» keeps every duty of a state section wherever it
265
+ stands, and the check of the next move reads it so: the pointer names its own next move, or the
266
+ heading leaves with the text.
@@ -68,5 +68,6 @@ the next cycle starts from the report again.
68
68
  edit. The line stands in the task before the first commit.
69
69
  - **Reading one's own tree as the package.** One tree is the partial view: it lacks completeness and
70
70
  repeated mistakes.
71
- - **A rising count taken for a worse rule.** More refusals also come from more work. A share is read
72
- against its denominator.
71
+ - **A rising count taken for a worse rule.** More refusals also come from more work, and from a
72
+ repair that widened what a guard reads: a guard that starts seeing a new place refuses more and is
73
+ right. A share is read against its denominator, and a repair names no metric at all.
@@ -0,0 +1,94 @@
1
+ ---
2
+ name: task-flow-graph
3
+ kind: pattern
4
+ rule: task-flow
5
+ description: Pattern of rule task-flow. Load when the tree holds a code graph and a domain is explored or a shared symbol is about to be edited. Not for a claim about behaviour, a number or a rule text — those are read from the code and the documents.
6
+ ---
7
+
8
+ # Working with the tree's code graph
9
+
10
+ Pattern of the rule `task-flow`. What must be true meanwhile — the law
11
+ `docs/constitution/work-conduct.md`.
12
+
13
+ The graph is a build artefact of the tool `graphify`: it lies next to the tree and is rebuilt from
14
+ the code. It answers relations, not behaviour. The tool is not part of the package, and the pattern
15
+ is laid out only to a tree that names the trait `graph`. A copy that names the trait and has no
16
+ artefact on disk — a fresh clone, a new working tree — builds it by `graphify update .` before the
17
+ first exploration of the turn, or the turn names that there is no graph, and none of the steps below
18
+ applies.
19
+
20
+ ## When to use
21
+
22
+ - The first exploration of a domain in a turn, before reading files one by one.
23
+ - Before an edit of a shared symbol: who calls, imports or re-exports it.
24
+ - A question of the shape of the tree: which files belong to a domain, where the procedures of a
25
+ service lie.
26
+
27
+ ## Freshness
28
+
29
+ The build records the commit it was made from. It is compared with the head in every turn, before
30
+ the first exploration:
31
+
32
+ ```bash
33
+ python3 -c "import json;print(json.load(open('graphify-out/graph.json'))['built_at_commit'])"
34
+ git rev-parse HEAD
35
+ ```
36
+
37
+ Equal — the graph describes the head. Behind — the graph is stale, and the difference is read before
38
+ anything else: it names the files whose relations the graph no longer knows.
39
+
40
+ ```bash
41
+ git log --oneline --stat <built_at_commit>..HEAD
42
+ ```
43
+
44
+ A rebuild re-extracts code files and calls no model:
45
+
46
+ ```bash
47
+ graphify update .
48
+ ```
49
+
50
+ A stale graph not rebuilt is not a source: the turn names why it was not rebuilt, and no answer
51
+ cites it. A turn where the graph exists and was not used names one of two reasons: the answer is
52
+ about behaviour, numbers or texts, or the graph is stale and was not rebuilt.
53
+
54
+ ## The inventory
55
+
56
+ Nodes carry the file they came from. Listing them shows a domain whole: files, classes, procedures,
57
+ functions.
58
+
59
+ ```bash
60
+ python3 -c "import json,collections;g=json.load(open('graphify-out/graph.json'));c=collections.Counter(n.get('source_file','') for n in g['nodes'] if '<domain>' in n.get('source_file',''));print('\n'.join(f'{v:5d} {k}' for k,v in c.most_common()))"
61
+ ```
62
+
63
+ ## The relations
64
+
65
+ ```bash
66
+ graphify explain "<node>" # a node and its neighbours
67
+ graphify affected "<symbol>" --depth 2 # who depends on it, reverse traversal
68
+ graphify path "<caller>" "<callee>" # the chain between two nodes
69
+ ```
70
+
71
+ A node is named by a file name or a symbol, not by a path: `board.mjs` is found, `tools/board.mjs`
72
+ is not. `explain` answers with `imports`, `imports_from`, `calls`, `contains` and `re_exports`;
73
+ `affected` is the reverse traversal an edit of a shared symbol needs.
74
+
75
+ ## What the graph never answers
76
+
77
+ - A constant, a limit, a number: values are not nodes.
78
+ - The body of an `async function*`: the extraction may leave it out, and a function absent from the
79
+ graph is not absent from the code.
80
+ - A template, a style sheet, a generated file: often outside the extraction.
81
+ - The meaning of a document: document nodes are headings, not the text under them.
82
+ - A permission or an enum value: names are nodes, strings are not.
83
+
84
+ ## Common misses
85
+
86
+ - **A free-text query looks like the entry point and is not.** `graphify query` walks breadth-first
87
+ over the words of the question and starts from whatever token it matched: it answers with
88
+ neighbours of a word, not with the domain. `explain` is asked by a file name or a symbol.
89
+ - **A barrel file distorts a path.** `index.ts` nodes stand between a caller and a callee, and
90
+ `graphify path` returns a chain through re-exports that no reader would walk. `affected` on the
91
+ symbol is used instead, and the relations are read.
92
+ - **A rebuild after deleted code keeps the old graph.** `graphify update` does not overwrite
93
+ `graph.json` when the rebuild has fewer nodes, and `built_at_commit` stays old: after an edit that
94
+ removes code it is run with `--force`, and the commit is compared again.
@@ -168,50 +168,11 @@ first.
168
168
  ### State `договорённость-записана`: a series of tasks is declared an epic
169
169
 
170
170
  The grill ended with one task — the step is skipped. Several came out, and the order between them
171
- matters — the epic is declared here, before the first of them, and twice. As a card in the work
172
- queue with the epic label, and as a plan next to it.
171
+ matters — the epic is declared and its branch is taken by the pattern `epic-flow-declare`, and the
172
+ work comes back here with its first task.
173
173
 
174
- ```bash
175
- npm run task:new -- --epic --title '<Возможность, которая разрабатывается>' --slug <slug> < тело.md
176
- ```
177
-
178
- The call puts the epic label on the card, lays a draft of the plan in the tree's directory of plans
179
- and writes the path to it into the body: the audit reads the plan by that path, and a card without
180
- it points into emptiness. Everything the epic cannot be created without is asked before the card is
181
- made — an administrator alone can take a made one off the board. What the call does not write — a
182
- file of epics, an index of plans — the tree lists as hand steps of the same commit as the plan.
183
-
184
- The draft is filled in by hand, and three things in it are derived from nothing: the opportunity in
185
- one phrase, the makeup of the tasks in order, and how the branches of the tasks stand. A set without
186
- an order is no order: two tasks whose order rested on understanding went into work the other way
187
- round, and the second was redone under the first. The assigned order holds to the end of the epic; a
188
- revision is the owner's decision.
189
-
190
- The cards for all the tasks are created at once, right here — by the same call with `--epic-of`, for
191
- every row of the makeup. The issued numbers return to the same table: "take the next" answers with a
192
- number from now on.
193
-
194
- **Next move:** the declared epic is committed together with the task numbers, and in the same turn
195
- its branch is taken.
196
-
197
- ### State `эпик-заведён`: the branch of the epic
198
-
199
- ```bash
200
- git checkout -b <КЛЮЧ>-<номер эпика>-<slug> origin/main
201
- ```
202
-
203
- The branch is taken before the first task of the epic, not with it: taken later, it leaves the first
204
- task standing on the main branch, and the epic starts as half of itself already merged.
205
-
206
- The plan of the epic is committed into it and the branch is pushed at once — the branches of the
207
- tasks are taken from it, and one that exists only on the machine is a base nobody else has. The card
208
- names the branch: the reader comes to the epic from the queue, and the queue holds no branches.
209
-
210
- Nothing else is committed into the epic branch: it carries the plan and the merges of the tasks; an
211
- edit made in it directly reaches the main branch unreviewed.
212
-
213
- **Next move:** the first task of the epic is taken — the branch of the task from the branch of the
214
- epic, and the folder.
174
+ **Next move:** one task — the task, the branch and the folder below; a series — the pattern
175
+ `epic-flow-declare`, in the same turn.
215
176
 
216
177
  ### State `договорённость-записана`: the task, the branch, the folder
217
178
 
@@ -0,0 +1,91 @@
1
+ ---
2
+ name: epic-flow
3
+ kind: rule
4
+ law: work-conduct
5
+ description: Rule under the work-conduct law — the epic as the unit of delivery. Load when an epic is declared, its branch is taken, its next task is chosen and its request into the main branch opens. Pattern epic-flow-declare. One task — task-flow.
6
+ ---
7
+
8
+ # Epics — how it works here
9
+
10
+ Rule under the law `docs/constitution/work-conduct.md`. The law says that the main branch takes the
11
+ whole or does not take it; here — how a series of tasks is held together as one epic. The course of
12
+ one task is rule `task-flow`, the end of a turn is `turn-conduct`, both under the same law.
13
+
14
+ **Requires:** `hooks/tree-assignment-guard.sh`, `checks/tree-assignment.mjs`
15
+
16
+ ## What it is called here
17
+
18
+ | In the law | Here |
19
+ | --- | --- |
20
+ | an epic — the unit of delivery | a card in the work queue with the epic label, a branch of its own from the main branch and a plan next to it. The plan holds the opportunity, the tasks and their order |
21
+ | the epic branch | `<КЛЮЧ>-<номер эпика>-<короткий-slug>`; the branches of its tasks are taken from it, and their PRs go into it |
22
+ | the epic plan | a record outside the task folder: the folder dies with the merge, the epic outlives it; the directory — in the rule's companion |
23
+ | who leads which epic | the table of assignments: a row for each working copy, written by the owner |
24
+
25
+ ## Where it lives
26
+
27
+ In this tree — the table in `implementation.md` next to it. Paths live there, not here: the rule
28
+ travels between repositories, the layout does not, and a path named in the rule lies in the first
29
+ tree that keeps its code differently.
30
+
31
+ ## Flow
32
+
33
+ The course of an epic from the series of tasks the grill gave to the request into the main branch.
34
+
35
+ ```mermaid
36
+ flowchart TD
37
+ A[The grill gave a series of tasks] --> B[The epic is declared: a card, a plan and all its tasks at once]
38
+ B --> C[The epic branch is taken from the main branch before the first task]
39
+ C --> D[The first task is taken, and the epic card moves to in progress]
40
+ D --> E{Tasks of the epic are left}
41
+ E -->|Yes| F[The next task is taken from the epic plan]
42
+ F --> E
43
+ E -->|No| G[Every folder is taken apart, then the request of the epic into the main branch opens]
44
+ ```
45
+
46
+ ## How the law applies here
47
+
48
+ - **Work begins with the epic, and a task outside one is not taken.** The main branch takes the
49
+ whole or does not take it. Work outside an epic exists only by
50
+ the owner's word about that work, said about that work.
51
+ - **The epic branch is taken before the first task of the epic, not with it.** Taken later, it
52
+ leaves the first task on the main branch.
53
+ - **The epic card moves to in progress by the same turn that takes its first task.** The owner
54
+ follows the epic by one card: left in place, it reads as never started.
55
+ - **The next task is taken from the epic plan, and the queue list is asked only where there is no
56
+ epic.** A list of numbers does not tell someone else's epic from one's own.
57
+ - **Which epic this working copy leads is read from the table of assignments, and the owner writes
58
+ it.** A card of the queue is not an order; a guard refuses every call that takes work until
59
+ their word.
60
+ - **An epic is not closed by a sign confirmed by reading alone.** What is checkable by eye is
61
+ called checked only with a command and its output.
62
+ - **The tasks of an epic are created all at once, by the same turn as the epic itself.** Creating
63
+ them one at a time hides the volume.
64
+ - **A task of an epic is linked to the epic card as a sub-issue, not only named in the plan.** The
65
+ board reads no text: without the link it looks like a task outside one. Closed tasks are linked.
66
+ - **The epic plan names how the branches of its tasks stand, on a par with their order.** Two
67
+ arrangements: each branch from the epic branch, or a stack — each from the previous. The written
68
+ arrangement binds whoever creates the branch.
69
+ - **The PR of the epic opens when its last folder is taken apart, and not a task earlier.** A folder
70
+ left in the epic branch reaches the main branch with it. Until then nobody is offered the epic
71
+ branch: its button means the whole epic.
72
+ - **The epic plan lies where it is found without the network and after the merge.** The card holds
73
+ no task order, and the folder dies with the merge. What the owner names along the way is appended
74
+ there by the turn that took it.
75
+
76
+ ## What of the law is not here
77
+
78
+ Nothing compares the makeup of the tasks in the plan with the cards in the queue: the audit reads
79
+ the pair "card and plan", not the list. The order of the tasks and the arrangement of the branches
80
+ are prose of the plan, and no check reads them; they are held by whoever creates the next branch.
81
+
82
+ Nothing tells a sign of the end of an epic checked by a command from one confirmed by reading: both
83
+ leave the same line in the plan.
84
+
85
+ The rules gate demands this rule only where an epic is declared or a task of it is created. Taking
86
+ the epic branch, choosing the next task and opening the request of the epic do not demand it: the
87
+ rule is loaded there by its description.
88
+
89
+ ## Patterns
90
+
91
+ - `epic-flow-declare` — declaring an epic with its card, plan and tasks, then taking its branch.
@@ -2,13 +2,14 @@
2
2
  name: task-flow
3
3
  kind: rule
4
4
  law: work-conduct
5
- description: Rule under the work-conduct law — the course of work from the owner's request to the merge. Load at the start of any work, when editing task folders and product agreements, and when returning to an unfinished task. Patterns task-flow-start, -resume, -close, -archive. End of a turn — turn-conduct.
5
+ description: Rule under the work-conduct law — the course of one task from the request to the merge. Load at the start of any work, when editing task folders and product agreements, and on return to an unfinished task. Patterns task-flow-start, -resume, -close, -archive. Epics — epic-flow, turns — turn-conduct.
6
6
  ---
7
7
 
8
8
  # Work conduct — how it works here
9
9
 
10
10
  Rule under the law `docs/constitution/work-conduct.md`. The law says what must be true about the
11
11
  course of work; here — what it is called in this tree, where it lives and what is not checked here.
12
+ How a series of tasks is held together as one epic — rule `epic-flow` under the same law.
12
13
 
13
14
  **Cold part:** `pitfalls.md` next to it — traps and conduct from incident analyses. Loaded on
14
15
  demand, not with the rule: an ordinary decision does not need it — whoever analyses a miss or argues
@@ -27,9 +28,6 @@ with a guard does.
27
28
  | the plan | `docs/tasks/<ветка>/plan.md` — the task footprint and stages with readiness signs; not edited after it is written |
28
29
  | the progress | `docs/tasks/<ветка>/progress.md` — "Where we stand", decisions along the way, session entries; the only place where done work is marked |
29
30
  | the product agreement written before the code | `docs/specs/<домен>/proposed/<фича>/` — the feature spec; survives the merge and merges into the domain spec |
30
- | an epic — the unit of delivery | a card in the work queue with the epic label, a branch of its own from the main branch and a plan next to it: the opportunity, the tasks, their order |
31
- | the epic branch | `<КЛЮЧ>-<номер эпика>-<короткий-slug>`; the branches of its tasks are taken from it, and their PRs go into it |
32
- | the epic plan | a record outside the task folder: the folder dies with the merge, the epic outlives it; the directory — in the rule's companion |
33
31
  | the task folder before the task is created | `docs/tasks/_draft-<slug>/` — outside history while there is no number |
34
32
  | exploration | an `Explore` or `general-purpose` session before the first question to the owner |
35
33
  | the plan review by roles | `.claude/workflows/plan.js` — need, points, agreement, critique, plan, goal |
@@ -51,7 +49,7 @@ The state is declared in the "Where we stand" section of the progress by the mac
51
49
  | State | Entry | Mandatory action | Pattern |
52
50
  | --- | --- | --- | --- |
53
51
  | `просьба-не-разобрана` | the owner's message about new work | exploration over the tree, then questions | `task-flow-start` |
54
- | `эпик-заведён` | the epic card, all its tasks and its plan lie in the queue | take the epic branch from the main branch; with the first task the epic card moves to in progress | `task-flow-start` |
52
+ | `эпик-заведён` | the epic card, all its tasks and its plan lie in the queue | take the epic branch from the main branch; with the first task the epic card moves to in progress | `epic-flow-declare` |
55
53
  | `разбор-закрыт` | the owner's answers lie on disk | a product agreement, or the reason there is none | `task-flow-start` |
56
54
  | `договорённость-записана` | the draft lies, or the reason is named | create the task, the branch from the epic branch, and the folder | `task-flow-start` |
57
55
  | `задача-взята` | task in the work column, branch by number, folder | write the plan | `task-flow-start` |
@@ -223,43 +221,22 @@ flowchart TD
223
221
  - **Work ordered in words becomes a task in the queue in the same turn.** Even if it will not be
224
222
  done now: a draft folder has no number, and one session knows of it. Postponed work names a
225
223
  date; postponed silently, it reads as done.
226
- - **Work begins with the epic, and a task outside one is not taken.** The main branch takes the
227
- whole or does not take it. Work outside an epic exists only by
228
- the owner's word about that work, said about that work.
229
- - **The epic branch is taken before the first task of the epic, not with it.** Taken later, it
230
- leaves the first task on the main branch.
231
- - **The epic card moves to in progress by the same turn that takes its first task.** The owner
232
- follows the epic by one card: left in place, it reads as never started.
233
- - **The next task is taken from the epic plan, and the queue list is asked only where there is no
234
- epic.** A list of numbers does not tell someone else's epic from one's own.
235
- - **Which epic this working copy leads is read from the table of assignments, and the owner writes
236
- it.** A card of the queue is not an order; a guard refuses every call that takes work until
237
- their word.
238
- - **An epic is not closed by a sign confirmed by reading alone.** What is checkable by eye is
239
- called checked only with a command and its output.
240
- - **The tasks of an epic are created all at once, by the same turn as the epic itself.** Creating
241
- them one at a time hides the volume.
242
- - **A task of an epic is linked to the epic card as a sub-issue, not only named in the plan.** The
243
- board reads no text: without the link it looks like a task outside one. Closed tasks are linked.
244
- - **The epic plan names how the branches of its tasks stand, on a par with their order.** Two
245
- arrangements: each branch from the epic branch, or a stack — each from the previous. The written
246
- arrangement binds whoever creates the branch.
247
224
  - **The plan names the points: the epic its milestone, the task the change a person will see.** The
248
225
  role `product-strategist` tries to prove the miss in planning and before the PR. A proved miss is
249
226
  fixed or named to the owner; no pipeline stops. Every PR body carries the table of points.
250
- - **An edit of a rule names the metric it should move, and the next report judges it.** An edit that
251
- moved nothing is named so. The technique is the pattern `task-flow-cycle`.
227
+ - **An improvement of a rule names the metric it should move, and the next report judges it.** A repair
228
+ names what was broken instead. An edit that moved nothing is named so. The technique is the
229
+ pattern `task-flow-cycle`.
252
230
  - **Work is judged by the role `goal-critic` against the owner's words.** A plan is no evidence to
253
231
  it, its reply is not edited, and the PR body carries its table.
254
232
  - **A mission is set by the owner.** A session only proposes a wording from its analysis and waits
255
233
  for approval.
256
- - **The PR of the epic opens when its last folder is taken apart, and not a task earlier.** A folder
257
- left in the epic branch reaches the main branch with it. Until then nobody is offered the epic
258
- branch: its button means the whole epic.
259
- - **The epic plan lies where it is found without the network and after the merge.** The card holds
260
- no task order, and the folder dies with the merge. What the owner names along the way is appended
261
- there by the turn that took it.
262
234
  - **Building by a sample begins with reading the sample itself, whole, by walking the directories.**
235
+ - **Exploration of a tree that holds a code graph begins with the graph.** A tree with a graph names
236
+ the trait `graph` in its settings and follows the pattern `task-flow-graph`: in every turn the
237
+ graph is checked against the head before the first exploration, and a turn that does not use it
238
+ names the reason. Relations are taken from the graph; numbers, behaviour and texts — from the code
239
+ and the documents.
263
240
  - **What acts on the tree, not on the edit, lies outside the index.** The path to the sample and the
264
241
  permission to work outside the epic do not belong to the branch and live next to the handover. A
265
242
  number in the permitted list repeats the owner's word, not replaces it.
@@ -322,3 +299,5 @@ nothing counts; it is held by reading both texts in a row on every such edit.
322
299
  - `task-flow-close` — lifting the draft, merging the agreement, bringing the texts up to date.
323
300
  - `task-flow-archive` — taking the task folder apart, the move to the archive, review by the rules.
324
301
  - `task-flow-cycle` — an edit chosen by the report and judged by the next one.
302
+ - `task-flow-graph` — where the tree names the trait `graph`: the freshness check, the domain inventory and
303
+ what the graph never answers.
@@ -19,7 +19,7 @@ along the way.
19
19
  - **This task reaches:** <the change a person will see>
20
20
  - **Sign:** <the command, the page or the number that shows it, and who sees it>
21
21
  - **Milestone G of the epic:** <the point named in the epic plan>
22
- - **Metric:** <only for an edit of a rule, a hook, a check or a role: the number, the direction, the baseline — pattern `task-flow-cycle`>
22
+ - **Metric:** <only for an improvement of a rule, a hook, a check or a role: the number, the direction, the baseline — pattern `task-flow-cycle`; a repair writes «нет: <what was broken>»>
23
23
 
24
24
  ## Task footprint
25
25
 
@@ -13,5 +13,8 @@
13
13
  },
14
14
  "mockups": {
15
15
  "title": "макеты: рисунки экранов в дизайн-инструменте до кода"
16
+ },
17
+ "graph": {
18
+ "title": "граф кода: построенная карта вызовов и импортов дерева рядом с ним"
16
19
  }
17
20
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rt-tools/agent-kit",
3
- "version": "0.35.0",
3
+ "version": "0.37.0",
4
4
  "description": "Переносимый слой правил для агента: законы, хуки, проверки и агенты, раскладываемые в репозиторий одной командой",
5
5
  "author": "RT Team",
6
6
  "license": "Apache-2.0",