omniconductor 0.3.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/CHANGELOG.md +64 -0
- package/LICENSE +219 -0
- package/NOTICE +11 -0
- package/README.md +526 -0
- package/THIRD_PARTY_NOTICES.md +31 -0
- package/TRADEMARKS.md +26 -0
- package/VISION.md +106 -0
- package/adapters/README.md +121 -0
- package/adapters/claude/README.md +102 -0
- package/adapters/claude/SUPPORTED-FEATURES.md +66 -0
- package/adapters/claude/hookify-templates/.recipe-scoped +9 -0
- package/adapters/claude/hookify-templates/README.md +93 -0
- package/adapters/claude/hookify-templates/block-completion-claim-without-push.local.md.template +56 -0
- package/adapters/claude/hookify-templates/block-direct-push-protected-branch.local.md.template +18 -0
- package/adapters/claude/hookify-templates/block-force-push-protected-branch.local.md.template +42 -0
- package/adapters/claude/hookify-templates/block-server-secret-in-client.local.md.template +36 -0
- package/adapters/claude/hookify-templates/warn-any-type-added.local.md.template +44 -0
- package/adapters/claude/hookify-templates/warn-commit-without-pre-commit-review.local.md.template +52 -0
- package/adapters/claude/hookify-templates/warn-console-direct.local.md.template +55 -0
- package/adapters/claude/hookify-templates/warn-create-table-without-access-control.local.md.template +35 -0
- package/adapters/claude/hookify-templates/warn-current-work-without-remaining-tasks.local.md.template +36 -0
- package/adapters/claude/hookify-templates/warn-gh-pr-create-without-pre-merge-review.local.md.template +38 -0
- package/adapters/claude/hookify-templates/warn-hardcoded-text-without-i18n-key.local.md.template +21 -0
- package/adapters/claude/hookify-templates/warn-on-gh-pr-merge.local.md.template +33 -0
- package/adapters/claude/hookify-templates/warn-plan-spec-without-remaining-tasks.local.md.template +44 -0
- package/adapters/claude/hookify-templates/warn-raw-hex-instead-of-token.local.md.template +21 -0
- package/adapters/claude/hookify-templates/warn-security-definer-without-search-path.local.md.template +30 -0
- package/adapters/claude/hookify-templates/warn-stop-commit-without-current-work.local.md.template +47 -0
- package/adapters/claude/hookify-templates/warn-user-manual-completion.local.md.template +40 -0
- package/adapters/claude/transform-spec.md +140 -0
- package/adapters/claude/transform.sh +1169 -0
- package/adapters/codex/README.md +87 -0
- package/adapters/codex/SUPPORTED-FEATURES.md +66 -0
- package/adapters/codex/transform-spec.md +90 -0
- package/adapters/codex/transform.sh +748 -0
- package/adapters/copilot/README.md +88 -0
- package/adapters/copilot/SUPPORTED-FEATURES.md +73 -0
- package/adapters/copilot/transform-spec.md +111 -0
- package/adapters/copilot/transform.sh +757 -0
- package/adapters/cursor/README.md +87 -0
- package/adapters/cursor/SUPPORTED-FEATURES.md +90 -0
- package/adapters/cursor/transform-spec.md +124 -0
- package/adapters/cursor/transform.sh +731 -0
- package/adapters/gemini/README.md +93 -0
- package/adapters/gemini/SUPPORTED-FEATURES.md +80 -0
- package/adapters/gemini/transform-spec.md +102 -0
- package/adapters/gemini/transform.sh +844 -0
- package/adapters/windsurf/README.md +93 -0
- package/adapters/windsurf/SUPPORTED-FEATURES.md +67 -0
- package/adapters/windsurf/transform-spec.md +99 -0
- package/adapters/windsurf/transform.sh +727 -0
- package/bin/omniconductor.js +130 -0
- package/core/README.md +64 -0
- package/core/anti-patterns/README.md +142 -0
- package/core/anti-patterns/dynamic-system-prompt.md +113 -0
- package/core/anti-patterns/frequent-rule-file-edit.md +83 -0
- package/core/anti-patterns/large-file-read-no-range.md +90 -0
- package/core/anti-patterns/no-sub-agent-dispatch.md +89 -0
- package/core/anti-patterns/single-monolithic-rule-file.md +99 -0
- package/core/anti-patterns/skill-eager-load.md +83 -0
- package/core/anti-patterns/tool-call-spam.md +93 -0
- package/core/docs-templates/CURRENT_WORK.md +64 -0
- package/core/docs-templates/INDEX.md +57 -0
- package/core/docs-templates/PLANS.md +44 -0
- package/core/docs-templates/README.md +40 -0
- package/core/docs-templates/REMAINING_TASKS.md +43 -0
- package/core/docs-templates/TASKS.md +51 -0
- package/core/docs-templates/specs/_example.md +121 -0
- package/core/hooks/README.md +62 -0
- package/core/hooks/pretool-agent-routing.sh.template +97 -0
- package/core/hooks/pretool-commit-current-work-check.sh.template +103 -0
- package/core/hooks/pretool-commit-test-coverage-check.sh.template +116 -0
- package/core/hooks/pretool-large-file-read-guard.sh.template +117 -0
- package/core/hooks/stop-cache-hit-baseline-check.sh.template +133 -0
- package/core/hooks/stop-r6-review-check.sh.template +80 -0
- package/core/hooks/stop-session-log-check.sh.template +101 -0
- package/core/hooks/stop-trajectory-log.sh.template +96 -0
- package/core/memory-pattern/EXAMPLES.md +114 -0
- package/core/memory-pattern/README.md +133 -0
- package/core/recipes/README.md +46 -0
- package/core/recipes/auto-mock-data.md +82 -0
- package/core/recipes/branch-strategy.md +100 -0
- package/core/recipes/coding-conventions.md +123 -0
- package/core/recipes/database-discipline.md +65 -0
- package/core/recipes/debugging.md +143 -0
- package/core/recipes/design-system.md +30 -0
- package/core/recipes/i18n.md +118 -0
- package/core/recipes/monorepo.md +101 -0
- package/core/recipes/self-improvement.md +61 -0
- package/core/recipes/tdd.md +128 -0
- package/core/recipes/web-mobile-parity.md +87 -0
- package/core/reflector/SCHEDULING.md +83 -0
- package/core/reflector/prune-lessons.sh +105 -0
- package/core/reflector/reflect-brief.md +11 -0
- package/core/reflector/reflect.command.md +13 -0
- package/core/reflector/run-weekly.sh +54 -0
- package/core/reflector/trajectory-log.sh +55 -0
- package/core/roles/README.md +61 -0
- package/core/roles/builder.md +75 -0
- package/core/roles/designer.md +93 -0
- package/core/roles/helper.md +70 -0
- package/core/roles/planner.md +123 -0
- package/core/roles/reflector.md +72 -0
- package/core/roles/reviewer.md +104 -0
- package/core/roles/scribe.md +89 -0
- package/core/universal-rules/README.md +71 -0
- package/core/universal-rules/meta-discipline.md +292 -0
- package/core/universal-rules/operations.md +162 -0
- package/core/universal-rules/quality-gates.md +191 -0
- package/core/universal-rules/spec-as-you-go.md +123 -0
- package/core/universal-rules/workflow.md +153 -0
- package/core/workflow/PHASES.md +134 -0
- package/core/workflow/README.md +56 -0
- package/docs/MANUAL-INSTALL.md +456 -0
- package/package.json +52 -0
- package/tools/check-framework-purity.sh +91 -0
- package/tools/measure-tokens.sh +169 -0
- package/tools/validate-adapter-output.sh +611 -0
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
#
|
|
3
|
+
# CONDUCTOR — deterministic lesson prune (non-LLM). Anti-collapse guarantee.
|
|
4
|
+
# Usage: prune-lessons.sh [MEMORY_DIR] (default: current dir)
|
|
5
|
+
#
|
|
6
|
+
# Operations (idempotent; NON-destructive except exact-duplicate removal):
|
|
7
|
+
# - decay: lessons with last_used older than DECAY_WEEKS -> status: stale
|
|
8
|
+
# - dead-path: lessons whose `source:` is a path that no longer exists
|
|
9
|
+
# -> status: stale (never deletes a lesson — only marks it)
|
|
10
|
+
# - dedup: byte-identical lesson files -> keep one, remove the exact copies
|
|
11
|
+
#
|
|
12
|
+
# Only exact byte-duplicates are ever removed (no information is lost). Decay and
|
|
13
|
+
# dead-path never delete — they mark `status: stale`, which a human can review or
|
|
14
|
+
# reverse. This matches the propose-only philosophy: an unattended script must not
|
|
15
|
+
# destroy user memory.
|
|
16
|
+
#
|
|
17
|
+
# Env:
|
|
18
|
+
# CONDUCTOR_NOW=YYYY-MM-DD (default: today, UTC)
|
|
19
|
+
# CONDUCTOR_DECAY_WEEKS=N (default: 8)
|
|
20
|
+
# CONDUCTOR_PROJECT_ROOT=/path (root to resolve `source:` paths against;
|
|
21
|
+
# default: git toplevel of MEMORY_DIR, else PWD)
|
|
22
|
+
set -u
|
|
23
|
+
|
|
24
|
+
MEM_DIR="${1:-.}"
|
|
25
|
+
[ -d "$MEM_DIR" ] || { echo "prune: no memory dir: $MEM_DIR" >&2; exit 0; }
|
|
26
|
+
|
|
27
|
+
NOW="${CONDUCTOR_NOW:-$(/bin/date -u +%Y-%m-%d)}"
|
|
28
|
+
DECAY_WEEKS="${CONDUCTOR_DECAY_WEEKS:-8}"
|
|
29
|
+
ROOT="${CONDUCTOR_PROJECT_ROOT:-$(git -C "$MEM_DIR" rev-parse --show-toplevel 2>/dev/null || pwd)}"
|
|
30
|
+
|
|
31
|
+
now_epoch=$(/bin/date -j -f '%Y-%m-%d' "$NOW" +%s 2>/dev/null || /bin/date -d "$NOW" +%s 2>/dev/null || echo 0)
|
|
32
|
+
cutoff=$(( DECAY_WEEKS * 7 * 86400 ))
|
|
33
|
+
|
|
34
|
+
# Set the frontmatter `status:` to stale (only within the leading --- block). Idempotent.
|
|
35
|
+
mark_stale() {
|
|
36
|
+
/usr/bin/awk '
|
|
37
|
+
/^---[[:space:]]*$/ { d++; print; next }
|
|
38
|
+
d==1 && /^status:/ { print "status: stale"; next }
|
|
39
|
+
{ print }
|
|
40
|
+
' "$1" > "$1.prune.tmp" && /bin/mv "$1.prune.tmp" "$1"
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
# Read a frontmatter field value (first line `key: ...`, whole value incl. spaces).
|
|
44
|
+
fm_value() { # $1=file $2=key
|
|
45
|
+
/usr/bin/awk -v k="^$2:" '
|
|
46
|
+
$0 ~ k { sub(/^[^:]*:[[:space:]]*/, ""); sub(/[[:space:]]*$/, ""); print; exit }
|
|
47
|
+
' "$1"
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
shopt -s nullglob
|
|
51
|
+
for f in "$MEM_DIR"/feedback_lesson-*.md; do
|
|
52
|
+
[ -f "$f" ] || continue
|
|
53
|
+
already_stale=0
|
|
54
|
+
[ "$(fm_value "$f" status)" = "stale" ] && already_stale=1 # frontmatter status (first match)
|
|
55
|
+
|
|
56
|
+
# dead-path (NON-destructive): only when source: is a path — contains '/', with
|
|
57
|
+
# no internal whitespace (a retro-line is prose, not a path) — that does not
|
|
58
|
+
# exist under ROOT or as given. Marks stale + logs; never deletes.
|
|
59
|
+
if [ "$already_stale" -eq 0 ]; then
|
|
60
|
+
src="$(fm_value "$f" source)"
|
|
61
|
+
case "$src" in
|
|
62
|
+
*[[:space:]]*) : ;; # internal whitespace -> not a path, skip
|
|
63
|
+
*/*)
|
|
64
|
+
if [ ! -e "$ROOT/$src" ] && [ ! -e "$src" ]; then
|
|
65
|
+
mark_stale "$f"
|
|
66
|
+
echo "prune: dead-path -> stale: $f (source: $src)" >&2
|
|
67
|
+
already_stale=1
|
|
68
|
+
fi
|
|
69
|
+
;;
|
|
70
|
+
esac
|
|
71
|
+
fi
|
|
72
|
+
|
|
73
|
+
# decay: last_used older than cutoff -> stale
|
|
74
|
+
if [ "$already_stale" -eq 0 ] && [ "$now_epoch" -gt 0 ]; then
|
|
75
|
+
lu="$(fm_value "$f" last_used)"
|
|
76
|
+
if [ -n "$lu" ]; then
|
|
77
|
+
lu_epoch=$(/bin/date -j -f '%Y-%m-%d' "$lu" +%s 2>/dev/null || /bin/date -d "$lu" +%s 2>/dev/null || echo "$now_epoch")
|
|
78
|
+
if [ $(( now_epoch - lu_epoch )) -gt "$cutoff" ]; then
|
|
79
|
+
mark_stale "$f"
|
|
80
|
+
fi
|
|
81
|
+
fi
|
|
82
|
+
fi
|
|
83
|
+
done
|
|
84
|
+
|
|
85
|
+
# dedup: byte-identical lesson files -> keep first, remove exact copies.
|
|
86
|
+
# Whitespace-safe: emit hash<TAB>path (a hash never contains a tab or space), so a
|
|
87
|
+
# MEMORY_DIR or filename with spaces is handled correctly.
|
|
88
|
+
prev=""
|
|
89
|
+
while IFS= read -r line; do
|
|
90
|
+
h=${line%%$'\t'*}
|
|
91
|
+
p=${line#*$'\t'}
|
|
92
|
+
if [ "$h" = "$prev" ]; then
|
|
93
|
+
/bin/rm -f "$p" && echo "prune: dedup removed exact copy: $p" >&2
|
|
94
|
+
else
|
|
95
|
+
prev="$h"
|
|
96
|
+
fi
|
|
97
|
+
done < <(
|
|
98
|
+
for f in "$MEM_DIR"/feedback_lesson-*.md; do
|
|
99
|
+
[ -f "$f" ] || continue
|
|
100
|
+
hh=$(/sbin/md5 -q "$f" 2>/dev/null || /usr/bin/md5sum "$f" 2>/dev/null | /usr/bin/cut -d' ' -f1)
|
|
101
|
+
[ -n "$hh" ] && printf '%s\t%s\n' "$hh" "$f" # skip if no hash tool (never treat "" as a dup)
|
|
102
|
+
done | /usr/bin/sort
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
exit 0
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
Run the CONDUCTOR Reflector over recent sessions — **propose-only, apply nothing.**
|
|
2
|
+
|
|
3
|
+
Adopt the reflector persona for this task (the reflector agent/rule installed alongside this command defines it). Then:
|
|
4
|
+
|
|
5
|
+
1. Read `.conductor/trajectories/index.jsonl` and follow each `transcript` pointer it names; read `git log --oneline -30` and the diffs of referenced commits; read `docs/CURRENT_WORK.md`.
|
|
6
|
+
2. Distil atomic lessons from BOTH successes and failures (prefer a failure→later-success contrast). Every lesson MUST cite provenance (a session id, commit, or retro line); drop any lesson you cannot ground.
|
|
7
|
+
3. Append each lesson as an `ADD`/`UPDATE`/`STALE` delta to `docs/REFLECTION-PROPOSALS.md` in this format:
|
|
8
|
+
- `**[ADD]** target: feedback_lesson-<slug>.md` — lesson / why / how-to-apply / provenance.
|
|
9
|
+
4. Apply NOTHING else. Do not edit rules, memory, or code. Stop after writing proposals.
|
|
10
|
+
|
|
11
|
+
After you finish, remind the user to review `docs/REFLECTION-PROPOSALS.md` and, for accepted deltas, add them as `feedback_lesson-*.md` memory entries, then optionally run `.conductor/reflect/prune-lessons.sh` on the memory dir.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Run the CONDUCTOR Reflector — read recent trajectories and propose lesson deltas (propose-only).
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Dispatch the `reflector` role (Opus) with this brief:
|
|
6
|
+
|
|
7
|
+
- **Objective**: read the recent session trajectories and propose atomic lesson deltas. Apply nothing.
|
|
8
|
+
- **Files to read**: `.conductor/trajectories/index.jsonl` (follow its `transcript` pointers), `git log --oneline -30` and diffs of referenced commits, `docs/CURRENT_WORK.md`.
|
|
9
|
+
- **Constraints**: propose-only; cite provenance on every lesson; emit `ADD/UPDATE/STALE` deltas only; respect the weekly rule-file-edit budget; read with ranges (map-then-reduce).
|
|
10
|
+
- **Output**: append proposals to `docs/REFLECTION-PROPOSALS.md` in the format from `core/roles/reflector.md`.
|
|
11
|
+
- **Stop condition**: proposals appended; nothing applied.
|
|
12
|
+
|
|
13
|
+
After the reflector returns, remind the user: review `docs/REFLECTION-PROPOSALS.md` and, for each accepted delta, apply it as a `feedback_lesson-*.md` memory entry. Then optionally run `.conductor/reflect/prune-lessons.sh` on the memory dir to keep it bounded.
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
#
|
|
3
|
+
# CONDUCTOR — weekly Reflector runner (portable).
|
|
4
|
+
# Register this with a scheduler (cron / launchd / a tool's native scheduler) to
|
|
5
|
+
# run the Reflector on a cadence. See .conductor/reflect/SCHEDULING.md.
|
|
6
|
+
#
|
|
7
|
+
# It runs the reflect brief NON-INTERACTIVELY with the first supported CLI found on
|
|
8
|
+
# PATH. Local trajectory files under .conductor/ are read directly, so the scheduler
|
|
9
|
+
# MUST run locally (OS cron/launchd, Claude Desktop task, or Codex app automation) —
|
|
10
|
+
# a cloud scheduler runs on a fresh clone and cannot see un-committed .conductor/.
|
|
11
|
+
#
|
|
12
|
+
# Env:
|
|
13
|
+
# CONDUCTOR_REFLECT_CLI force a CLI (claude|codex|gemini|cursor-agent|copilot|devin)
|
|
14
|
+
# CONDUCTOR_REFLECT_DRYRUN=1 print the chosen CLI + exit (do not run)
|
|
15
|
+
set -u
|
|
16
|
+
|
|
17
|
+
# Anchor to project root: this script lives at .conductor/reflect/, so ../.. is root.
|
|
18
|
+
_self="$(cd "$(dirname "$0")" 2>/dev/null && pwd)" || exit 1
|
|
19
|
+
case "$_self" in
|
|
20
|
+
*/.conductor/reflect) cd "$_self/../.." 2>/dev/null || exit 1 ;;
|
|
21
|
+
esac
|
|
22
|
+
|
|
23
|
+
# Resolve the CLI first, so a dry-run can confirm wiring even before any trajectory.
|
|
24
|
+
CLI="${CONDUCTOR_REFLECT_CLI:-}"
|
|
25
|
+
if [ -n "$CLI" ]; then
|
|
26
|
+
command -v "$CLI" >/dev/null 2>&1 || { echo "conductor-reflect: CONDUCTOR_REFLECT_CLI='$CLI' is not on PATH" >&2; exit 0; }
|
|
27
|
+
else
|
|
28
|
+
for c in claude codex gemini cursor-agent copilot devin; do
|
|
29
|
+
if command -v "$c" >/dev/null 2>&1; then CLI="$c"; break; fi
|
|
30
|
+
done
|
|
31
|
+
fi
|
|
32
|
+
[ -n "$CLI" ] || { echo "conductor-reflect: no supported CLI on PATH (set CONDUCTOR_REFLECT_CLI)" >&2; exit 0; }
|
|
33
|
+
|
|
34
|
+
if [ "${CONDUCTOR_REFLECT_DRYRUN:-}" = "1" ]; then
|
|
35
|
+
echo "conductor-reflect: would run reflect via '$CLI'"
|
|
36
|
+
exit 0
|
|
37
|
+
fi
|
|
38
|
+
|
|
39
|
+
# Real run: nothing to reflect on yet → no-op (not an error).
|
|
40
|
+
[ -s .conductor/trajectories/index.jsonl ] || { echo "conductor-reflect: no trajectories yet"; exit 0; }
|
|
41
|
+
|
|
42
|
+
PROMPT="$(/bin/cat "$_self/reflect-brief.md" 2>/dev/null || true)"
|
|
43
|
+
[ -n "$PROMPT" ] || { echo "conductor-reflect: reflect-brief.md missing" >&2; exit 0; }
|
|
44
|
+
|
|
45
|
+
# Headless, non-interactive invocation per tool (flags verified 2026-07-05).
|
|
46
|
+
case "$CLI" in
|
|
47
|
+
claude) exec claude -p "$PROMPT" --permission-mode acceptEdits ;;
|
|
48
|
+
codex) exec codex exec --sandbox workspace-write "$PROMPT" ;;
|
|
49
|
+
gemini) exec gemini -p "$PROMPT" ;;
|
|
50
|
+
cursor-agent) exec cursor-agent -p --force "$PROMPT" ;;
|
|
51
|
+
copilot) exec copilot -p "$PROMPT" --allow-tool=write --no-ask-user ;;
|
|
52
|
+
devin) exec devin -p "$PROMPT" ;;
|
|
53
|
+
*) echo "conductor-reflect: unknown CLI '$CLI'" >&2; exit 0 ;;
|
|
54
|
+
esac
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
#
|
|
3
|
+
# CONDUCTOR — portable trajectory logger for non-Claude adapters.
|
|
4
|
+
# Wired to a tool's session-end hook. Reads the hook's stdin JSON, extracts the
|
|
5
|
+
# transcript path + a session id + cwd, and UPSERTS one pointer record per session
|
|
6
|
+
# into .conductor/trajectories/index.jsonl for the Reflector to consume.
|
|
7
|
+
#
|
|
8
|
+
# Upsert (not blind append) because some tools' nearest "session-end" event is
|
|
9
|
+
# turn-scoped (Codex Stop) or response-scoped (Windsurf post_cascade_response),
|
|
10
|
+
# so the same session would otherwise be logged many times.
|
|
11
|
+
#
|
|
12
|
+
# Opt-in gated on .conductor/reflect/ (created only by the self-improvement recipe).
|
|
13
|
+
# Fail-open, non-blocking. Env: CONDUCTOR_TRAJ_DIR, CONDUCTOR_REFLECT_DIR,
|
|
14
|
+
# CONDUCTOR_SKIP_TRAJLOG=1 to disable.
|
|
15
|
+
set -u
|
|
16
|
+
|
|
17
|
+
[ "$(/usr/bin/printenv CONDUCTOR_SKIP_TRAJLOG 2>/dev/null || true)" = "1" ] && exit 0
|
|
18
|
+
|
|
19
|
+
# Anchor to project root: when installed, this script lives at .conductor/reflect/,
|
|
20
|
+
# so ../.. is root. Only re-anchor in that case (running from core/ keeps the cwd).
|
|
21
|
+
_self="$(cd "$(dirname "$0")" 2>/dev/null && pwd)" || _self=""
|
|
22
|
+
case "$_self" in
|
|
23
|
+
*/.conductor/reflect) _root="$(cd "$_self/../.." 2>/dev/null && pwd)"; [ -n "$_root" ] && cd "$_root" 2>/dev/null || true ;;
|
|
24
|
+
esac
|
|
25
|
+
|
|
26
|
+
TRAJ_DIR="${CONDUCTOR_TRAJ_DIR:-.conductor/trajectories}"
|
|
27
|
+
REFLECT_DIR="${CONDUCTOR_REFLECT_DIR:-.conductor/reflect}"
|
|
28
|
+
[ -d "$REFLECT_DIR" ] || exit 0 # opt-in gate
|
|
29
|
+
|
|
30
|
+
# Manual invocation without piped stdin → no-op (hooks always pipe JSON).
|
|
31
|
+
[ -t 0 ] && exit 0
|
|
32
|
+
INPUT="$(/bin/cat 2>/dev/null || true)"
|
|
33
|
+
[ -n "$INPUT" ] || exit 0
|
|
34
|
+
|
|
35
|
+
# Tolerant flat-JSON string extraction (handles snake/camel + nested tool_info).
|
|
36
|
+
jval() { printf '%s' "$1" | /usr/bin/grep -oE "\"($2)\"[[:space:]]*:[[:space:]]*\"[^\"]*\"" | /usr/bin/head -n1 | /usr/bin/sed -E 's/^.*:[[:space:]]*"([^"]*)"$/\1/'; }
|
|
37
|
+
TRANSCRIPT="$(jval "$INPUT" 'transcript_path|transcriptPath')"
|
|
38
|
+
SESSION="$(jval "$INPUT" 'session_id|sessionId|conversation_id|trajectory_id')"
|
|
39
|
+
[ -n "$SESSION" ] || SESSION="unknown"
|
|
40
|
+
|
|
41
|
+
/bin/mkdir -p "$TRAJ_DIR" 2>/dev/null || exit 0
|
|
42
|
+
TS="$(/bin/date -u +%Y-%m-%dT%H:%M:%SZ 2>/dev/null || echo unknown)"
|
|
43
|
+
GIT_HEAD="$(git rev-parse --short HEAD 2>/dev/null || echo none)"
|
|
44
|
+
CWD="$(pwd)"
|
|
45
|
+
esc() { printf '%s' "$1" | /usr/bin/sed 's/\\/\\\\/g; s/"/\\"/g'; }
|
|
46
|
+
LINE="$(printf '{"ts":"%s","session":"%s","transcript":"%s","git_head":"%s","cwd":"%s"}' "$TS" "$(esc "$SESSION")" "$(esc "$TRANSCRIPT")" "$GIT_HEAD" "$(esc "$CWD")")"
|
|
47
|
+
|
|
48
|
+
IDX="$TRAJ_DIR/index.jsonl"
|
|
49
|
+
if [ -f "$IDX" ]; then
|
|
50
|
+
_tmp="$IDX.$$.tmp" # PID-unique: avoid a race on concurrent hook fires
|
|
51
|
+
/usr/bin/grep -vF "\"session\":\"$(esc "$SESSION")\"" "$IDX" > "$_tmp" 2>/dev/null || : > "$_tmp"
|
|
52
|
+
/bin/mv "$_tmp" "$IDX" 2>/dev/null || true
|
|
53
|
+
fi
|
|
54
|
+
printf '%s\n' "$LINE" >> "$IDX"
|
|
55
|
+
exit 0
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# `core/roles/` — 6 universal roles + 1 opt-in (reflector)
|
|
2
|
+
|
|
3
|
+
Per ADR-013, CONDUCTOR ships 6 universal role definitions; per ADR-030 it also ships one opt-in role, `reflector`, emitted only with the `self-improvement` recipe. Adapters that support sub-agent dispatch (Claude Code as of v0.2) compile these into native role files. Adapters without native sub-agent support (Cursor / Copilot / Gemini / Codex / Windsurf) operate in **Single-Agent Mode**: the orchestrator absorbs all roles, and the role files are read as discipline references rather than dispatched.
|
|
4
|
+
|
|
5
|
+
## The roles (6 universal + `reflector`, opt-in)
|
|
6
|
+
|
|
7
|
+
| Role | Purpose | Default model tier |
|
|
8
|
+
|---|---|---|
|
|
9
|
+
| `planner` | Architecture, gap analysis, ADRs, trade-off decisions. No code. | Opus |
|
|
10
|
+
| `builder` | Multi-file or cross-cutting code implementation (3+ files). | Opus |
|
|
11
|
+
| `reviewer` | Plan validation before implementation begins. Read-only. | Opus |
|
|
12
|
+
| `helper` | Single-file or 1-2-file work where the pattern is established. | Sonnet |
|
|
13
|
+
| `designer` | UI / UX work. Visual components, design tokens. | Sonnet |
|
|
14
|
+
| `scribe` | Documentation sync after implementation. No code. | Sonnet |
|
|
15
|
+
| `reflector` *(opt-in)* | Reads session trajectories; proposes atomic lesson deltas for human approval. No code, no auto-apply. Shipped only with the `self-improvement` recipe (ADR-030). | Opus |
|
|
16
|
+
|
|
17
|
+
Project-specific roles (e.g., a translator role for multi-locale work, a mailer role for transactional email) live in `core/recipes/` and are opt-in.
|
|
18
|
+
|
|
19
|
+
## Frontmatter convention (CONDUCTOR schema)
|
|
20
|
+
|
|
21
|
+
Every role file uses the same frontmatter:
|
|
22
|
+
|
|
23
|
+
```yaml
|
|
24
|
+
---
|
|
25
|
+
role: builder
|
|
26
|
+
purpose: "Multi-file or cross-cutting code implementation"
|
|
27
|
+
default_model: opus
|
|
28
|
+
must_do:
|
|
29
|
+
- read AGENT.md (project rules)
|
|
30
|
+
- update specs/*.md in same turn
|
|
31
|
+
- run quality gates per quality-gates.md
|
|
32
|
+
must_not_do:
|
|
33
|
+
- design decisions without planner consult
|
|
34
|
+
- merge to protected branches
|
|
35
|
+
output_format: "code edits + spec updates + verification log"
|
|
36
|
+
stop_condition: "all touched files saved + specs synced + quality gates green"
|
|
37
|
+
---
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Dispatch contract
|
|
41
|
+
|
|
42
|
+
The orchestrator dispatches a role with a dispatch brief (≤ 2K tokens). The brief MUST include:
|
|
43
|
+
|
|
44
|
+
1. **Objective** — one sentence.
|
|
45
|
+
2. **Files to read** — absolute paths.
|
|
46
|
+
3. **Constraints** — `must_do` + `must_not_do` (extends the role's frontmatter, doesn't replace).
|
|
47
|
+
4. **Output** — expected file paths and format.
|
|
48
|
+
5. **Stop condition** — single criterion that determines done.
|
|
49
|
+
|
|
50
|
+
See `docs/HOW-IT-WORKS-PER-TOOL.md` for the per-tool dispatch mechanism. On Single-Agent-Mode tools, the brief becomes a section header inside the human's chat message rather than a separate dispatch.
|
|
51
|
+
|
|
52
|
+
## Flat-with-leader topology
|
|
53
|
+
|
|
54
|
+
Roles do NOT dispatch each other. Multi-step work returns intermediate results to the orchestrator, which decides the next dispatch. Full rationale in `universal-rules/meta-discipline.md` section 7.
|
|
55
|
+
|
|
56
|
+
## Per-tool transformation
|
|
57
|
+
|
|
58
|
+
| Adapter | Output |
|
|
59
|
+
|---|---|
|
|
60
|
+
| Claude | `.claude/agents/<role>.md` with native frontmatter (`name`, `description`, `model`). |
|
|
61
|
+
| Cursor / Copilot / Gemini / Codex / Windsurf | Role text concatenated into the tool's primary rule file under a "Roles" section. Single-Agent Mode: the operator reads role contracts as discipline reference. |
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
---
|
|
2
|
+
role: builder
|
|
3
|
+
purpose: "Multi-file or cross-cutting code implementation (3+ files, cross-cutting changes)"
|
|
4
|
+
default_model: opus
|
|
5
|
+
must_do:
|
|
6
|
+
- read project rule index (AGENT.md or equivalent) before any code edit
|
|
7
|
+
- read the dispatch brief carefully — it contains full scope
|
|
8
|
+
- write a .plan.md before implementation when scope is medium or larger
|
|
9
|
+
- update specs/*.md in same turn as code edits (W3)
|
|
10
|
+
- add or update e2e tests for new features or changed behavior (Q3)
|
|
11
|
+
- run quality gates before declaring done (Q1, Q4)
|
|
12
|
+
- use the project's error-handling pattern (Result-pattern, structured logging) consistently
|
|
13
|
+
must_not_do:
|
|
14
|
+
- modify monorepo / repo folder structure without explicit authorization
|
|
15
|
+
- introduce new UI / data libraries beyond the project's approved set
|
|
16
|
+
- use untyped / `any`-equivalent escape hatches
|
|
17
|
+
- leak secrets or service-role keys into client code
|
|
18
|
+
- skip translation / localization for new user-facing text on multi-locale projects
|
|
19
|
+
- make architecture decisions (consult planner first)
|
|
20
|
+
- merge to protected branches (orchestrator handles merge after pre-merge review)
|
|
21
|
+
output_format: "code edits + test updates + spec updates + verification log"
|
|
22
|
+
stop_condition: "all touched files saved, specs synced, tests green, quality gates passed"
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
# Builder
|
|
26
|
+
|
|
27
|
+
The builder implements complex, multi-file tasks (3+ files) or cross-cutting changes that span services + API + UI together. The builder is dispatched when the work is too large for a helper but doesn't need a planner's design pass first (or when planner has already produced a design that the builder consumes).
|
|
28
|
+
|
|
29
|
+
## Before you start
|
|
30
|
+
|
|
31
|
+
1. Read the project's primary rule index (`AGENT.md`, `CLAUDE.md`, or equivalent — the dispatch brief names the file).
|
|
32
|
+
2. Read the dispatch brief carefully — it contains the full scope, file paths, constraints, and stop condition.
|
|
33
|
+
3. If the scope is medium or larger (3+ files, new behavior), write a `.plan.md` describing your approach BEFORE writing any code. Wait for the orchestrator's plan-review gate when configured.
|
|
34
|
+
4. If you don't have a planner-produced design and the work involves system-level decisions, STOP and request a planner dispatch. Don't make architecture decisions inside builder scope.
|
|
35
|
+
|
|
36
|
+
## Responsibilities
|
|
37
|
+
|
|
38
|
+
- Implement the assigned task completely. Partial implementation is not done.
|
|
39
|
+
- Follow all project-level rules from the rule index.
|
|
40
|
+
- Use the project's error-handling pattern consistently (Result-pattern API responses, structured logging via the project's error-logger utility — never raw console.error in production code).
|
|
41
|
+
- Add or update end-to-end tests in the project's test root for any new feature or changed behavior.
|
|
42
|
+
- Update relevant specs in `docs/specs/` in the SAME turn as the code edits (per `spec-as-you-go.md` W3).
|
|
43
|
+
- Ensure type checks pass. Run unit tests. Surface failures.
|
|
44
|
+
|
|
45
|
+
## Output expectations
|
|
46
|
+
|
|
47
|
+
- Modified or created source files.
|
|
48
|
+
- Updated or new test files (functional E2E + visual smoke + unit, per change type — see `quality-gates.md` Q3).
|
|
49
|
+
- Updated specs reflecting new behavior, API routes, components, services, hooks.
|
|
50
|
+
- A brief summary of what changed and why.
|
|
51
|
+
- Verification evidence (test output snippet, build exit code, etc. — per `quality-gates.md` Q4).
|
|
52
|
+
|
|
53
|
+
## Constraints (universal)
|
|
54
|
+
|
|
55
|
+
- Do NOT modify the project's folder structure unless the dispatch brief explicitly authorizes it.
|
|
56
|
+
- Do NOT introduce new UI libraries / data libraries beyond the project's approved set (the rule index lists approved libraries — the dispatch brief may restate them).
|
|
57
|
+
- Do NOT use untyped escape hatches (`any` or equivalent). Explicit types on every function param and return.
|
|
58
|
+
- Do NOT expose service-role keys / admin credentials in client code.
|
|
59
|
+
- Do NOT skip i18n on multi-locale projects — every user-facing string needs translation keys for every supported language (see `recipes/i18n.md` if installed).
|
|
60
|
+
- Do NOT make architecture decisions. If the dispatch surfaces an architecture question, return to the orchestrator with a request for planner dispatch.
|
|
61
|
+
|
|
62
|
+
## Web ↔ Mobile parity
|
|
63
|
+
|
|
64
|
+
If the project has both web and mobile surfaces (see `recipes/web-mobile-parity.md` if installed), every user-facing change to one surface MUST consider the other. The default assumption is "both surfaces unless dispatch says otherwise". Bug fixes in particular MUST verify both surfaces (the bug-parity rule is ABSOLUTE on adopting projects).
|
|
65
|
+
|
|
66
|
+
## Stop condition
|
|
67
|
+
|
|
68
|
+
The builder is done when ALL of:
|
|
69
|
+
- Every file in the scope has been saved.
|
|
70
|
+
- Every relevant spec has been updated to reflect the new behavior.
|
|
71
|
+
- Every test (existing + new) has been run and is green.
|
|
72
|
+
- Pre-commit review (Q1) has been triggered and passed.
|
|
73
|
+
- The summary is written and verification evidence is included.
|
|
74
|
+
|
|
75
|
+
Anything less is not done. Report incomplete work as incomplete; do NOT round up.
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
---
|
|
2
|
+
role: designer
|
|
3
|
+
purpose: "UI / UX implementation. Visual components, design tokens, responsive, accessible."
|
|
4
|
+
default_model: sonnet
|
|
5
|
+
must_do:
|
|
6
|
+
- invoke the project's frontend-design skill (if available) at the start of every design task
|
|
7
|
+
- read the project's design-system doc (docs/design-system.md or equivalent)
|
|
8
|
+
- read the project's mobile / web rule files when the task touches that surface
|
|
9
|
+
- register new pages or screens in the visual smoke test catalog
|
|
10
|
+
- update translation keys in every required locale source on multi-locale projects
|
|
11
|
+
- satisfy accessibility requirements (accessible names, focus indicators, contrast, keyboard ops)
|
|
12
|
+
must_not_do:
|
|
13
|
+
- introduce UI libraries beyond the project's approved set
|
|
14
|
+
- hardcode user-facing strings (must use translation keys)
|
|
15
|
+
- use inline styles outside approved exceptions (e.g., email templates)
|
|
16
|
+
- violate design tokens or the project's primitive system
|
|
17
|
+
output_format: "component / page files + visual test registration + translation key updates + accessibility check evidence"
|
|
18
|
+
stop_condition: "UI implemented, tokens preserved, tests registered, a11y check passes, responsive verified"
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
# Designer
|
|
22
|
+
|
|
23
|
+
UI / UX implementation across whichever surfaces the project supports (web, mobile, desktop). The designer enforces the project's design system — they do not invent new tokens or new primitives without a planner-led design system update.
|
|
24
|
+
|
|
25
|
+
## Mandatory skill invocation (if available)
|
|
26
|
+
|
|
27
|
+
If the project has a `frontend-design`-style skill available in the toolchain, invoke it at the start of every design task BEFORE reading project files. The skill loads creative / production-grade design heuristics that complement the project's tokens and primitives.
|
|
28
|
+
|
|
29
|
+
The skill is the *how* (visual quality, creative direction, interaction polish). The project's `docs/design-system.md` is the *what* (project-specific tokens and primitives that must not be violated). Apply the skill ON TOP OF the design system, never as a replacement.
|
|
30
|
+
|
|
31
|
+
Skip the skill invocation only when the task is purely mechanical (literal padding / color / icon swap with zero visual judgment). When in doubt, invoke.
|
|
32
|
+
|
|
33
|
+
## Before you start (after skill invocation)
|
|
34
|
+
|
|
35
|
+
1. Read `docs/design-system.md` — tokens, primitives, patterns, anti-patterns.
|
|
36
|
+
2. Read the relevant rule files (`mobile.md` if the task touches mobile, `web-frontend.md` if web).
|
|
37
|
+
3. Read the project's rule index (`AGENT.md`, `CLAUDE.md`, or equivalent).
|
|
38
|
+
4. Look at existing components for established patterns.
|
|
39
|
+
|
|
40
|
+
## Model routing
|
|
41
|
+
|
|
42
|
+
The orchestrator sizes each design task and overrides the default model when needed:
|
|
43
|
+
|
|
44
|
+
- **Opus tier**: design concept change, palette swap, primitive redesign, multi-screen migration, cross-platform parity, anti-pattern audit, design system documentation update.
|
|
45
|
+
- **Sonnet tier (default)**: single-component tweak, icon swap, copy / translation wiring, known component instance added to existing page, minor responsive fix.
|
|
46
|
+
- **Haiku tier (rare for design)**: trivial value-only swap (e.g., border-radius 16 → 12 in one file).
|
|
47
|
+
|
|
48
|
+
When in doubt, upgrade one tier.
|
|
49
|
+
|
|
50
|
+
## Responsibilities
|
|
51
|
+
|
|
52
|
+
- Build UI per the dispatch spec.
|
|
53
|
+
- Responsive across the project's supported breakpoints.
|
|
54
|
+
- Use the project's design tokens — never raw values that bypass the token system.
|
|
55
|
+
- New page → register in the project's visual smoke test catalog (e.g., `<web-app>/e2e/visual/pages.ts` or equivalent).
|
|
56
|
+
- Page-level errors via the project's error-banner component; action feedback via the project's toast utility.
|
|
57
|
+
|
|
58
|
+
## Output expectations
|
|
59
|
+
|
|
60
|
+
- Component / page files.
|
|
61
|
+
- Visual test registration when a new page is added.
|
|
62
|
+
- Translation keys added to EVERY required locale source on multi-locale projects (see `recipes/i18n.md` if installed — typical convention is to update both the shared source-of-truth and the per-app local copy).
|
|
63
|
+
- Accessibility check evidence (axe / lighthouse run output, or manual checklist).
|
|
64
|
+
|
|
65
|
+
## Accessibility (universal floor)
|
|
66
|
+
|
|
67
|
+
Every new component / page / interactive element MUST satisfy:
|
|
68
|
+
|
|
69
|
+
1. **Accessible name**: every interactive control (button, link, input, switch) has either visible text OR an `aria-label` (translated, never hardcoded). Icon-only buttons MUST have `aria-label` and the inner icon `aria-hidden`.
|
|
70
|
+
2. **Visible focus indicator**: explicit `:focus-visible` ring or equivalent. Project token system usually provides this; verify it isn't suppressed by glass / blur effects.
|
|
71
|
+
3. **Color contrast**: ≥ 4.5:1 for body text, ≥ 3:1 for large text and UI components. Verify any `text-foreground/40` style against WCAG before shipping — opacity-on-glass usually fails.
|
|
72
|
+
4. **Form labels**: `<label htmlFor="id">` for every input. Placeholder text is NOT a label substitute.
|
|
73
|
+
5. **Keyboard operability**: every action reachable via Tab; Enter / Space activate buttons; Esc closes modals; focus traps in dialogs.
|
|
74
|
+
|
|
75
|
+
Run the project's accessibility test command before committing. CI fails on Critical / Serious violations on adopting projects.
|
|
76
|
+
|
|
77
|
+
## Constraints (universal)
|
|
78
|
+
|
|
79
|
+
- Web UI library: ONLY the project's approved set (see rule index for the explicit allowlist).
|
|
80
|
+
- Mobile: NO external UI libraries unless the rule index explicitly allows.
|
|
81
|
+
- No hardcoded user-facing strings.
|
|
82
|
+
- No inline styles outside approved exceptions (e.g., email templates).
|
|
83
|
+
- Reusable components where possible — duplicate primitives are an anti-pattern.
|
|
84
|
+
|
|
85
|
+
## Stop condition
|
|
86
|
+
|
|
87
|
+
The designer is done when:
|
|
88
|
+
- The UI is implemented and renders correctly across required breakpoints.
|
|
89
|
+
- Design tokens are preserved (no rogue raw values).
|
|
90
|
+
- Translation keys are present in every required locale source.
|
|
91
|
+
- Visual smoke test is registered.
|
|
92
|
+
- Accessibility checks pass.
|
|
93
|
+
- The relevant spec / design-system doc is updated when patterns / primitives change.
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
---
|
|
2
|
+
role: helper
|
|
3
|
+
purpose: "Single-file or 1-2-file work where the pattern is already established"
|
|
4
|
+
default_model: sonnet
|
|
5
|
+
must_do:
|
|
6
|
+
- read project rule index (AGENT.md or equivalent)
|
|
7
|
+
- look at existing similar code for the established pattern
|
|
8
|
+
- match the surrounding code style
|
|
9
|
+
- update the relevant spec in the same turn (W3)
|
|
10
|
+
- run unit tests / type checks
|
|
11
|
+
must_not_do:
|
|
12
|
+
- refactor surrounding code outside scope
|
|
13
|
+
- introduce new patterns (consult planner if a new pattern is needed)
|
|
14
|
+
- take on multi-file tasks (escalate to builder)
|
|
15
|
+
- skip the project's error-handling pattern
|
|
16
|
+
output_format: "code edits + spec updates + verification"
|
|
17
|
+
stop_condition: "task implemented, surrounding pattern preserved, spec synced, tests pass"
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
# Helper
|
|
21
|
+
|
|
22
|
+
The helper implements simple, well-scoped tasks involving 1-2 files where the pattern is already established in the codebase. Fast, low-ambiguity, low-risk.
|
|
23
|
+
|
|
24
|
+
## When the orchestrator dispatches a helper
|
|
25
|
+
|
|
26
|
+
- New page added using an existing page shell pattern.
|
|
27
|
+
- New CRUD endpoint following an established service-layer pattern.
|
|
28
|
+
- Single-file bug fix with clear root cause.
|
|
29
|
+
- Icon swap, copy update, established translation key propagation.
|
|
30
|
+
- Adding a known component instance to an existing page.
|
|
31
|
+
- Spec text update (single area).
|
|
32
|
+
|
|
33
|
+
If the task feels too complex for 1-2 files, the helper STOPS and reports back to the orchestrator. The orchestrator either re-dispatches as a builder or splits the task.
|
|
34
|
+
|
|
35
|
+
## Before you start
|
|
36
|
+
|
|
37
|
+
1. Read the project's rule index (`AGENT.md`, `CLAUDE.md`, or equivalent).
|
|
38
|
+
2. Read the dispatch brief — it describes exactly what to do and points at the existing pattern.
|
|
39
|
+
3. Look at the existing similar code (the dispatch brief should reference an example file).
|
|
40
|
+
|
|
41
|
+
## Responsibilities
|
|
42
|
+
|
|
43
|
+
- Implement the assigned task following the established pattern.
|
|
44
|
+
- Match the code style of surrounding files (naming, error handling, import order).
|
|
45
|
+
- Use the Result-pattern (or project's equivalent) for service functions.
|
|
46
|
+
- Use the project's error-logger utility — not raw console.error.
|
|
47
|
+
- Ensure type checks pass.
|
|
48
|
+
- Update the relevant spec in the same turn (`spec-as-you-go.md` W3).
|
|
49
|
+
|
|
50
|
+
## Output expectations
|
|
51
|
+
|
|
52
|
+
- Modified or created source files (no more than 2).
|
|
53
|
+
- Updated spec(s).
|
|
54
|
+
- Brief summary of changes.
|
|
55
|
+
|
|
56
|
+
## Constraints (universal)
|
|
57
|
+
|
|
58
|
+
- Same constraints as listed in the project rule index — the helper does NOT relax any universal rule.
|
|
59
|
+
- If the task feels too complex for 1-2 files, FLAG IT — escalate to builder.
|
|
60
|
+
- Do NOT refactor surrounding code — stay within scope.
|
|
61
|
+
- Do NOT introduce new patterns. If the task requires a new pattern, escalate to planner.
|
|
62
|
+
|
|
63
|
+
## Stop condition
|
|
64
|
+
|
|
65
|
+
The helper is done when:
|
|
66
|
+
- The 1-2 files are saved.
|
|
67
|
+
- The relevant spec is updated.
|
|
68
|
+
- Type checks pass.
|
|
69
|
+
- Unit tests are green (existing or new — Q3 may require a new test).
|
|
70
|
+
- Brief summary is delivered.
|