cleargate 0.2.0 → 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.
Files changed (113) hide show
  1. package/LICENSE +21 -0
  2. package/dist/MANIFEST.json +59 -17
  3. package/dist/admin-api/index.cjs +88 -1
  4. package/dist/admin-api/index.cjs.map +1 -1
  5. package/dist/admin-api/index.d.cts +105 -1
  6. package/dist/admin-api/index.d.ts +105 -1
  7. package/dist/admin-api/index.js +77 -1
  8. package/dist/admin-api/index.js.map +1 -1
  9. package/dist/bootstrap-root-FGWDICDT.js +130 -0
  10. package/dist/bootstrap-root-FGWDICDT.js.map +1 -0
  11. package/dist/chunk-OM4FAEA7.js +184 -0
  12. package/dist/chunk-OM4FAEA7.js.map +1 -0
  13. package/dist/cli.cjs +7995 -3984
  14. package/dist/cli.cjs.map +1 -1
  15. package/dist/cli.js +4062 -561
  16. package/dist/cli.js.map +1 -1
  17. package/dist/templates/cleargate-planning/.claude/agents/architect.md +72 -0
  18. package/dist/templates/cleargate-planning/.claude/agents/developer.md +45 -3
  19. package/dist/templates/cleargate-planning/.claude/agents/qa.md +7 -3
  20. package/dist/templates/cleargate-planning/.claude/agents/reporter.md +72 -75
  21. package/dist/templates/cleargate-planning/.claude/hooks/pending-task-sentinel.sh +204 -0
  22. package/dist/templates/cleargate-planning/.claude/hooks/pre-commit-surface-gate.sh +10 -0
  23. package/dist/templates/cleargate-planning/.claude/hooks/pre-commit-test-ratchet.sh +58 -0
  24. package/dist/templates/cleargate-planning/.claude/hooks/pre-commit.sh +19 -0
  25. package/dist/templates/cleargate-planning/.claude/hooks/session-start.sh +51 -0
  26. package/dist/templates/cleargate-planning/.claude/hooks/token-ledger.sh +1 -1
  27. package/dist/templates/cleargate-planning/.claude/settings.json +11 -0
  28. package/dist/templates/cleargate-planning/.claude/skills/flashcard/SKILL.md +31 -12
  29. package/dist/templates/cleargate-planning/.cleargate/FLASHCARD.md +2 -1
  30. package/dist/templates/cleargate-planning/.cleargate/config.example.yml +37 -0
  31. package/dist/templates/cleargate-planning/.cleargate/knowledge/cleargate-protocol.md +407 -0
  32. package/dist/templates/cleargate-planning/.cleargate/scripts/assert_story_files.mjs +146 -0
  33. package/dist/templates/cleargate-planning/.cleargate/scripts/close_sprint.mjs +250 -0
  34. package/dist/templates/cleargate-planning/.cleargate/scripts/constants.mjs +57 -0
  35. package/dist/templates/cleargate-planning/.cleargate/scripts/file_surface_diff.sh +320 -0
  36. package/dist/templates/cleargate-planning/.cleargate/scripts/gate-checks.json +15 -0
  37. package/dist/templates/cleargate-planning/.cleargate/scripts/init_gate_config.sh +38 -0
  38. package/dist/templates/cleargate-planning/.cleargate/scripts/init_sprint.mjs +187 -0
  39. package/dist/templates/cleargate-planning/.cleargate/scripts/pre_gate_common.sh +132 -0
  40. package/dist/templates/cleargate-planning/.cleargate/scripts/pre_gate_runner.sh +307 -0
  41. package/dist/templates/cleargate-planning/.cleargate/scripts/prefill_report.mjs +280 -0
  42. package/dist/templates/cleargate-planning/.cleargate/scripts/run_script.sh +123 -0
  43. package/dist/templates/cleargate-planning/.cleargate/scripts/state.schema.json +110 -0
  44. package/dist/templates/cleargate-planning/.cleargate/scripts/suggest_improvements.mjs +247 -0
  45. package/dist/templates/cleargate-planning/.cleargate/scripts/surface-whitelist.txt +27 -0
  46. package/dist/templates/cleargate-planning/.cleargate/scripts/test/test_assert_story_files.sh +261 -0
  47. package/dist/templates/cleargate-planning/.cleargate/scripts/test/test_file_surface.sh +210 -0
  48. package/dist/templates/cleargate-planning/.cleargate/scripts/test/test_flashcard_gate.sh +190 -0
  49. package/dist/templates/cleargate-planning/.cleargate/scripts/test/test_test_ratchet.sh +327 -0
  50. package/dist/templates/cleargate-planning/.cleargate/scripts/test_ratchet.mjs +261 -0
  51. package/dist/templates/cleargate-planning/.cleargate/scripts/update_state.mjs +154 -0
  52. package/dist/templates/cleargate-planning/.cleargate/scripts/validate_bounce_readiness.mjs +111 -0
  53. package/dist/templates/cleargate-planning/.cleargate/scripts/validate_state.mjs +164 -0
  54. package/dist/templates/cleargate-planning/.cleargate/templates/Bug.md +9 -0
  55. package/dist/templates/cleargate-planning/.cleargate/templates/CR.md +9 -0
  56. package/dist/templates/cleargate-planning/.cleargate/templates/Sprint Plan Template.md +29 -3
  57. package/dist/templates/cleargate-planning/.cleargate/templates/epic.md +9 -0
  58. package/dist/templates/cleargate-planning/.cleargate/templates/proposal.md +9 -0
  59. package/dist/templates/cleargate-planning/.cleargate/templates/sprint_context.md +42 -0
  60. package/dist/templates/cleargate-planning/.cleargate/templates/sprint_report.md +175 -0
  61. package/dist/templates/cleargate-planning/.cleargate/templates/story.md +29 -0
  62. package/dist/templates/cleargate-planning/CLAUDE.md +3 -0
  63. package/dist/templates/cleargate-planning/MANIFEST.json +59 -17
  64. package/dist/whoami-CX7CXJD5.js +76 -0
  65. package/dist/whoami-CX7CXJD5.js.map +1 -0
  66. package/package.json +6 -2
  67. package/templates/cleargate-planning/.claude/agents/architect.md +72 -0
  68. package/templates/cleargate-planning/.claude/agents/developer.md +45 -3
  69. package/templates/cleargate-planning/.claude/agents/qa.md +7 -3
  70. package/templates/cleargate-planning/.claude/agents/reporter.md +72 -75
  71. package/templates/cleargate-planning/.claude/hooks/pending-task-sentinel.sh +204 -0
  72. package/templates/cleargate-planning/.claude/hooks/pre-commit-surface-gate.sh +10 -0
  73. package/templates/cleargate-planning/.claude/hooks/pre-commit-test-ratchet.sh +58 -0
  74. package/templates/cleargate-planning/.claude/hooks/pre-commit.sh +19 -0
  75. package/templates/cleargate-planning/.claude/hooks/session-start.sh +51 -0
  76. package/templates/cleargate-planning/.claude/hooks/token-ledger.sh +1 -1
  77. package/templates/cleargate-planning/.claude/settings.json +11 -0
  78. package/templates/cleargate-planning/.claude/skills/flashcard/SKILL.md +31 -12
  79. package/templates/cleargate-planning/.cleargate/FLASHCARD.md +2 -1
  80. package/templates/cleargate-planning/.cleargate/config.example.yml +37 -0
  81. package/templates/cleargate-planning/.cleargate/knowledge/cleargate-protocol.md +407 -0
  82. package/templates/cleargate-planning/.cleargate/scripts/assert_story_files.mjs +146 -0
  83. package/templates/cleargate-planning/.cleargate/scripts/close_sprint.mjs +250 -0
  84. package/templates/cleargate-planning/.cleargate/scripts/constants.mjs +57 -0
  85. package/templates/cleargate-planning/.cleargate/scripts/file_surface_diff.sh +320 -0
  86. package/templates/cleargate-planning/.cleargate/scripts/gate-checks.json +15 -0
  87. package/templates/cleargate-planning/.cleargate/scripts/init_gate_config.sh +38 -0
  88. package/templates/cleargate-planning/.cleargate/scripts/init_sprint.mjs +187 -0
  89. package/templates/cleargate-planning/.cleargate/scripts/pre_gate_common.sh +132 -0
  90. package/templates/cleargate-planning/.cleargate/scripts/pre_gate_runner.sh +307 -0
  91. package/templates/cleargate-planning/.cleargate/scripts/prefill_report.mjs +280 -0
  92. package/templates/cleargate-planning/.cleargate/scripts/run_script.sh +123 -0
  93. package/templates/cleargate-planning/.cleargate/scripts/state.schema.json +110 -0
  94. package/templates/cleargate-planning/.cleargate/scripts/suggest_improvements.mjs +247 -0
  95. package/templates/cleargate-planning/.cleargate/scripts/surface-whitelist.txt +27 -0
  96. package/templates/cleargate-planning/.cleargate/scripts/test/test_assert_story_files.sh +261 -0
  97. package/templates/cleargate-planning/.cleargate/scripts/test/test_file_surface.sh +210 -0
  98. package/templates/cleargate-planning/.cleargate/scripts/test/test_flashcard_gate.sh +190 -0
  99. package/templates/cleargate-planning/.cleargate/scripts/test/test_test_ratchet.sh +327 -0
  100. package/templates/cleargate-planning/.cleargate/scripts/test_ratchet.mjs +261 -0
  101. package/templates/cleargate-planning/.cleargate/scripts/update_state.mjs +154 -0
  102. package/templates/cleargate-planning/.cleargate/scripts/validate_bounce_readiness.mjs +111 -0
  103. package/templates/cleargate-planning/.cleargate/scripts/validate_state.mjs +164 -0
  104. package/templates/cleargate-planning/.cleargate/templates/Bug.md +9 -0
  105. package/templates/cleargate-planning/.cleargate/templates/CR.md +9 -0
  106. package/templates/cleargate-planning/.cleargate/templates/Sprint Plan Template.md +29 -3
  107. package/templates/cleargate-planning/.cleargate/templates/epic.md +9 -0
  108. package/templates/cleargate-planning/.cleargate/templates/proposal.md +9 -0
  109. package/templates/cleargate-planning/.cleargate/templates/sprint_context.md +42 -0
  110. package/templates/cleargate-planning/.cleargate/templates/sprint_report.md +175 -0
  111. package/templates/cleargate-planning/.cleargate/templates/story.md +29 -0
  112. package/templates/cleargate-planning/CLAUDE.md +3 -0
  113. package/templates/cleargate-planning/MANIFEST.json +59 -17
