@bugzy-ai/bugzy 1.18.4 → 1.19.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.
@@ -0,0 +1,53 @@
1
+ #!/usr/bin/env bash
2
+ # PreCompact Hook — Flush insights before context compaction
3
+ # This script runs automatically before Claude Code compacts context.
4
+ # Its stdout is injected into the conversation, instructing Claude to save learnings.
5
+
6
+ set -euo pipefail
7
+
8
+ RUNTIME_DIR=".bugzy/runtime"
9
+ LOGS_DIR="$RUNTIME_DIR/logs"
10
+ TODAY=$(date +%Y-%m-%d)
11
+ LOG_FILE="$LOGS_DIR/$TODAY.md"
12
+
13
+ # Ensure logs directory exists
14
+ mkdir -p "$LOGS_DIR"
15
+
16
+ cat <<'INSTRUCTIONS'
17
+ === PRE-COMPACTION: Save Your Learnings ===
18
+
19
+ Context compaction is about to happen. Before your context is compressed, extract and save any knowledge from this session that matches the categories below.
20
+
21
+ **Write entries to the daily log file** using the Write tool:
22
+ INSTRUCTIONS
23
+
24
+ echo "**Daily log path:** \`$LOG_FILE\`"
25
+
26
+ cat <<'INSTRUCTIONS'
27
+
28
+ **Format each entry as:**
29
+ ```markdown
30
+ ### HH:MM — {source-role-or-task}
31
+ <!-- source: {task-or-subagent} -->
32
+ - Insight or pattern learned
33
+ - Another insight
34
+ ```
35
+
36
+ **Extraction Categories (save only what applies):**
37
+ - **Application patterns** — UI flows, navigation, API response patterns
38
+ - **Test reliability** — Flaky selectors, timing issues, retry patterns
39
+ - **Team preferences** — Communication style, workflow expectations
40
+ - **Technical constraints** — Rate limits, auth lifetimes, deployment gotchas
41
+ - **Environment facts** — URLs, test data patterns, feature flags
42
+
43
+ **Include provenance** on each entry. Only save knowledge that would help in future sessions.
44
+ INSTRUCTIONS
45
+
46
+ # Inject the full maintenance guide for reference
47
+ if [ -f "$RUNTIME_DIR/knowledge-maintenance-guide.md" ]; then
48
+ echo ""
49
+ echo "=== Knowledge Maintenance Guide (Reference) ==="
50
+ cat "$RUNTIME_DIR/knowledge-maintenance-guide.md"
51
+ fi
52
+
53
+ exit 0
@@ -0,0 +1,68 @@
1
+ #!/usr/bin/env bash
2
+ # SessionStart Hook — Load knowledge base and recent daily logs into context
3
+ # This script runs automatically at the start of each Claude Code session.
4
+ # Its stdout is injected into the conversation context.
5
+
6
+ set -euo pipefail
7
+
8
+ RUNTIME_DIR=".bugzy/runtime"
9
+
10
+ # Clean up any stale hook markers from previous sessions
11
+ rm -rf "$RUNTIME_DIR/hooks/.markers" 2>/dev/null || true
12
+
13
+ PROJECT_CONTEXT="$RUNTIME_DIR/project-context.md"
14
+ KB_FILE="$RUNTIME_DIR/knowledge-base.md"
15
+ LOGS_DIR="$RUNTIME_DIR/logs"
16
+
17
+ # --- Memory System Overview ---
18
+ cat <<'OVERVIEW'
19
+ === Memory System ===
20
+
21
+ This project uses a hooks-based memory system with three layers:
22
+
23
+ 1. **Knowledge Base** (`.bugzy/runtime/knowledge-base.md`) — Curated, long-term knowledge. The source of truth.
24
+ 2. **Daily Log** (`.bugzy/runtime/logs/YYYY-MM-DD.md`) — Scratch buffer for the current day's insights.
25
+ 3. **Subagent Memory** (`.bugzy/runtime/memory/{role}.md`) — Role-specific knowledge per subagent.
26
+
27
+ **Lifecycle:** During work, insights accumulate in context. Before context compaction (PreCompact hook), you flush insights to the daily log. At session end (SessionEnd hook), you consolidate the daily log into the knowledge base. Subagents manage their own memory via SubagentStart/SubagentStop hooks.
28
+
29
+ Below is the current project context, knowledge base, and recent daily logs.
30
+ OVERVIEW
31
+ echo ""
32
+
33
+ # --- Load Project Context ---
34
+ if [ -f "$PROJECT_CONTEXT" ]; then
35
+ echo "=== Project Context ==="
36
+ cat "$PROJECT_CONTEXT"
37
+ echo ""
38
+ fi
39
+
40
+ # --- Load Knowledge Base ---
41
+ if [ -f "$KB_FILE" ]; then
42
+ echo "=== Knowledge Base ==="
43
+ cat "$KB_FILE"
44
+ echo ""
45
+ fi
46
+
47
+ # --- Load Recent Daily Logs ---
48
+ if [ -d "$LOGS_DIR" ]; then
49
+ TODAY=$(date +%Y-%m-%d)
50
+ YESTERDAY=$(date -v-1d +%Y-%m-%d 2>/dev/null || date -d "yesterday" +%Y-%m-%d 2>/dev/null || echo "")
51
+
52
+ if [ -f "$LOGS_DIR/$TODAY.md" ]; then
53
+ echo "=== Daily Log: $TODAY ==="
54
+ cat "$LOGS_DIR/$TODAY.md"
55
+ echo ""
56
+ fi
57
+
58
+ if [ -n "$YESTERDAY" ] && [ -f "$LOGS_DIR/$YESTERDAY.md" ]; then
59
+ echo "=== Daily Log: $YESTERDAY ==="
60
+ cat "$LOGS_DIR/$YESTERDAY.md"
61
+ echo ""
62
+ fi
63
+
64
+ # --- Prune logs older than 7 days ---
65
+ find "$LOGS_DIR" -name "*.md" -mtime +7 -delete 2>/dev/null || true
66
+ fi
67
+
68
+ exit 0
@@ -95,3 +95,46 @@ Remove entries when:
95
95
  | "On Tuesday user said X, then on Friday user said Y" | "User's position on X is Y" (keep most current) |
