@techgoblin/gobstack 0.6.0-alpha.4 → 0.6.0-beta.2

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.
Files changed (112) hide show
  1. package/CHANGELOG.md +59 -0
  2. package/README.md +249 -116
  3. package/VERSION +1 -1
  4. package/bans/README.md +5 -5
  5. package/bans/grep-ban.sh +1 -1
  6. package/bin/goblin-bans +103 -27
  7. package/bin/goblin-init +345 -259
  8. package/bin/goblin-install +269 -213
  9. package/bin/goblin-lib.sh +63 -66
  10. package/bin/goblin-map +130 -579
  11. package/bin/goblin-mcp.js +9 -14
  12. package/bin/goblin-verify +411 -993
  13. package/bin/goblin.js +4 -9
  14. package/docs/CURATION-2026-11-07-gobigrams.md +223 -0
  15. package/docs/GUIDE.md +727 -179
  16. package/docs/LIMITS.md +297 -301
  17. package/docs/RECORD-NOTES.md +1 -2
  18. package/manifest/bans.tsv +9 -9
  19. package/manifest/categories.tsv +18 -0
  20. package/manifest/enforcement.tsv +14 -67
  21. package/manifest/glossary.tsv +6 -12
  22. package/manifest/library.tsv +33 -0
  23. package/package.json +1 -4
  24. package/skills/goblin-bootstrap/SKILL.md +20 -32
  25. package/skills/goblin-feature-map/SKILL.md +1 -1
  26. package/skills/goblin-handoff/SKILL.md +5 -0
  27. package/skills/goblin-verify-author/SKILL.md +14 -2
  28. package/skills/practice/SKILL.md +4 -4
  29. package/templates/AGENTS.md.tmpl +6 -6
  30. package/templates/HANDOFF.md.tmpl +8 -6
  31. package/templates/SPEC.md.tmpl +2 -2
  32. package/templates/agents-block.tmpl +1 -10
  33. package/adapters/_template/adapter.tsv +0 -16
  34. package/adapters/_template/detect.sh +0 -10
  35. package/adapters/_template/emit.sh +0 -5
  36. package/adapters/_template/verify.sh +0 -4
  37. package/adapters/claude/adapter.tsv +0 -8
  38. package/adapters/claude/detect.sh +0 -8
  39. package/adapters/claude/verify.sh +0 -47
  40. package/adapters/codex/adapter.tsv +0 -12
  41. package/adapters/codex/detect.sh +0 -9
  42. package/adapters/codex/verify.sh +0 -45
  43. package/adapters/copilot/adapter.tsv +0 -10
  44. package/adapters/copilot/detect.sh +0 -8
  45. package/adapters/copilot/verify.sh +0 -45
  46. package/adapters/cursor/adapter.tsv +0 -11
  47. package/adapters/cursor/detect.sh +0 -10
  48. package/adapters/cursor/verify.sh +0 -45
  49. package/adapters/gemini/adapter.tsv +0 -15
  50. package/adapters/gemini/detect.sh +0 -11
  51. package/adapters/gemini/verify.sh +0 -49
  52. package/adapters/hermes/adapter.tsv +0 -9
  53. package/adapters/hermes/detect.sh +0 -8
  54. package/adapters/hermes/verify.sh +0 -27
  55. package/adapters/opencode/adapter.tsv +0 -14
  56. package/adapters/opencode/detect.sh +0 -9
  57. package/adapters/opencode/verify.sh +0 -45
  58. package/automations/README.md +0 -53
  59. package/automations/bugreporter-intake.sh +0 -145
  60. package/automations/drift-audit.sh +0 -139
  61. package/automations/report.schema.tsv +0 -10
  62. package/bin/goblin +0 -144
  63. package/bin/goblin-audit +0 -143
  64. package/bin/goblin-doctor +0 -233
  65. package/bin/goblin-emit +0 -495
  66. package/bin/goblin-extras +0 -365
  67. package/bin/goblin-model +0 -105
  68. package/bin/goblin-upgrade +0 -580
  69. package/docs/ADOPTION.md +0 -173
  70. package/docs/CI.md +0 -190
  71. package/docs/CONTRACTS.md +0 -218
  72. package/docs/DESIGN.md +0 -92
  73. package/docs/ENFORCEMENT.md +0 -228
  74. package/docs/FLOWS.md +0 -164
  75. package/docs/GLOSSARY.md +0 -40
  76. package/docs/GUARDRAILS.md +0 -126
  77. package/docs/INTEGRATION.md +0 -92
  78. package/docs/LOOP.md +0 -165
  79. package/docs/RE-PLAYBOOK.md +0 -183
  80. package/docs/RISKS.md +0 -70
  81. package/docs/ROLES.md +0 -105
  82. package/extras-catalogue/catalogue.tsv +0 -42
  83. package/extras-catalogue/payload/README.md +0 -14
  84. package/extras-catalogue/payload/taste-skill/taste/REFERENCE.md +0 -3
  85. package/extras-catalogue/payload/taste-skill/taste/SKILL.md +0 -9
  86. package/manifest/classes.tsv +0 -51
  87. package/manifest/playbooks.tsv +0 -16
  88. package/presets/electron-overlay.yaml +0 -38
  89. package/presets/fleet.yaml +0 -43
  90. package/presets/game.yaml +0 -38
  91. package/presets/research.yaml +0 -41
  92. package/presets/service.yaml +0 -40
  93. package/presets/software.yaml +0 -48
  94. package/roles.yaml +0 -54
  95. package/skills/goblin-bugfix/SKILL.md +0 -26
  96. package/skills/goblin-bugreporter/SKILL.md +0 -52
  97. package/skills/goblin-drift-audit/SKILL.md +0 -43
  98. package/skills/goblin-eval/SKILL.md +0 -68
  99. package/skills/goblin-feature/SKILL.md +0 -26
  100. package/skills/goblin-investigation/SKILL.md +0 -26
  101. package/skills/goblin-judge/SKILL.md +0 -74
  102. package/skills/goblin-loop/SKILL.md +0 -88
  103. package/skills/goblin-mode/SKILL.md +0 -70
  104. package/skills/goblin-overnight/SKILL.md +0 -42
  105. package/skills/goblin-pr-gate/SKILL.md +0 -42
  106. package/skills/goblin-re-mobile/SKILL.md +0 -51
  107. package/skills/goblin-refactor/SKILL.md +0 -23
  108. package/skills/goblin-sweep/SKILL.md +0 -23
  109. package/skills/goblin-tdd-repro/SKILL.md +0 -27
  110. package/templates/audit-waiver.tsv.tmpl +0 -10
  111. package/templates/install-hooks.allowlist.tmpl +0 -9
  112. package/templates/report.yaml.tmpl +0 -16