@@ -0,0 +1,58 @@
1
+ #!/usr/bin/env bash
2
+ # pre-commit-test-ratchet.sh — STORY-014-04: Pre-existing Test-Failure Ratchet
3
+ #
4
+ # Invoked by .claude/hooks/pre-commit.sh dispatcher (STORY-014-01).
5
+ # Runs test_ratchet.mjs in 'check' mode and blocks commit on regression.
6
+ #
7
+ # Bypass (discouraged): SKIP_TEST_RATCHET=1
8
+ # Timeout: 120s (enough for current cleargate-cli suite ~45s)
9
+ #
10
+ # macOS compatibility: 'timeout' is GNU coreutils; on macOS use 'gtimeout' (brew coreutils).
11
+ # Fallback: if neither is available, run without timeout and print a warning.
12
+
13
+ set -euo pipefail
14
+
15
+ SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
16
+ REPO_ROOT="${CLEARGATE_REPO_ROOT:-$(cd "${SCRIPT_DIR}/../.." && pwd)}"
17
+
18
+ # ---------------------------------------------------------------------------
19
+ # Bypass
20
+ # ---------------------------------------------------------------------------
21
+ if [[ "${SKIP_TEST_RATCHET:-0}" == "1" ]]; then
22
+ echo "test-ratchet: SKIP_TEST_RATCHET=1 — bypassing test ratchet check (discouraged)" >&2
23
+ exit 0
24
+ fi
25
+
26
+ # ---------------------------------------------------------------------------
27
+ # Resolve timeout binary (GNU on Linux; gtimeout on macOS via brew)
28
+ # ---------------------------------------------------------------------------
29
+ TIMEOUT_CMD=""
30
+ if command -v timeout &>/dev/null; then
31
+ TIMEOUT_CMD="timeout 120"
32
+ elif command -v gtimeout &>/dev/null; then
33
+ TIMEOUT_CMD="gtimeout 120"
34
+ else
35
+ echo "test-ratchet: WARNING — 'timeout' not found; running without 120s guard" >&2
36
+ fi
37
+
38
+ # ---------------------------------------------------------------------------
39
+ # Run ratchet
40
+ # ---------------------------------------------------------------------------
41
+ RATCHET_SCRIPT="${REPO_ROOT}/.cleargate/scripts/test_ratchet.mjs"
42
+
43
+ if [[ ! -f "${RATCHET_SCRIPT}" ]]; then
44
+ echo "test-ratchet: ERROR — ratchet script not found at ${RATCHET_SCRIPT}" >&2
45
+ exit 1
46
+ fi
47
+
48
+ export CLEARGATE_REPO_ROOT="${REPO_ROOT}"
49
+
50
+ ${TIMEOUT_CMD} node "${RATCHET_SCRIPT}" check
51
+ STATUS=$?
52
+
53
+ if [[ ${STATUS} -eq 124 ]]; then
54
+ echo "test-ratchet: ERROR — ratchet timed out after 120s; commit blocked" >&2
55
+ exit 1
56
+ fi
57
+
58
+ exit ${STATUS}
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env bash
2
+ # pre-commit.sh — Dispatcher: chains all pre-commit-*.sh hooks in lexical order.
3
+ #
4
+ # Install: ln -sf ../../.claude/hooks/pre-commit.sh .git/hooks/pre-commit
5
+ #
6
+ # Each pre-commit-*.sh is expected to exit 0 on success or non-zero to block.
7
+ # The dispatcher exits on the first non-zero exit code.
8
+
9
+ set -euo pipefail
10
+
11
+ HOOK_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
12
+
13
+ for hook in "${HOOK_DIR}"/pre-commit-*.sh; do
14
+ [[ -f "${hook}" ]] || continue
15
+ [[ -x "${hook}" ]] || continue
16
+ bash "${hook}" || exit $?
17
+ done
18
+
19
+ exit 0
@@ -2,3 +2,54 @@
2
2
  set -u