96
96
  | Keeping every detail ever mentioned | Keeping relevant, current details |
97
97
  | "User might like coffee, user mentioned tea once, user drinks water" | "User prefers tea; also drinks coffee occasionally" |
98
+
99
+ ---
100
+
101
+ ## Extraction Schema
102
+
103
+ When deciding what to save, use these structured categories as guidance. Not every session produces entries in every category — only save what genuinely qualifies.
104
+
105
+ ### Application Patterns
106
+ UI flows, navigation structure, page load behaviors, API response patterns, authentication flows, state transitions.
107
+
108
+ ### Test Reliability
109
+ Flaky selectors, timing-sensitive flows, environment-specific behaviors, retry patterns, stable vs unstable locators.
110
+
111
+ ### Team Preferences
112
+ Communication style, channel routing, workflow expectations, review preferences, notification conventions.
113
+
114
+ ### Technical Constraints
115
+ API rate limits, auth token lifetimes, infrastructure boundaries, deployment gotchas, browser compatibility issues.
116
+
117
+ ### Environment Facts
118
+ URLs, credentials structure (not values), test data patterns, feature flags, environment-specific configurations.
119
+
120
+ ---
121
+
122
+ ## Provenance Format
123
+
124
+ Every knowledge base entry must include provenance metadata as an HTML comment immediately after the heading:
125
+
126
+ ```markdown
127
+ ## Entry Title
128
+ <!-- source: {task-or-subagent} | learned: {YYYY-MM-DD} | verified: {YYYY-MM-DD} -->
129
+
130
+ Entry content here...
131
+ ```
132
+
133
+ **Fields:**
134
+ - **source**: Which task or subagent produced this knowledge (e.g., `run-tests`, `test-engineer`, `explore-application`)
135
+ - **learned**: Date the knowledge was first discovered
136
+ - **verified**: Date the knowledge was last confirmed as still accurate
137
+
138
+ **Verification Rule:** If an entry's `verified` date is more than 30 days old and you encounter the same topic, re-verify the information and update the `verified` date. If the fact has changed, update or remove the entry.
139
+
140
+ **Gradual Migration:** Existing entries without provenance remain valid. Add provenance when you next update an entry — no bulk migration needed.
@@ -85,3 +85,38 @@ New information
85
85
  - Working knowledge for your specific tasks
