@rt-tools/agent-kit 0.34.0 → 0.36.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.
- package/README.md +6 -6
- package/assets/agents/goal-critic.md +9 -0
- package/assets/agents/product-strategist.md +5 -0
- package/assets/defaults/gate-map.sh +6 -0
- package/assets/defaults/project.sh +39 -0
- package/assets/defaults/turn-map.md +1 -1
- package/assets/hooks/browser-guard-device-id.sh +1 -0
- package/assets/hooks/browser-guard-no-asking.sh +1 -0
- package/assets/hooks/browser-guard-no-listing.sh +1 -0
- package/assets/hooks/browser-guard-no-other-drivers.sh +1 -0
- package/assets/hooks/browser-guard-require-select.sh +1 -0
- package/assets/hooks/claim-guard.sh +1 -0
- package/assets/hooks/dev-server-guard.sh +1 -0
- package/assets/hooks/docs-guard.sh +1 -0
- package/assets/hooks/end-conversation-guard.sh +1 -0
- package/assets/hooks/epic-stop-guard.sh +37 -1
- package/assets/hooks/exam-guard.sh +5 -0
- package/assets/hooks/git-guard-delivery-draft.sh +23 -0
- package/assets/hooks/git-guard-delivery-folder.sh +25 -4
- package/assets/hooks/git-guard-delivery-signature.sh +19 -0
- package/assets/hooks/git-guard-delivery.sh +7 -18
- package/assets/hooks/git-guard-discard.sh +1 -0
- package/assets/hooks/git-guard-main.sh +1 -0
- package/assets/hooks/git-guard-no-verify.sh +1 -0
- package/assets/hooks/git-guard-push-ahead.sh +9 -0
- package/assets/hooks/git-guard-push-tests.sh +1 -0
- package/assets/hooks/grill-gate.sh +1 -0
- package/assets/hooks/guard-note.sh +11 -3
- package/assets/hooks/handover-mark.sh +37 -0
- package/assets/hooks/metric-marks.sh +233 -0
- package/assets/hooks/metric-send-start.sh +38 -0
- package/assets/hooks/observe.sh +103 -0
- package/assets/hooks/owner-corrections.sh +36 -0
- package/assets/hooks/prose-style-guard.sh +1 -0
- package/assets/hooks/pull-outcomes.sh +59 -0
- package/assets/hooks/push-set.sh +11 -1
- package/assets/hooks/qa-dataid-guard.sh +1 -0
- package/assets/hooks/rerun-guard.sh +1 -0
- package/assets/hooks/reuse-first-guard.sh +1 -0
- package/assets/hooks/role-calls.sh +120 -0
- package/assets/hooks/rule-source-guard.sh +16 -0
- package/assets/hooks/skill-gate.sh +23 -0
- package/assets/hooks/task-flow-draft-guard.sh +1 -0
- package/assets/hooks/task-flow-guard.sh +1 -0
- package/assets/hooks/tree-assignment-guard.sh +1 -0
- package/assets/hooks/turn-exit-epic.sh +24 -0
- package/assets/hooks/turn-exit-guard.sh +1 -21
- package/assets/hooks/waiting-turn-guard.sh +1 -0
- package/assets/hooks/window-fill-guard.sh +1 -0
- package/assets/hooks/work-start-guard.sh +1 -0
- package/assets/patterns/epic-flow-declare.md +71 -0
- package/assets/patterns/git-workflow-commit.azure.md +5 -3
- package/assets/patterns/git-workflow-commit.github.md +5 -3
- package/assets/patterns/git-workflow-commit.gitlab.md +5 -3
- package/assets/patterns/spec-driven-rule.md +4 -0
- package/assets/patterns/task-flow-close.md +5 -6
- package/assets/patterns/task-flow-cycle.md +73 -0
- package/assets/patterns/task-flow-start.md +4 -43
- package/assets/rules/epic-flow.md +91 -0
- package/assets/rules/task-flow.md +14 -41
- package/assets/samples/tasks/_template/plan.md +1 -0
- package/assets/templates/postmortem.md +2 -0
- package/bin/agent-kit.d.ts.map +1 -1
- package/bin/agent-kit.js +28 -0
- package/bin/agent-kit.js.map +1 -1
- package/lib/cargo.d.ts +35 -0
- package/lib/cargo.d.ts.map +1 -1
- package/lib/cargo.js +76 -0
- package/lib/cargo.js.map +1 -1
- package/lib/commands.d.ts +9 -0
- package/lib/commands.d.ts.map +1 -1
- package/lib/commands.js +32 -19
- package/lib/commands.js.map +1 -1
- package/lib/config.d.ts +5 -0
- package/lib/config.d.ts.map +1 -1
- package/lib/config.js +1 -0
- package/lib/config.js.map +1 -1
- package/lib/file-lock.d.ts +4 -0
- package/lib/file-lock.d.ts.map +1 -0
- package/lib/file-lock.js +23 -0
- package/lib/file-lock.js.map +1 -0
- package/lib/metric-lines.d.ts +20 -0
- package/lib/metric-lines.d.ts.map +1 -0
- package/lib/metric-lines.js +117 -0
- package/lib/metric-lines.js.map +1 -0
- package/lib/metric-send-mark.d.ts +52 -0
- package/lib/metric-send-mark.d.ts.map +1 -0
- package/lib/metric-send-mark.js +69 -0
- package/lib/metric-send-mark.js.map +1 -0
- package/lib/metric-send.d.ts +18 -0
- package/lib/metric-send.d.ts.map +1 -0
- package/lib/metric-send.js +226 -0
- package/lib/metric-send.js.map +1 -0
- package/lib/metric-usage.d.ts +34 -0
- package/lib/metric-usage.d.ts.map +1 -0
- package/lib/metric-usage.js +111 -0
- package/lib/metric-usage.js.map +1 -0
- package/lib/metrics.d.ts +92 -0
- package/lib/metrics.d.ts.map +1 -0
- package/lib/metrics.js +263 -0
- package/lib/metrics.js.map +1 -0
- package/lib/observations-cargo.d.ts +2 -0
- package/lib/observations-cargo.d.ts.map +1 -1
- package/lib/observations-cargo.js +1 -1
- package/lib/observations-cargo.js.map +1 -1
- package/lib/observations.d.ts +22 -2
- package/lib/observations.d.ts.map +1 -1
- package/lib/observations.js +40 -13
- package/lib/observations.js.map +1 -1
- package/lib/outcomes.d.ts +89 -0
- package/lib/outcomes.d.ts.map +1 -0
- package/lib/outcomes.js +274 -0
- package/lib/outcomes.js.map +1 -0
- package/lib/ship.js +1 -1
- package/lib/ship.js.map +1 -1
- package/lib/shipment.d.ts.map +1 -1
- package/lib/shipment.js +7 -1
- package/lib/shipment.js.map +1 -1
- package/lib/snapshot.d.ts +2 -0
- package/lib/snapshot.d.ts.map +1 -1
- package/lib/snapshot.js +6 -0
- package/lib/snapshot.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# rt-hook: PostToolUse Agent|Task
|
|
3
|
+
# rt-hook: UserPromptSubmit
|
|
4
|
+
# rt-hook: SubagentStop
|
|
5
|
+
# Requires: hooks/hook-input.sh, hooks/observe.sh
|
|
6
|
+
#
|
|
7
|
+
# Counts the calls of roles and commands for the package metrics. A role nobody calls is judged the
|
|
8
|
+
# same way as a rule nobody loads, and only the host sees the call.
|
|
9
|
+
#
|
|
10
|
+
# WHAT IS RECORDED. The name of a package role or command, and a constant word for what is the tree's
|
|
11
|
+
# own: its name may name the tree, and an observation leaves it. A role is the package's when its
|
|
12
|
+
# laid-out file carries the layout header. A built-in role has no file and is not counted.
|
|
13
|
+
#
|
|
14
|
+
# THE VERDICT. A role that gives one says it in its first line, and the table below is the whole
|
|
15
|
+
# knowledge about it: the words of a refusal, in both languages a role answers in. A role outside the
|
|
16
|
+
# table is counted by calls. Only the answer goes into the record, the text stays where it is. It is
|
|
17
|
+
# read when the role ends, not when it is called: a role usually runs in the background, and at the
|
|
18
|
+
# call its answer is only the fact of the launch.
|
|
19
|
+
#
|
|
20
|
+
# FAIL-OPEN: no input, no parser, no record — exit with zero and no output. This hook never refuses.
|
|
21
|
+
|
|
22
|
+
. "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/utf8.sh" 2>/dev/null || true
|
|
23
|
+
. "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/hook-input.sh" 2>/dev/null || exit 0
|
|
24
|
+
. "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/observe.sh" 2>/dev/null || exit 0
|
|
25
|
+
|
|
26
|
+
rt_hook_read
|
|
27
|
+
[ -n "$RT_HOOK_INPUT" ] || exit 0
|
|
28
|
+
command -v jq >/dev/null 2>&1 || exit 0
|
|
29
|
+
|
|
30
|
+
root="${CLAUDE_PROJECT_DIR:-.}"
|
|
31
|
+
sid="$(printf '%s' "$RT_HOOK_INPUT" | jq -r '.session_id // empty' 2>/dev/null)"
|
|
32
|
+
|
|
33
|
+
# The name a resource goes under: its own for the package, a constant word for the tree. Empty — the
|
|
34
|
+
# host's built-in, with no file at all.
|
|
35
|
+
rt_called_name() {
|
|
36
|
+
local file="$1" name="$2"
|
|
37
|
+
[ -f "$file" ] || return 0
|
|
38
|
+
# The layout header stands after the front matter of the file, so the top lines are not enough.
|
|
39
|
+
if head -n 12 "$file" 2>/dev/null | grep -q 'rt-kit v'; then
|
|
40
|
+
printf '%s' "$name"
|
|
41
|
+
else
|
|
42
|
+
printf 'tree-own'
|
|
43
|
+
fi
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
# The words of a verdict by role: the refusal first, because it holds the words of a pass. No line —
|
|
47
|
+
# the role gives no verdict the report counts.
|
|
48
|
+
rt_refusal_words() {
|
|
49
|
+
case "$1" in
|
|
50
|
+
goal-critic) printf '%s' 'not met|partly met|не достигнут|не выполнен|частично' ;;
|
|
51
|
+
product-strategist) printf '%s' 'does not reach|longer route|не достигает|не ведёт|длинн' ;;
|
|
52
|
+
esac
|
|
53
|
+
}
|
|
54
|
+
rt_pass_words() {
|
|
55
|
+
case "$1" in
|
|
56
|
+
goal-critic) printf '%s' 'is met|достигнут|выполнен' ;;
|
|
57
|
+
product-strategist) printf '%s' 'reaches|достигает|ведёт' ;;
|
|
58
|
+
esac
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
# The answer of a role. A role that hands its report back by a tool ends with no text, so the host
|
|
62
|
+
# gives the event an empty last message, and the answer is the last report in its record.
|
|
63
|
+
rt_role_answer() {
|
|
64
|
+
local answer path
|
|
65
|
+
answer="$(printf '%s' "$RT_HOOK_INPUT" | jq -r '.last_assistant_message // empty' 2>/dev/null)"
|
|
66
|
+
if [ -n "$answer" ]; then
|
|
67
|
+
printf '%s' "$answer"
|
|
68
|
+
return 0
|
|
69
|
+
fi
|
|
70
|
+
path="$(printf '%s' "$RT_HOOK_INPUT" | jq -r '.agent_transcript_path // empty' 2>/dev/null)"
|
|
71
|
+
[ -f "$path" ] || return 0
|
|
72
|
+
tail -n 20 "$path" 2>/dev/null \
|
|
73
|
+
| jq -c 'select(.message.content? | type == "array") | .message.content[]
|
|
74
|
+
| select(.type? == "tool_use" and .name? == "SubagentHandback") | .input.message // empty' 2>/dev/null \
|
|
75
|
+
| tail -n 1 | jq -r '.' 2>/dev/null
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
# The verdict by the first line of the answer of the role. Neither word — no verdict.
|
|
79
|
+
rt_verdict_of() {
|
|
80
|
+
local refusal pass line
|
|
81
|
+
refusal="$(rt_refusal_words "$1")"
|
|
82
|
+
pass="$(rt_pass_words "$1")"
|
|
83
|
+
[ -n "$refusal" ] || return 0
|
|
84
|
+
line="$(rt_role_answer | awk 'NF { print; exit }')"
|
|
85
|
+
if printf '%s' "$line" | grep -qiE "$refusal"; then
|
|
86
|
+
printf 'refused'
|
|
87
|
+
elif printf '%s' "$line" | grep -qiE "$pass"; then
|
|
88
|
+
printf 'passed'
|
|
89
|
+
fi
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
prompt="$(printf '%s' "$RT_HOOK_INPUT" | jq -r '.prompt // empty' 2>/dev/null)"
|
|
93
|
+
if [ -n "$prompt" ]; then
|
|
94
|
+
case "$prompt" in
|
|
95
|
+
/*) ;;
|
|
96
|
+
*) exit 0 ;;
|
|
97
|
+
esac
|
|
98
|
+
command="$(printf '%s' "$prompt" | sed -E 's#^/([A-Za-z0-9_-]+).*#\1#' | head -n 1)"
|
|
99
|
+
name="$(rt_called_name "$root/.claude/commands/$command.md" "$command")"
|
|
100
|
+
[ -z "$name" ] || rt_note command-call "res=$name" "sid=$sid"
|
|
101
|
+
exit 0
|
|
102
|
+
fi
|
|
103
|
+
|
|
104
|
+
# A role that ended: only the verdict is written here, the call was counted when it was made. The
|
|
105
|
+
# event is asked by name: a call made inside a role carries the type of that role too.
|
|
106
|
+
if [ "$(printf '%s' "$RT_HOOK_INPUT" | jq -r '.hook_event_name // empty' 2>/dev/null)" = SubagentStop ]; then
|
|
107
|
+
ended="$(printf '%s' "$RT_HOOK_INPUT" | jq -r '.agent_type // empty' 2>/dev/null)"
|
|
108
|
+
name="$(rt_called_name "$root/.claude/agents/$ended.md" "$ended")"
|
|
109
|
+
verdict="$(rt_verdict_of "$name")"
|
|
110
|
+
[ -z "$verdict" ] || rt_note role-verdict "res=$name" "sid=$sid" "verdict=$verdict"
|
|
111
|
+
exit 0
|
|
112
|
+
fi
|
|
113
|
+
|
|
114
|
+
role="$(printf '%s' "$RT_HOOK_INPUT" | jq -r '.tool_input.subagent_type // empty' 2>/dev/null)"
|
|
115
|
+
[ -n "$role" ] || exit 0
|
|
116
|
+
name="$(rt_called_name "$root/.claude/agents/$role.md" "$role")"
|
|
117
|
+
[ -n "$name" ] || exit 0
|
|
118
|
+
|
|
119
|
+
rt_note role-call "res=$name" "sid=$sid"
|
|
120
|
+
exit 0
|
|
@@ -102,6 +102,22 @@ while IFS= read -r candidate; do
|
|
|
102
102
|
/*) ;;
|
|
103
103
|
*) candidate="$root/$candidate" ;;
|
|
104
104
|
esac
|
|
105
|
+
# The observations are what the numbers of the package are counted from, and a hand in them
|
|
106
|
+
# turns a report into a statement of the one who edited it. Only the guards write here.
|
|
107
|
+
case "$candidate" in
|
|
108
|
+
*/.claude/rt-kit/observations/*)
|
|
109
|
+
deny "BLOCKED by rule-source-guard: «${candidate#"$root"/}» lies in the observations directory, and only the guards write there. An edit by hand makes the numbers of the package a statement of the one who wrote them." \
|
|
110
|
+
"the way out is to do the work the observation records, not to write the observation"
|
|
111
|
+
;;
|
|
112
|
+
*/.claude/rt-kit.json)
|
|
113
|
+
# Both keys decide what the numbers of the package are, and the one those numbers judge
|
|
114
|
+
# must not switch them off. The owner edits them by hand.
|
|
115
|
+
if printf '%s' "$input" | jq -r '.tool_input | tostring' 2>/dev/null | grep -qE '(^|[^[:alnum:]_-])(send|observe)([^[:alnum:]_-]|$)'; then
|
|
116
|
+
deny "BLOCKED by rule-source-guard: the keys «send» and «observe» of «${candidate#"$root"/}» decide what the numbers of the package are, and a session does not edit them." \
|
|
117
|
+
"the way out is to name the change to the owner: they edit these two keys by hand"
|
|
118
|
+
fi
|
|
119
|
+
;;
|
|
120
|
+
esac
|
|
105
121
|
[ -f "$candidate" ] || continue
|
|
106
122
|
|
|
107
123
|
# The header stands at the beginning of the file, but not on the first line: in a script `#!`
|
|
@@ -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
|
|
@@ -145,6 +157,17 @@ EOF
|
|
|
145
157
|
*) exit 0 ;;
|
|
146
158
|
esac
|
|
147
159
|
|
|
160
|
+
# Every file edit the gate sees, with a rule or without one: the share of edits that met a rule not
|
|
161
|
+
# yet loaded needs its denominator. A call of a tool is not an edit.
|
|
162
|
+
case "$kind" in
|
|
163
|
+
command | browser | design | '') ;;
|
|
164
|
+
*)
|
|
165
|
+
# shellcheck disable=SC1091
|
|
166
|
+
. "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/observe.sh" 2>/dev/null \
|
|
167
|
+
&& rt_note edit-seen "kind=$kind" "sid=$sid"
|
|
168
|
+
;;
|
|
169
|
+
esac
|
|
170
|
+
|
|
148
171
|
[ -z "$req" ] && exit 0
|
|
149
172
|
|
|
150
173
|
# The map may name several rules: the domain rule and the one that acts as a second layer. The
|
|
@@ -20,6 +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=epic-flow
|
|
23
24
|
|
|
24
25
|
. "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/utf8.sh" 2>/dev/null || true
|
|
25
26
|
. "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/hook-input.sh" 2>/dev/null || true
|
|
@@ -147,3 +147,27 @@ Do it in this same turn; the launch may stand anywhere in the turn but last.
|
|
|
147
147
|
|
|
148
148
|
The guard judges one turn: the next session is not refused." "the turn ended on a launch in the background."
|
|
149
149
|
}
|
|
150
|
+
|
|
151
|
+
# The state requirement after the folder is gone. It reads the history of the branch, as the tiers
|
|
152
|
+
# above do, and lives here because the guard reached the file length limit.
|
|
153
|
+
#
|
|
154
|
+
# The same thing, but there is nothing left on disk to declare it with: the task folder is taken
|
|
155
|
+
# apart before the PR opens, and the progress goes away with it. The sign is taken from the branch
|
|
156
|
+
# history — the folder removed by its commit.
|
|
157
|
+
#
|
|
158
|
+
# A turn must not be released by that sign: the folder is removed BEFORE the PR, and between these
|
|
159
|
+
# two movements the work is handed over to nobody. A turn caught in that gap used to leave here
|
|
160
|
+
# with zero — and it was exactly one step short of the handover, and it did not make it. The sign
|
|
161
|
+
# therefore only lifts the state requirement: from there the turn is judged by the second sign,
|
|
162
|
+
# like any other. A turn in which the PR was opened or read passes the second sign by itself — it
|
|
163
|
+
# counts a call of the hosting client as work.
|
|
164
|
+
folder_archived() {
|
|
165
|
+
[ -n "$branch" ] || return 1
|
|
166
|
+
[ -n "$(git ls-tree -d --name-only HEAD -- "$tasks_dir/$branch" 2>/dev/null | head -1)" ] && return 1
|
|
167
|
+
main_branch="${RT_MAIN_BRANCH:-main}"
|
|
168
|
+
base="$(git merge-base "$main_branch" HEAD 2>/dev/null)"
|
|
169
|
+
[ -z "$base" ] && return 1
|
|
170
|
+
had="$(git ls-tree -d --name-only "$base" -- "$tasks_dir/$branch" 2>/dev/null | head -1)"
|
|
171
|
+
[ -z "$had" ] && had="$(git log "$base..HEAD" --diff-filter=A --name-only --pretty=format: -- "$tasks_dir/$branch" 2>/dev/null | head -1)"
|
|
172
|
+
[ -n "$had" ]
|
|
173
|
+
}
|
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
# Its own name in the observations: the refusal is written by the shared deny tail, not by the
|
|
42
42
|
# guard itself.
|
|
43
43
|
RT_GUARD_NAME=turn-exit-guard
|
|
44
|
+
RT_GUARD_RULE=turn-conduct
|
|
44
45
|
|
|
45
46
|
. "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/utf8.sh" 2>/dev/null || true
|
|
46
47
|
. "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/hook-input.sh" 2>/dev/null || true
|
|
@@ -136,27 +137,6 @@ The guard judges one turn: the next session is not refused."
|
|
|
136
137
|
rt_te_deny "$reason" "the plan is written and the first stage is not begun."
|
|
137
138
|
fi
|
|
138
139
|
|
|
139
|
-
# The same thing, but there is nothing left on disk to declare it with: the task folder is taken
|
|
140
|
-
# apart before the PR opens, and the progress goes away with it. The sign is taken from the branch
|
|
141
|
-
# history — the folder removed by its commit.
|
|
142
|
-
#
|
|
143
|
-
# A turn must not be released by that sign: the folder is removed BEFORE the PR, and between these
|
|
144
|
-
# two movements the work is handed over to nobody. A turn caught in that gap used to leave here
|
|
145
|
-
# with zero — and it was exactly one step short of the handover, and it did not make it. The sign
|
|
146
|
-
# therefore only lifts the state requirement: from there the turn is judged by the second sign,
|
|
147
|
-
# like any other. A turn in which the PR was opened or read passes the second sign by itself — it
|
|
148
|
-
# counts a call of the hosting client as work.
|
|
149
|
-
folder_archived() {
|
|
150
|
-
[ -n "$branch" ] || return 1
|
|
151
|
-
[ -n "$(git ls-tree -d --name-only HEAD -- "$tasks_dir/$branch" 2>/dev/null | head -1)" ] && return 1
|
|
152
|
-
main_branch="${RT_MAIN_BRANCH:-main}"
|
|
153
|
-
base="$(git merge-base "$main_branch" HEAD 2>/dev/null)"
|
|
154
|
-
[ -z "$base" ] && return 1
|
|
155
|
-
had="$(git ls-tree -d --name-only "$base" -- "$tasks_dir/$branch" 2>/dev/null | head -1)"
|
|
156
|
-
[ -z "$had" ] && had="$(git log "$base..HEAD" --diff-filter=A --name-only --pretty=format: -- "$tasks_dir/$branch" 2>/dev/null | head -1)"
|
|
157
|
-
[ -n "$had" ]
|
|
158
|
-
}
|
|
159
|
-
|
|
160
140
|
archived=false
|
|
161
141
|
[ -z "$progress" ] && folder_archived && archived=true
|
|
162
142
|
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
|
|
35
35
|
# Its own name in observations: the refusal is written by the shared deny tail, not by the guard.
|
|
36
36
|
RT_GUARD_NAME=waiting-turn-guard
|
|
37
|
+
RT_GUARD_RULE=turn-conduct
|
|
37
38
|
|
|
38
39
|
. "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/utf8.sh" 2>/dev/null || true
|
|
39
40
|
. "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/hook-input.sh" 2>/dev/null || true
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
|
|
35
35
|
# Its own name in the observations: the refusal is written by the shared deny tail, not by the guard.
|
|
36
36
|
RT_GUARD_NAME=window-fill-guard
|
|
37
|
+
RT_GUARD_RULE=turn-conduct
|
|
37
38
|
|
|
38
39
|
. "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/utf8.sh" 2>/dev/null || true
|
|
39
40
|
. "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/hook-input.sh" 2>/dev/null || true
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
# Its own name in the observations: the refusal is written by the shared deny tail, not by the
|
|
33
33
|
# guard itself.
|
|
34
34
|
RT_GUARD_NAME=work-start-guard
|
|
35
|
+
RT_GUARD_RULE=task-flow
|
|
35
36
|
|
|
36
37
|
. "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/utf8.sh" 2>/dev/null || true
|
|
37
38
|
. "$(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.
|
|
@@ -133,9 +133,11 @@ The move is not put off for later: the work queue is read between steps, not aft
|
|
|
133
133
|
|
|
134
134
|
## The commit is signed by the machine account
|
|
135
135
|
|
|
136
|
-
The token is read into a variable and not printed; author and committer are set by variables
|
|
137
|
-
|
|
138
|
-
rewrite the signature to the owner:
|
|
136
|
+
The token is read into a variable and not printed; author and committer are set by variables
|
|
137
|
+
prefixed to `git commit` itself. `git config` will not do — the config is shared with the main tree
|
|
138
|
+
and would rewrite the signature to the owner. `export` will not do either: it reaches every later
|
|
139
|
+
command of the call, and a set before a push started by the same call runs the hook scenarios under
|
|
140
|
+
the bot's mail — the ones comparing a mail fall on a sound tree:
|
|
139
141
|
|
|
140
142
|
```bash
|
|
141
143
|
TOKEN=$(tr -d '\n' < ~/.config/<дерево>-bot-token)
|
|
@@ -201,9 +201,11 @@ and nobody was waiting to review it.
|
|
|
201
201
|
|
|
202
202
|
## The commit is signed by the bot
|
|
203
203
|
|
|
204
|
-
The token is read into a variable and not printed; author and committer are set by variables
|
|
205
|
-
|
|
206
|
-
rewrite the signature to the owner:
|
|
204
|
+
The token is read into a variable and not printed; author and committer are set by variables
|
|
205
|
+
prefixed to `git commit` itself. `git config` will not do — the config is shared with the main tree
|
|
206
|
+
and would rewrite the signature to the owner. `export` will not do either: it reaches every later
|
|
207
|
+
command of the call, and a set before a push started by the same call runs the hook scenarios under
|
|
208
|
+
the bot's mail — the ones comparing a mail fall on a sound tree:
|
|
207
209
|
|
|
208
210
|
```bash
|
|
209
211
|
TOKEN=$(tr -d '\n' < ~/.config/<дерево>-bot-token)
|
|
@@ -135,9 +135,11 @@ The move is not put off for later: the work queue is read between steps, not aft
|
|
|
135
135
|
|
|
136
136
|
## The commit is signed by the machine account
|
|
137
137
|
|
|
138
|
-
The token is read into a variable and not printed; author and committer are set by variables
|
|
139
|
-
|
|
140
|
-
rewrite the signature to the owner:
|
|
138
|
+
The token is read into a variable and not printed; author and committer are set by variables
|
|
139
|
+
prefixed to `git commit` itself. `git config` will not do — the config is shared with the main tree
|
|
140
|
+
and would rewrite the signature to the owner. `export` will not do either: it reaches every later
|
|
141
|
+
command of the call, and a set before a push started by the same call runs the hook scenarios under
|
|
142
|
+
the bot's mail — the ones comparing a mail fall on a sound tree:
|
|
141
143
|
|
|
142
144
|
```bash
|
|
143
145
|
TOKEN=$(tr -d '\n' < ~/.config/<дерево>-bot-token)
|
|
@@ -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.
|
|
@@ -204,12 +204,6 @@ judged at all. Without the guard the section is held only by whoever writes the
|
|
|
204
204
|
The work queue audit still does not read the body: the miss is caught at the minute of opening, that
|
|
205
205
|
is, where one call still fixes it.
|
|
206
206
|
|
|
207
|
-
An open PR is re-read by the account that will merge it, not by the one that opened it. The host's
|
|
208
|
-
answer to the author says only that the call went through: the right to open and the visibility of
|
|
209
|
-
what was opened are different things, and the second is checked only from the reader's side. An
|
|
210
|
-
invisible PR gives itself away by nothing — it is in the answer to its author, it carries labels,
|
|
211
|
-
and the owner's review queue is simply empty.
|
|
212
|
-
|
|
213
207
|
The difference between the section and the spoken word is one, and it is all. The owner reads a
|
|
214
208
|
message only if they return to the conversation, and the section they see where they look when
|
|
215
209
|
pressing the button.
|
|
@@ -292,6 +286,11 @@ git fetch origin && git merge origin/main # the main branch is merged in
|
|
|
292
286
|
A folder left in the epic branch reaches the main branch with it: what one branch needed becomes the
|
|
293
287
|
tree's for good. A foreign folder, arrived with a merge of the main branch, is not touched.
|
|
294
288
|
|
|
289
|
+
**A step of the milestone that the merge does not make gets a holder before the request opens.** A
|
|
290
|
+
release, a rollout, an install in the consumers and a task taken out of the epic belong to no task
|
|
291
|
+
of it, and after the merge nothing keeps them: each becomes a task in the work queue in the same
|
|
292
|
+
turn, and the body of the request names their numbers.
|
|
293
|
+
|
|
295
294
|
The body is written the same way as a task's, and its "Что сделано" is the list of the tasks by
|
|
296
295
|
number: the reviewer opens one page instead of five. The plan of the epic stays in the tree — it
|
|
297
296
|
outlives the branch.
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: task-flow-cycle
|
|
3
|
+
kind: pattern
|
|
4
|
+
rule: task-flow
|
|
5
|
+
description: Pattern of rule task-flow. Load when an edit of a rule, a hook, a check or a role is chosen and when its result is judged. The worst driver from the report, one metric and its direction in the task, the verdict from the next report, and the plain name of an edit that moved nothing.
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# The improvement cycle
|
|
9
|
+
|
|
10
|
+
Pattern of the rule `task-flow`. What must be true meanwhile — the law
|
|
11
|
+
`docs/constitution/work-conduct.md`.
|
|
12
|
+
|
|
13
|
+
## When to use
|
|
14
|
+
|
|
15
|
+
- An edit of a rule, a hook, a check or a role is being chosen.
|
|
16
|
+
- A task about such an edit is being written.
|
|
17
|
+
- The result of such an edit is being judged.
|
|
18
|
+
|
|
19
|
+
An edit chosen by opinion has no way to be proved wrong, so nobody learns whether it helped. A repair
|
|
20
|
+
of something broken is not an improvement and needs no cycle: its task names the failure instead.
|
|
21
|
+
|
|
22
|
+
## Order
|
|
23
|
+
|
|
24
|
+
### The report opens the cycle
|
|
25
|
+
|
|
26
|
+
The cycle begins with the numbers, not with an idea of what to improve.
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npx agent-kit metrics
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
The worst driver of the main metric is named with its numbers: which resource, how many refusals,
|
|
33
|
+
runs or minutes. A tree that sends its numbers reads the same in the receiver over all its copies. No
|
|
34
|
+
data means no cycle: the text says so, and nothing is chosen by a guess.
|
|
35
|
+
|
|
36
|
+
### One task, one metric, one direction
|
|
37
|
+
|
|
38
|
+
The task changes one thing and carries one line:
|
|
39
|
+
|
|
40
|
+
```markdown
|
|
41
|
+
**Metric:** empty refusals of `git-guard-push`, down. Baseline: 0.42 over 30 days, noise 0.05.
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
- **The direction is a word, not a target.** A target needs a baseline first, and two weeks of data
|
|
45
|
+
or ten accepted tasks come before one.
|
|
46
|
+
- **Two metrics mean two tasks.** Two edits in one release cannot be told apart in the next report.
|
|
47
|
+
- **The edit does not raise its own numbers.** The observations are not edited, and a metric is not
|
|
48
|
+
redefined by the task that is judged by it.
|
|
49
|
+
|
|
50
|
+
### The next report gives the verdict
|
|
51
|
+
|
|
52
|
+
The same trees are compared, on a version with the edit against themselves before it. A tree that has
|
|
53
|
+
not installed the version does not count.
|
|
54
|
+
|
|
55
|
+
- **The executor who made the edit gives no verdict.** The role `goal-critic` reads the numbers.
|
|
56
|
+
- **A movement below the noise is not a result.** The noise is the spread of the metric between the
|
|
57
|
+
weeks of the baseline, and it is named with it.
|
|
58
|
+
|
|
59
|
+
### An edit that moved nothing is named so
|
|
60
|
+
|
|
61
|
+
The report says «не сдвинулось», with the two numbers. It is not reworded as a partial success and not
|
|
62
|
+
explained by the days being unusual. Such an edit is reverted or kept by a decision of the owner, and
|
|
63
|
+
the next cycle starts from the report again.
|
|
64
|
+
|
|
65
|
+
## Common misses
|
|
66
|
+
|
|
67
|
+
- **A metric picked after the edit.** A number chosen once the result is known finds a movement in any
|
|
68
|
+
edit. The line stands in the task before the first commit.
|
|
69
|
+
- **Reading one's own tree as the package.** One tree is the partial view: it lacks completeness and
|
|
70
|
+
repeated mistakes.
|
|
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.
|
|
@@ -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
|
|
172
|
-
|
|
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
|
-
|
|
175
|
-
|
|
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
|
|