3
3
  REPO_ROOT="${CLAUDE_PROJECT_DIR}"
4
4
  node "${REPO_ROOT}/cleargate-cli/dist/cli.js" doctor --session-start 2>/dev/null || true
5
+
6
+ # ── §14.9 SessionStart sync nudge (STORY-010-08) ─────────────────────────────
7
+ # Daily-throttled: probe remote for updates at most once per 24h.
8
+ # Never auto-pulls or auto-pushes. Exits 0 regardless of outcome.
9
+ MARKER="${REPO_ROOT}/.cleargate/.sync-marker.json"
10
+ NOW_ISO=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
11
+ NOW_EPOCH=$(date +%s)
12
+
13
+ if [ ! -f "${MARKER}" ]; then
14
+ # First run — write marker with current timestamp and skip MCP call (24h grace).
15
+ mkdir -p "$(dirname "${MARKER}")"
16
+ printf '{"last_check":"%s"}' "${NOW_ISO}" > "${MARKER}"
17
+ else
18
+ # Parse last_check epoch from marker using node (portable, avoids jq dep)
19
+ LAST_CHECK_ISO=$(node -e "try{const m=JSON.parse(require('fs').readFileSync('${MARKER}','utf8'));process.stdout.write(m.last_check||'1970-01-01T00:00:00Z')}catch{process.stdout.write('1970-01-01T00:00:00Z')}" 2>/dev/null || echo "1970-01-01T00:00:00Z")
20
+ LAST_EPOCH=$(node -e "process.stdout.write(String(Math.floor(new Date('${LAST_CHECK_ISO}').getTime()/1000)))" 2>/dev/null || echo "0")
21
+ ELAPSED=$(( NOW_EPOCH - LAST_EPOCH ))
22
+
23
+ if [ "${ELAPSED}" -ge 86400 ]; then
24
+ # ≥24h since last check — run probe (3s timeout, R7 mitigation)
25
+ RESULT_FILE=$(mktemp)
26
+ # Cross-platform 3-second timeout: prefer `timeout` (Linux); fall back to
27
+ # background-process kill (macOS where GNU coreutils may be absent).
28
+ if command -v timeout > /dev/null 2>&1; then
29
+ timeout 3 node "${REPO_ROOT}/cleargate-cli/dist/cli.js" sync --check > "${RESULT_FILE}" 2>/dev/null || true
30
+ else
31
+ node "${REPO_ROOT}/cleargate-cli/dist/cli.js" sync --check > "${RESULT_FILE}" 2>/dev/null &
32
+ _PROBE_PID=$!
33
+ (sleep 3 && kill "${_PROBE_PID}" 2>/dev/null) &
34
+ _KILL_PID=$!
35
+ wait "${_PROBE_PID}" 2>/dev/null || true
36
+ kill "${_KILL_PID}" 2>/dev/null || true
37
+ wait "${_KILL_PID}" 2>/dev/null || true
38
+ fi
39
+ UPDATES=$(node -e "
40
+ try {
41
+ var data = require('fs').readFileSync(process.argv[1], 'utf8').trim();
42
+ var obj = JSON.parse(data);
43
+ process.stdout.write(String(obj.updates || 0));
44
+ } catch(e) {
45
+ process.stdout.write('0');
46
+ }
47
+ " "${RESULT_FILE}" 2>/dev/null || echo "0")
48
+ rm -f "${RESULT_FILE}"
49
+ if [ "${UPDATES}" -gt 0 ] 2>/dev/null; then
50
+ printf '📡 ClearGate: %s remote updates since yesterday — run `cleargate sync` to reconcile.\n' "${UPDATES}"
51
+ fi
52
+ # Marker is updated by sync --check itself; no re-write needed here.
53
+ fi
54
+ fi
55
+ exit 0
@@ -32,7 +32,7 @@
32
32
 
33
33
  set -u
34
34
 
35
- REPO_ROOT="/Users/ssuladze/Documents/Dev/ClearGate"
35
+ REPO_ROOT="${ORCHESTRATOR_PROJECT_DIR:-${CLAUDE_PROJECT_DIR}}"
36
36
  LOG_DIR="${REPO_ROOT}/.cleargate/hook-log"
37
37
  mkdir -p "${LOG_DIR}"
38
38
  HOOK_LOG="${LOG_DIR}/token-ledger.log"
@@ -10,6 +10,17 @@
10
10
  ]