@@ -1,45 +0,0 @@
1
- #!/usr/bin/env bash
2
- # adapters/opencode/verify.sh — the DRIFT oracle (W4A-SPEC §7). Re-emits the context block
3
- # to a scratch buffer and cmps against the on-disk block; checks every emitted skill is
4
- # byte-identical to the source payload. No engine invocation, no network. Exit 0 clean,
5
- # 1 drift (names the path), 2 cannot run. Env: GOBLIN_DOCTOR_TARGET (default $PWD).
6
- set -uo pipefail
7
- SELF_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
8
- SRC=$(cd "$SELF_DIR/../.." && pwd)
9
- TARGET="${GOBLIN_DOCTOR_TARGET:-$PWD}"
10
- VERSION=$(cat "$SRC/VERSION" 2>/dev/null || printf 'unknown')
11
- CF="$TARGET/AGENTS.md"
12
- SKROOT="$TARGET/.opencode/skills"
13
- bad=0
14
-
15
- if [ -f "$CF" ] && grep -qF '<!-- goblin-stack:begin' "$CF"; then
16
- EXPECT=$(awk -v b="<!-- goblin-stack:begin" -v e="<!-- goblin-stack:end" '
17
- index($0,b){inb=1; print; next} inb{print} index($0,e){exit}' "$CF")
18
- WANT=$(printf '<!-- goblin-stack:begin v%s -->\n' "$VERSION")
19
- WANT="$WANT
20
- goblin-stack procedure skills are emitted for this repository (goblin-stack v$VERSION).
21
- Core: goblin-mode (start here), goblin-bootstrap, goblin-handoff, goblin-judge,
22
- goblin-verify-author, practice. Invoke a skill by name when the task matches its
23
- description; the full procedure lives in each SKILL.md.
24
- <!-- goblin-stack:end -->"
25
- if [ "$EXPECT" != "$WANT" ]; then
26
- printf 'context block in %s does not match v%s (stale marker VERSION or edited block)\n' "$CF" "$VERSION"
27
- bad=1
28
- fi
29
- fi
30
-
31
- if [ -d "$SKROOT" ]; then
32
- for d in "$SKROOT"/*/; do
33
- [ -d "$d" ] || continue
34
- name=$(basename "$d")
35
- case "$name" in goblin-*|practice) ;; *) continue ;; esac
36
- f="$d/SKILL.md"; sf="$SRC/skills/$name/SKILL.md"
37
- if [ ! -f "$f" ]; then continue; fi
38
- if [ ! -f "$sf" ] || ! cmp -s "$f" "$sf"; then
39
- printf 'emitted skill drifted: %s\n' "${f#"$TARGET"/}"
40
- bad=1
41
- fi
42
- done
43
- fi
44
- [ "$bad" -eq 0 ] && printf 'verified: opencode emission matches v%s byte-for-byte\n' "$VERSION"
45
- exit "$bad"
@@ -1,53 +0,0 @@
1
- # Automations — three parts, and only one of them lives in this repo
2
-
3
- An automation is a **card producer**, not an event daemon. It runs on a trigger, does read-only
4
- work, and its only write is a card. A defect gets fixed by P2, reviewed by P7, on other
5
- profiles. The three parts below are the whole design.
6
-
7
- producer (this repo) a deterministic script that cannot hallucinate. Silent when
8
- there is nothing to report. Costs zero tokens on a quiet run.
9
- |
10
- v
11
- card (the board) the ONLY trigger surface with a durable record and a model knob.
12
- `--skill <name>` is the label (there is no --label flag),
13
- `--idempotency-key` is the dedup, `--parent` is the lineage.
14
- |
15
- v
16
- repair (a skill) judgement starts here, on a different profile, under a playbook.
17
-
18
- P13 goblin-bugreporter a report arrived -> reproduce -> one fix card on proof
19
- P14 goblin-drift-audit a claim disagrees with the artifact -> one repair card per repo
20
-
21
- ## Files
22
-
23
- automations/drift-audit.sh A-02's producer. No network. Silent when clean.
24
- automations/bugreporter-intake.sh A-01's intake validator (schema check -> card, or a
25
- refusal card with no assignee).
26
- automations/report.schema.tsv the intake schema, machine-readable.
27
- templates/report.yaml.tmpl the report template the producer copies.
28
-
29
- The installer writes these into the target at `.goblin/automations/`, so the target is
30
- self-contained and `IN-02`/`SK-02` hash them like every other installed file.
31
-
32
- ## The fleet steps goblin-stack cannot do (it writes nothing outside its target)
33
-
34
- cp <target>/.goblin/automations/drift-audit.sh ~/.hermes/scripts/
35
- cp <target>/.goblin/automations/bugreporter-intake.sh ~/.hermes/scripts/
36
- hermes cron create "0 9 * * 1" --name "Drift audit - weekly" \
37
- --no-agent --script drift-audit.sh --deliver discord:<notification-channel>
38
- hermes skills trust <target>
39
-
40
- A cron script must resolve inside the profile's `scripts/` directory, which is why that copy
41
- step exists rather than an installer write. **Hook configuration is per-profile**: a hook
42
- declared only in the root `config.yaml` never fires for a worker running under another
43
- profile, so any notification hook must be declared in every profile that can be an assignee.
44
-
45
- ## Kill switches, and the order to turn one on
46
-
47
- 1. `hermes cron pause <id>` — stops the producer. Immediate, total, no agent involved.
48
- 2. `kanban.dispatch_profiles` excluding the automation's profile — fail-closed by construction.
49
- 3. The producer's own state file (`.goblin/automations/<name>.state`, `enabled: false`).
50
-
51
- Turn on A-02 first: no agent sits inside its producer. Run it by hand
52
- (`bash .goblin/automations/drift-audit.sh --dry-run`) and read the record before scheduling it.
53
- Only after that run is clean does A-01's trigger get enabled.
@@ -1,145 +0,0 @@
1
- #!/usr/bin/env bash
2
- # bugreporter-intake.sh — A-01's intake validator (the gate in front of `goblin-bugreporter`, P13).
3
- #
4
- # bash bugreporter-intake.sh <slug> [--reports <dir>] [--cards]
5
- #
6
- # A report is a FILE WITH A SCHEMA, not prose in a card body: prose invites the agent to fill
7
- # the gaps by guessing, and a guess at intake poisons everything downstream. This script does
8
- # the schema check with line-oriented shell, computes the content-only dedup key, and prints
9
- # the exact card command.
10
- #
11
- # Exit codes: 0 the report passed intake | 1 REFUSED (the gap is named) | 2 could not run.
12
- #
13
- # The report is UNTRUSTED INPUT, so nothing reads it into a shell: the card is created by
14
- # exec'ing an argv array (`run_card`), and the form printed for an operator (`card_cmd`) quotes
15
- # every value that came out of the report. There is no `eval` on any path. A `symptom:` carrying
16
- # a backtick, `$(...)` or a quote is text, in the card title and on the printed line alike.
17
- #
18
- # An under-specified report is filed, not dropped and not guessed: the refusal command carries
19
- # NO --assignee, so the dispatcher buckets the card `skipped_unassigned` and it is structurally
20
- # un-spawnable, while remaining visible on the board to a human.
21
- set -uo pipefail
22
-
23
- SLUG=""
24
- REPORTS="reports"
25
- CARDS=0
26
-
27
- while [ $# -gt 0 ]; do
28
- case "$1" in
29
- --reports) REPORTS="${2:-}"; shift 2 ;;
30
- --cards) CARDS=1; shift ;;
31
- -h|--help) sed -n '2,/^set -/p' "${BASH_SOURCE[0]}" | sed 's/^# \{0,1\}//'; exit 0 ;;
32
- -*)
33
- printf 'bugreporter-intake: unknown option: %s\n' "$1" >&2; exit 2 ;;
34
- *) SLUG="$1"; shift ;;
35
- esac
36
- done
37
-
38
- [ -n "$SLUG" ] || { printf 'bugreporter-intake: usage: bugreporter-intake.sh <slug> [--reports <dir>]\n' >&2; exit 2; }
39
- REPORT="$REPORTS/$SLUG/report.yaml"
40
- [ -f "$REPORT" ] || { printf 'bugreporter-intake: no report at %s\n' "$REPORT" >&2; exit 2; }
41
-
42
- field() { sed -n "s/^$1:[[:space:]]*//p" "$REPORT" | head -n 1; }
43
- # present <key> — the key exists AND carries something: an inline value, or at least one
44
- # indented item under it (repro_steps is a block list, so a bare `field` read is empty for a
45
- # perfectly good report - that false refusal was measured and is why this helper exists).
46
- present() {
47
- grep -q "^$1:" "$REPORT" || return 1
48
- [ -n "$(field "$1")" ] && return 0
49
- awk -v k="$1" '
50
- $0 ~ ("^" k ":[[:space:]]*$") { inb = 1; next }
51
- inb && /^[^[:space:]]/ { inb = 0 }
52
- inb && /^[[:space:]]+[^[:space:]]/ { f = 1 }
53
- END { exit !f }
54
- ' "$REPORT"
55
- }
56
- sha12() {
57
- if command -v sha256sum >/dev/null 2>&1; then printf '%s' "$1" | sha256sum | cut -c1-12
58
- else printf '%s' "$1" | shasum -a 256 | cut -c1-12; fi
59
- }
60
- # normalised = lowercased, whitespace collapsed, trimmed. The dedup key is a function of THIS
61
- # and nothing else: no date, no run id, no counter - or it dedups nothing.
62
- normalise() { printf '%s' "$1" | tr 'A-Z' 'a-z' | tr -s '[:space:]' ' ' | sed 's/^ //; s/ $//'; }
63
-
64
- REPO=$(field repo)
65
- SYMPTOM=$(field symptom)
66
- REVISION=$(field revision)
67
- KEY=$(field dedup_key)
68
-
69
- MISSING=""
70
- for k in repo symptom expected observed repro_steps revision; do
71
- present "$k" || MISSING="$MISSING $k"
72
- done
73
-
74
- WANT_KEY="bug:${REPO}:$(sha12 "$(normalise "$SYMPTOM")")"
75
-
76
- TITLE="bug: ${SYMPTOM}"
77
-
78
- # shq <word> — the word quoted for a shell, so the printed form can be pasted without executing
79
- # anything the report says. Single quotes make backticks and `$( )` text; an embedded single
80
- # quote is written as the four-character `'\''` (close, escaped quote, reopen).
81
- shq() { local s="$1"; s=${s//\'/\'\\\'\'}; printf "'%s'" "$s"; }
82
-
83
- # card_cmd <title-suffix> <idempotency-key> <max-runtime> <max-retries> [assignee-args...]
84
- # The card command as it is PRINTED for an operator. Every value that came out of the report is
85
- # shell-quoted; flags and numbers are printed literally, so the line stays greppable. The printed
86
- # form is what skills/goblin-bugreporter/SKILL.md step 1 tells the operator to run, so it must be
87
- # paste-safe: the report is the untrusted input this gate exists to validate (G8-1).
88
- card_cmd() {
89
- local title="$TITLE$1" key="$2" rt="$3" rr="$4"; shift 4
90
- local a
91
- printf 'hermes kanban create %s' "$(shq "$title")"
92
- for a in "$@"; do printf ' %s' "$a"; done
93
- printf ' --idempotency-key %s --body-file %s --max-runtime %s --max-retries %s\n' \
94
- "$(shq "$key")" "$(shq "$REPORT")" "$rt" "$rr"
95
- }
96
-
97
- # run_card <title-suffix> <idempotency-key> <max-runtime> <max-retries> [assignee-args...]
98
- # The same card as an ARGV ARRAY: no `eval`, no command string, so the title reaches the board as
99
- # ONE argument whatever it contains. Never build a shell command out of file content (G8-1).
100
- run_card() {
101
- local title="$TITLE$1" key="$2" rt="$3" rr="$4"; shift 4
102
- hermes kanban create "$title" "$@" --idempotency-key "$key" --body-file "$REPORT" \
103
- --max-runtime "$rt" --max-retries "$rr"
104
- }
105
-
106
- if [ -n "$MISSING" ]; then
107
- printf 'bugreporter-intake: REFUSED - %s carries no value for:%s\n' "$REPORT" "$MISSING"
108
- printf '# the card is created WITHOUT --assignee, so no agent can be spawned on it\n'
109
- card_cmd " (incomplete intake)" "${KEY:-incomplete:$SLUG}" 600 0
110
- exit 1
111
- fi
112
-
113
- if [ -n "$KEY" ] && [ "$KEY" != "$WANT_KEY" ]; then
114
- printf 'bugreporter-intake: REFUSED - the recorded dedup_key is not the content key\n'
115
- printf ' recorded %s\n recomputed %s\n' "$KEY" "$WANT_KEY"
116
- printf ' a key derived from a date, a run id or a counter dedups nothing\n'
117
- card_cmd " (bad key)" "$WANT_KEY" 600 0
118
- exit 1
119
- fi
120
-
121
- # The false-positive guard: a reproduction must name a revision that exists. A report with an
122
- # unverifiable `revision:` is a refusal, not a card.
123
- if [ -d "$REPO" ]; then
124
- if ! ( cd "$REPO" && git rev-parse --verify --quiet "$REVISION^{commit}" >/dev/null 2>&1 ); then
125
- printf 'bugreporter-intake: REFUSED - revision "%s" does not resolve in %s\n' "$REVISION" "$REPO"
126
- card_cmd " (unresolvable revision)" "$WANT_KEY" 600 0
127
- exit 1
128
- fi
129
- else
130
- printf '# note: %s is not a local directory - the revision gate is unexercised here\n' "$REPO" >&2
131
- fi
132
-
133
- if [ "$CARDS" -eq 0 ]; then
134
- card_cmd "" "$WANT_KEY" 1800 1 --assignee researcher --skill goblin-bugreporter
135
- exit 0
136
- fi
137
- if ! command -v hermes >/dev/null 2>&1; then
138
- printf 'bugreporter-intake: hermes is not on PATH - the command is printed, no card was created\n' >&2
139
- card_cmd "" "$WANT_KEY" 1800 1 --assignee researcher --skill goblin-bugreporter
140
- exit 0
141
- fi
142
- run_card "" "$WANT_KEY" 1800 1 --assignee researcher --skill goblin-bugreporter >/dev/null 2>&1 \
143
- || { printf 'bugreporter-intake: the card was NOT created\n' >&2; exit 1; }
144
- printf 'bugreporter-intake: card created with key %s\n' "$WANT_KEY"
145
- exit 0
@@ -1,139 +0,0 @@
1
- #!/usr/bin/env bash
2
- # drift-audit.sh — A-02's producer, the no-agent half of `goblin-drift-audit` (P14).
3
- #
4
- # bash drift-audit.sh [--root <glob>] [--state <file>] [--dry-run] [--cards] [--limit <n>]
5
- #
6
- # It compares a RECORDED CLAIM with an ARTIFACT, never a memory and never a judgement, so its
7
- # false-positive rate is structurally zero: the comparison is made by this script, which cannot
8
- # invent a finding.
9
- #
10
- # claim 1: the HANDOFF names a commit that exists here and is an ancestor of HEAD (HP-05)
11
- # claim 2: every installed file still matches its recorded hash (IN-02)
12
- # artifact: the repo's git state and the files on disk
13
- #
14
- # It is deliberately the FIRST automation to turn on: no agent sits inside the producer, so it
15
- # costs zero tokens when there is nothing to report.
16
- #
17
- # Exit codes: 0 clean, or nothing to do | 1 drift found | 2 could not run.
18
- #
19
- # Kill switch <state> carrying `enabled: false` stops it dead, and prints nothing on stdout.
20
- # Ceiling `run:` lines in <state> from the last 24 h, capped by --limit (default 5). A
21
- # capped run prints one `# capped` line, so "silent because clean" and "silent
22
- # because the ceiling was hit" are never confused for each other.
23
- set -uo pipefail
24
-
25
- ROOT_GLOB="${HOME}/projects/*"
26
- STATE="${GOBLIN_DRIFT_STATE:-${HOME}/.goblin/automations/drift-audit.state}"
27
- DRY_RUN=0
28
- CARDS=0
29
- LIMIT=5
30
-
31
- while [ $# -gt 0 ]; do
32
- case "$1" in
33
- --root) ROOT_GLOB="${2:-}"; shift 2 ;;
34
- --state) STATE="${2:-}"; shift 2 ;;
35
- --limit) LIMIT="${2:-}"; shift 2 ;;
36
- --dry-run) DRY_RUN=1; shift ;;
37
- --cards) CARDS=1; shift ;;
38
- -h|--help) sed -n '2,/^set -/p' "${BASH_SOURCE[0]}" | sed 's/^# \{0,1\}//'; exit 0 ;;
39
- *) printf 'drift-audit: unknown option: %s\n' "$1" >&2; exit 2 ;;
40
- esac
41
- done
42
-
43
- sha12() {
44
- if command -v sha256sum >/dev/null 2>&1; then printf '%s' "$1" | sha256sum | cut -c1-12
45
- else printf '%s' "$1" | shasum -a 256 | cut -c1-12; fi
46
- }
47
-
48
- # ---- kill switch -------------------------------------------------------------
49
- if [ -f "$STATE" ] && grep -q '^enabled:[[:space:]]*false' "$STATE"; then
50
- printf 'drift-audit: disabled (enabled: false in %s)\n' "$STATE" >&2
51
- exit 0
52
- fi
53
-
54
- # ---- the producer's own ceiling ----------------------------------------------
55
- TODAY=$(date -u +%F)
56
- RUNS=0
57
- if [ -f "$STATE" ]; then
58
- RUNS=$(grep -c "^run: $TODAY" "$STATE" 2>/dev/null || true)
59
- case "$RUNS" in ''|*[!0-9]*) RUNS=0 ;; esac
60
- fi
61
- if [ "$RUNS" -ge "$LIMIT" ]; then
62
- printf '# capped: %s of %s runs used today - nothing filed\n' "$RUNS" "$LIMIT"
63
- exit 0
64
- fi
65
-
66
- # ---- enumerate targets by glob, never by memory ------------------------------
67
- TARGETS=0
68
- SKIPPED=""
69
- DRIFT=""
70
- DETAIL=""
71
-
72
- for d in $ROOT_GLOB; do
73
- [ -d "$d" ] || continue
74
- TARGETS=$((TARGETS + 1))
75
- if [ ! -f "$d/.gob/goblin.yaml" ] && [ ! -f "$d/AGENTS.md" ]; then
76
- SKIPPED="$SKIPPED $(basename "$d")"
77
- continue
78
- fi
79
- if [ ! -f "$d/.gob/bin/goblin-verify" ]; then
80
- SKIPPED="$SKIPPED $(basename "$d")(no-verifier)"
81
- continue
82
- fi
83
- # --only IN-02,HP-05 rather than a full run: both are builtins that write no runtime state,
84
- # so the audit never edits the tree it is auditing (design rule 2 of the honesty section).
85
- OUT=$( cd "$d" && bash .gob/bin/goblin-verify --json --only IN-02,HP-05 2>/dev/null )
86
- RC=$?
87
- case "$RC" in
88
- 0|1) ;;
89
- *) SKIPPED="$SKIPPED $(basename "$d")(verify-exit-$RC)"; continue ;;
90
- esac
91
- FAILED=$(printf '%s' "$OUT" | grep -o '"id":"[A-Z][A-Z0-9-]*","status":"FAIL"' | sed 's/"id":"//; s/","status":"FAIL"//')
92
- for id in $FAILED; do
93
- DRIFT="$DRIFT $d/$id"
94
- DETAIL="$DETAIL$d $id cd $d && bash .gob/bin/goblin-verify --only $id
95
- "
96
- done
97
- done
98
-
99
- # ---- print nothing when there is nothing to file -----------------------------
100
- # A clean run writes nothing either: the ceiling counts the runs that FILED something (the
101
- # cards it created), never the runs that found nothing - otherwise a quiet week would exhaust
102
- # the ceiling and silence a real finding.
103
- if [ -z "$DRIFT" ]; then
104
- exit 0
105
- fi
106
-
107
- printf '%s' "$DETAIL"
108
- printf '# coverage: %s target(s) audited by glob, %s drifting, skipped:%s\n' \
109
- "$TARGETS" "$(printf '%s' "$DRIFT" | wc -w | tr -d ' ')" "${SKIPPED:- none}"
110
- printf '# run: %s of %s today\n' "$((RUNS + 1))" "$LIMIT"
111
-
112
- if [ "$DRY_RUN" -eq 0 ]; then
113
- [ -d "$(dirname "$STATE")" ] || mkdir -p "$(dirname "$STATE")"
114
- printf 'run: %s\n' "$TODAY" >> "$STATE"
115
- fi
116
- if [ "$CARDS" -eq 1 ]; then
117
- if command -v hermes >/dev/null 2>&1; then
118
- printf '%s' "$DETAIL" | while IFS=$'\t' read -r repo id cmd; do
119
- [ -n "$id" ] || continue
120
- KEY="drift:$(basename "$repo"):$id"
121
- BODY=$(mktemp)
122
- {
123
- printf '# Drift: %s %s\n\n' "$(basename "$repo")" "$id"
124
- printf 'The producer compared a recorded claim with an artifact and they disagree.\n\n'
125
- printf ' %s\n\n' "$cmd"
126
- printf 'Reproduces at %s. Dedup key: %s\n' "$(date -u +%F)" "$KEY"
127
- printf 'sha256 of the record: %s\n' "$(sha12 "$repo$id$cmd")"
128
- } > "$BODY"
129
- hermes kanban create "drift: $(basename "$repo") $id" --assignee architect \
130
- --skill goblin-drift-audit --idempotency-key "$KEY" --body-file "$BODY" \
131
- --max-runtime 1800 --max-retries 1 >/dev/null 2>&1 \
132
- || printf 'drift-audit: could not create the card for %s %s\n' "$(basename "$repo")" "$id" >&2
133
- rm -f "$BODY"
134
- done
135
- else
136
- printf 'drift-audit: hermes is not on PATH - the record is printed, no card was created\n' >&2
137
- fi
138
- fi
139
- exit 1
@@ -1,10 +0,0 @@
1
- key required shape
2
- repo yes path or remote of the repository the defect is in
3
- symptom yes one line, observable
4
- expected yes one line
5
- observed yes one line
6
- repro_steps yes ordered list, one item per line, 4-space indented
7
- revision yes a commit that exists in that repository
8
- dedup_key yes bug:<repo>:<sha256(normalised symptom)[:12]> - content only, never a date
9
- environment no platform/version; absent is recorded as unknown, never guessed
10
- evidence no paths to captures; evidence for a human, never harness proof
package/bin/goblin DELETED
@@ -1,144 +0,0 @@
1
- #!/usr/bin/env bash
2
- # goblin — the CLI dispatcher.
3
- #
4
- # gob init [--heuristic | --write <proposal>] [--target <dir>] [...]
5
- # gob map [target] [--agent | --heuristic] [--write <dir>] [--force]
6
- # gob verify [--only <id[,id...]>] [--json] [--list] [--source <path>]
7
- # gob bans [--only <id[,id...]>] [--list]
8
- # gob extras list [category] | show <id> | install <id...> [--target <dir>]
9
- # [--platform <id>] [--with-mcp-config] [--dry-run]
10
- # gob mcp serve the harness over MCP stdio
11
- # gob uninstall --target <dir>
12
- # gob --version
13
- #
14
- # v2 SURFACE (AI-driven development): the CLI calls no AI API. `gob init` and `gob map`
15
- # EMIT a prompt + schema that the agent already running in this repo fulfils with its own
16
- # tools; heuristic detection demotes to the --heuristic fallback.
17
- #
18
- # UNWIRED this session (code kept under bin/, deletion is session 3): doctor, audit,
19
- # upgrade, emit/sync. `sync` becomes an init-internal step (hidden --resync flag).
20
- #
21
- # Identity: the package is gobstack (npm @techgoblin/gobstack), the command is `gob`
22
- # (`goblin` remains as a legacy alias).
23
- #
24
- # The four-value verify contract is unchanged and non-negotiable (bin/goblin-verify:5-9):
25
- # 0 every executed check passed
26
- # 1 at least one check failed
27
- # 2 could not run
28
- # 3 the manifest itself is broken
29
- # Every subcommand propagates the engine's exit code verbatim; no wrapper translates a
30
- # 1 into a 0.
31
- #
32
- # Root resolution: find_installed_root() walks up from $PWD to an AGENTS.md carrying the
33
- # gob marker block; fall back to git toplevel, then $PWD — the D20 nested-repo fix.
34
- #
35
- # No npm, no jq, no yq, no network. bash/awk/sed/grep only.
36
-
37
- set -uo pipefail
38
-
39
- SELF_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
40
- SRC=$(cd "$SELF_DIR/.." && pwd)
41
- VERSION=$(cat "$SRC/VERSION" 2>/dev/null || printf 'unknown')
42
-
43
- g_err() { printf 'error: %s\n' "$*" >&2; }
44
-
45
- usage() {
46
- cat <<'USAGE'
47
- gob — the gobstack command line.
48
-
49
- gob init [--heuristic | --write <proposal>] [--target <dir>] [--class app|A-F] [--dry-run]
50
- gob map [target] [--agent | --heuristic] [--write <dir>] [--force]
51
- gob verify [--only <id[,id...]>] [--json] [--list] [--source <path>]
52
- gob bans [--only <id[,id...]>] [--list]
53
- gob extras list [category] | show <id> | install <id...> # the curated extras catalogue
54
- gob mcp serve the harness to your agent over MCP stdio (verify/map/init tools)
55
- gob uninstall --target <dir>
56
- gob --version
57
-
58
- gob init and gob map are AI-DRIVEN: they print a prompt + schema for the agent already
59
- running in this repo, which writes the proposal file; `--write` validates and installs
60
- it. The heuristic detectors are the --heuristic fallback.
61
-
62
- Exit codes (verify): 0 pass | 1 a check failed | 2 could not run | 3 the manifest is
63
- broken. Every subcommand propagates the engine's exit code verbatim.
64
- USAGE
65
- }
66
-
67
- # ---- the repo-root locator (an AGENTS.md gob block is the install marker) ----
68
- find_installed_root() {
69
- local d="$PWD"
70
- while :; do
71
- if [ -f "$d/AGENTS.md" ] && grep -q '^<!-- gob:begin' "$d/AGENTS.md" 2>/dev/null; then
72
- printf '%s\n' "$d"; return 0
73
- fi
74
- [ "$d" = "/" ] && return 1
75
- d=$(dirname "$d")
76
- done
77
- }
78
-
79
- # ---- subcommand dispatch ------------------------------------------------------
80
- CMD="${1:-}"
81
- [ -n "$CMD" ] || { usage; exit 2; }
82
- shift
83
-
84
- case "$CMD" in
85
- init)
86
- # The prompt+schema engine: prints the agent brief, or installs a proposal.
87
- exec bash "$SRC/bin/goblin-init" "$@"
88
- ;;
89
- map)
90
- # The standalone feature-map generator: `--agent` (default) prints prompt+schema;
91
- # --heuristic runs the scanner. Routes and propagates its 0/1/2 contract verbatim.
92
- exec bash "$SRC/bin/goblin-map" "$@"
93
- ;;
94
- verify)
95
- # The engine is whatever the per-repo chain resolves (W1 §2.3): --source, vendored,
96
- # engine_dir:, GOBLIN_ENGINE_DIR, ~/.goblin/engine — all inside goblin-verify. The
97
- # CLI is a pass-through, not a second root-resolution opinion (§3.4).
98
- exec bash "$SRC/bin/goblin-verify" "$@"
99
- ;;
100
- bans)
101
- exec bash "$SRC/bin/goblin-bans" "$@"
102
- ;;
103
- extras)
104
- # The curated catalogue browser + installer (bin/goblin-extras): list/show/install
105
- # over extras-catalogue/catalogue.tsv. The catalogue is the ALLOWLIST: nothing is
106
- # ever installed that a catalogue row does not name, and `gob init` only suggests.
107
- exec bash "$SRC/bin/goblin-extras" "$@"
108
- ;;
109
- mcp)
110
- # The MCP stdio server (bin/goblin-mcp.js): JSON-RPC 2.0 over stdin/stdout, a LOCAL
111
- # tool server over the vendored harness — no API call, no socket. node is the same
112
- # runtime bin/goblin.js already needs; it is exec'd directly, args pass through.
113
- exec node "$SRC/bin/goblin-mcp.js" "$@"
114
- ;;
115
- uninstall)
116
- # Routes into the installer's uninstall job. `--uninstall` is appended FIRST so the
117
- # user's own `--target <dir>` and options still parse.
118
- exec bash "$SRC/bin/goblin-install" --uninstall "$@"
119
- ;;
120
- --version|-V|-v)
121
- printf '%s\n' "$VERSION"
122
- exit 0
123
- ;;
124
- -h|--help|help)
125
- usage
126
- exit 0
127
- ;;
128
- doctor|audit|upgrade|emit|sync|install)
129
- # Unwired from usage in v2 (code kept; deletion is session 3). The refusal names
130
- # what replaced each verb rather than silently executing the old path.
131
- g_err "gob $CMD is unwired in v2."
132
- case "$CMD" in
133
- install|init-legacy) g_err "fix: gob init --write <proposal> installs a repo now." ;;
134
- sync|emit) g_err "fix: gob init --write <proposal> runs the sync step internally." ;;
135
- doctor|audit|upgrade) g_err "fix: gob verify (audit stays a deliberate manual step; see docs/)." ;;
136
- esac
137
- exit 2
138
- ;;
139
- *)
140
- g_err "unknown subcommand: $CMD"
141
- usage >&2
142
- exit 2
143
- ;;
144
- esac