86
86
 
87
87
  **When in doubt**: If multiple sub-agents could use it → Main agent
88
+
89
+ ---
90
+
91
+ ## Provenance Format
92
+
93
+ Every memory entry must include provenance metadata as an HTML comment immediately after the heading:
94
+
95
+ ```markdown
96
+ ## Entry Title
97
+ <!-- source: {your-role} | learned: {YYYY-MM-DD} | verified: {YYYY-MM-DD} -->
98
+
99
+ Entry content here...
100
+ ```
101
+
102
+ **Fields:**
103
+ - **source**: Your subagent role (e.g., `test-engineer`, `browser-automation`)
104
+ - **learned**: Date the knowledge was first discovered
105
+ - **verified**: Date the knowledge was last confirmed as still accurate
106
+
107
+ **Verification Rule:** If an entry's `verified` date is more than 30 days old and you encounter the same topic, re-verify the information and update the `verified` date. If the fact has changed, update or remove the entry.
108
+
109
+ **Gradual Migration:** Existing entries without provenance remain valid. Add provenance when you next update an entry.
110
+
111
+ ---
112
+
113
+ ## Role-Specific Extraction Hints
114
+
115
+ Each role should focus on extracting knowledge within its domain:
116
+
117
+ - **test-engineer**: Selector strategies, page object patterns, framework conventions, test data patterns
118
+ - **test-debugger-fixer**: Failure patterns, root cause categories, fix strategies, flaky test indicators
119
+ - **team-communicator**: Channel configurations, message format preferences, thread conventions, escalation paths
120
+ - **browser-automation**: Timing patterns, navigation quirks, viewport requirements, wait strategies
121
+ - **issue-tracker**: Bug categorization, priority heuristics, label conventions, duplicate detection patterns
122
+ - **documentation-researcher**: Source reliability, content structure, search strategies, documentation gaps
@@ -1,7 +1,28 @@
1
1
  {
2
+ "hooks": {
3
+ "SessionStart": [
4
+ {
5
+ "hooks": [
6
+ {
7
+ "type": "command",
8
+ "command": "bash .bugzy/runtime/hooks/session-start.sh"
9
+ }
10
+ ]
11
+ }
12
+ ],
13
+ "PreCompact": [
14
+ {
15
+ "hooks": [
16
+ {
17
+ "type": "command",
18
+ "command": "bash .bugzy/runtime/hooks/pre-compact.sh"
19
+ }
20
+ ]
21
+ }
22
+ ]
23
+ },
2
24
  "permissions": {
3
25
  "allow": [
4
- "Bash(jq:*)",
5
26
  "mcp__notion__API-post-database-query",
6
27
  "mcp__notion__API-retrieve-a-database",
7
28
  "Bash(mkdir:*)",
@@ -3,6 +3,12 @@
3
3
  ## Framework
4
4
  Playwright with TypeScript
5
5
 
6
+ ## Environment
7
+
8
+ Playwright and Chromium browser binaries are **pre-installed** in the execution environment. npm packages from `package.json` are also pre-installed in the project root.
9
+
10
+ **DO NOT** run `npx playwright install` or `npm install` — all dependencies are already available.
11
+
6
12
  ## Test Execution
7
13
 
8
14
  Run commands from the project root directory.