11
11
  }
12
12
  ],
13
+ "PreToolUse": [
14
+ {
15
+ "matcher": "Task",
16
+ "hooks": [
17
+ {
18
+ "type": "command",
19
+ "command": "${CLAUDE_PROJECT_DIR}/.claude/hooks/pending-task-sentinel.sh"
20
+ }
21
+ ]
22
+ }
23
+ ],
13
24
  "PostToolUse": [
14
25
  {
15
26
  "matcher": "Edit|Write",
@@ -1,27 +1,37 @@
1
1
  ---
2
2
  name: flashcard
3
- description: Append-only project lesson log at .cleargate/FLASHCARD.md. Use BEFORE starting non-trivial work to read past gotchas ("check" mode). Use WHEN you hit a surprise, wasted time, or a non-obvious gotcha to record it for future agents ("record: <one-liner>" mode). One-liners only; tag with #schema/#auth/#test-harness/etc. Also triggers on phrases like "turns out", "unexpected", "gotcha", "wasted time on", "starting work on", "before implementing".
3
+ description: Append-only project lesson log at .cleargate/FLASHCARD.md. Use BEFORE starting non-trivial work to read past gotchas ("check" mode). Use WHEN you (a) hit a surprise, (b) found the winning path after a non-trivial task succeeded, or (c) were corrected by the user — record a one-liner for future agents ("record: <text>" mode). One-liners only; tag with #schema/#auth/#test-harness/etc. Also triggers on phrases: "turns out", "unexpected", "gotcha", "wasted time on", "starting work on", "before implementing", "user pushed back", "prefer X over Y", "winning path", "after several attempts", "the recipe that worked".
4
4
  ---
5
5
 
6
6
  # Flashcard — Project Lesson Log
7
7
 
8
8
  Append-only one-liner log of non-obvious gotchas that future agents in this project should know. Lives at `.cleargate/FLASHCARD.md` in the project root. Not a general wiki — only things that surprised us and would surprise someone else.
9
9
 
10
- ## Two modes
10
+ ## Modes
11
11
 
12
12
  ### `check` — read before work
13
- Read `.cleargate/FLASHCARD.md`. Scan for tags relevant to your current task (grep by `#schema`, `#auth`, etc.). If a card applies, follow its guidance. If unsure whether a card applies, err on applying it — reading 20 one-liners is cheap.
13
+ Read `.cleargate/FLASHCARD.md`. Apply the Rule 8 filter: skip cards marked `[S]` (stale) or `[R]` (resolved) unless your current task directly matches a tag in a superseded card. Scan active cards for tags relevant to your task (grep by `#schema`, `#auth`, etc.). If unsure whether a card applies, err on applying it — reading 20 one-liners is cheap.
14
14
 
15
- ### `record: <one-liner>`write after surprise
16
- Append a single line to `.cleargate/FLASHCARD.md`. Format:
15
+ Use `check-all` instead when investigating history or debugging a recurring issue it includes `[S]` and `[R]` cards.
16
+
17
+ ### `record: <text>` — three trigger classes, same format
18
+ Append a single line to `.cleargate/FLASHCARD.md`. Same 120-char cap regardless of trigger:
19
+
20
+ 1. **Surprise** — something bit us. Lead with the surprise, not the context.
21
+ 2. **Recipe** — the winning path after a non-trivial task succeeded (roughly 5+ tool calls, or one clear dead-end recovery). Lead with the *action that worked*, not the failures traversed. Tag `#recipe` alongside the domain tag.
22
+ 3. **Correction** — the user pushed back on an approach. Capture the rule, not the exchange. Prefer the shape "prefer X over Y because Z". Tag `#correction` alongside the domain tag.
23
+
24
+ Format (unchanged):
17
25
 
18
26
  ```
19
27
  YYYY-MM-DD · #tag1 #tag2 · <lesson ≤ 120 chars>
20
28
  ```
21
29
 
22
- Example:
30
+ Examples:
23
31
  ```
24
32
  2026-04-18 · #redis #auth · Invite tokens in Redis-only vanish on eviction — use Postgres invites table as source of truth.
33
+ 2026-04-19 · #recipe #wiki · For wiki drift detection, git SHA beats content hash — drops the metadata-lifecycle dependency.
34
+ 2026-04-19 · #correction #planning · Prefer two L1/L2 stories over one L3 at epic-decomposition (user: splits are free pre-push).
25
35
  ```
26
36
 
27
37
  ### Tag vocabulary (append new tags freely, but prefer these)
@@ -46,14 +56,21 @@ Example:
46
56
  3. **Lead with the surprise, not the context.** Good: "Drizzle 0.45 silently drops `DEFAULT gen_random_uuid()` — use `sql` template." Bad: "When working on schema migrations yesterday we found that sometimes…"
47
57
  4. **Lessons, not events.** "Shipped STORY-004-07 today" is NOT a flashcard. "Postgres 18 needs `pgcrypto` extension for gen_random_uuid — not enabled by default in official docker image" IS.
48
58
  5. **Ordered newest-first after the header** — new entries go at the TOP of the log section, not bottom. Readers scan the top; old stuff drifts down.
49
- 6. **Never delete.** Edit to add reconfirmations or deprecation notes; keep the original text. History is the point.
59
+ 6. **Never delete.** Edit to add reconfirmations, supersede pointers, or status markers (Rule 7); keep the original text. History is the point.
60
+ 7. **Status markers for cleanup.** A card may carry a status marker placed *immediately after the second `·`* and before the lesson body:
61
+ - no marker → active (default; the vast majority of cards).
62
+ - `[S]` → stale. The symbol the card references no longer exists in the repo.
63
+ - `[R] → superseded-by <short-ref>` → resolved or replaced by a later card / shipped fix. `<short-ref>` is a date+tag (e.g. `2026-04-19/#hooks-sentinel`) or a STORY/CR ID.
64
+ Markers are additive — the original lesson text is preserved. The reporter agent flags candidates at sprint end; a human approves the batch before markers are applied (see `.claude/agents/reporter.md` → "Flashcard audit").
65
+ 8. **Check-mode filter.** `check` reads active cards only (no marker). Include `[S]` / `[R]` cards only when: (a) their tags directly match the current task area, or (b) the invocation is `check-all` (explicit history read). This keeps `check` signal-dense without losing the historical record.
50
66
 
51
67
  ## Invocation contract
52
68
 
53
69
  When an agent invokes this skill:
54
70
 
55
- - **`Skill(flashcard, "check")`** — open `.cleargate/FLASHCARD.md`, summarize any cards with tags relevant to the current task context in one line per card. If none apply, respond "no relevant flashcards" and proceed.
56
- - **`Skill(flashcard, "record: <text>")`** — parse the text for date + tags + body. If date missing, insert today's UTC date. If tags missing, refuse with "add at least one tag." Grep for duplicates; if dup, reconfirm the existing line instead of appending. Append to the top of the log section in the file.
71
+ - **`Skill(flashcard, "check")`** — open `.cleargate/FLASHCARD.md`, apply the Rule 8 filter, summarize matching active cards in one line per card. If none apply, respond "no relevant flashcards" and proceed.
72
+ - **`Skill(flashcard, "check-all")`** — same as `check` but includes `[S]` / `[R]` cards. Use when investigating history, debugging a recurring issue, or tracing a supersede chain.
73
+ - **`Skill(flashcard, "record: <text>")`** — parse the text for date + tags + body. If date missing, insert today's UTC date. If tags missing, refuse with "add at least one tag." For recipe-class entries include `#recipe`; for correction-class entries include `#correction`. Grep for duplicates; if dup, reconfirm the existing line instead of appending. Append to the top of the log section in the file.
57
74
 
58
75
  ## File shape
59
76
 
@@ -63,11 +80,13 @@ When an agent invokes this skill:
63
80
  # ClearGate Flashcards
64
81
 
65
82
  One-liner gotcha log. Newest first. Grep by tag (e.g. `grep '#schema'`).
66
- Format: `YYYY-MM-DD · #tags · lesson`
83
+ Active cards have no marker; `[S]` = stale, `[R]` = resolved (see SKILL.md Rule 7).
84
+ Format: `YYYY-MM-DD · #tags · [marker]? lesson`
67
85
 
68
86
  ---
69
87
 
70
- 2026-04-18 · #redis #auth · <newest lesson>
71
- 2026-04-17 · #schema · <older lesson>
88
+ 2026-04-19 · #redis #auth · <newest active lesson>
89
+ 2026-04-17 · #schema · [S] drizzle-kit v0.42 silently drops indexes — fixed in v0.45 upgrade.
90
+ 2026-04-15 · #hooks · [R] → superseded-by 2026-04-19/#hooks-sentinel · SubagentStop fires on orchestrator not subagents.
72
91
  ...
73
92
  ```
@@ -1,6 +1,7 @@
1
1
  # ClearGate Flashcards
2
2
 
3
3
  One-liner gotcha log. Newest first. Grep by tag (e.g. `grep '#schema'`).
4
- Format: `YYYY-MM-DD · #tags · lesson`
4
+ Active cards have no marker; `[S]` = stale, `[R]` = resolved (see `.claude/skills/flashcard/SKILL.md` Rules 7–8).
5
+ Format: `YYYY-MM-DD · #tags · [marker]? lesson`
5
6
 
6
7
  ---
@@ -0,0 +1,37 @@
1
+ # ClearGate per-repo configuration.
2
+ # Copy to .cleargate/config.yml and edit. All keys optional.
3
+
4
+ # wiki:
5
+ # index_token_ceiling: 8000 # chars budget for wiki/index.md (STORY-015-03)
6
+
7
+ # gates:
8
+ # precommit: "<command run before every commit — typecheck + tests>"
9
+ # test: "<command to run the test suite>"
10
+ # typecheck: "<command to run the type checker>"
11
+ # lint: "<command to run the linter>"
12
+
13
+ # Node example:
14
+ # gates:
15
+ # precommit: "npm run typecheck && npm test"
16
+ # test: "npm test"
17
+ # typecheck: "npm run typecheck"
18
+ # lint: "npm run lint"
19
+
20
+ # Go example:
21
+ # gates:
22
+ # precommit: "go vet ./... && go test ./..."
23
+ # test: "go test ./..."
24
+ # typecheck: "go build ./..."
25
+
26
+ # Python example:
27
+ # gates:
28
+ # precommit: "mypy . && pytest"
29
+ # test: "pytest"
30
+ # typecheck: "mypy ."
31
+
32
+ # Rust example:
33
+ # gates:
34
+ # precommit: "cargo check && cargo test"
35
+ # test: "cargo test"
36
+ # typecheck: "cargo check"
37
+ # lint: "cargo clippy"