Skip to content

Commit ed90396

Browse files
jwaldripclaude
andcommitted
feat(plugin): add HAIKU workspace integration and enhanced reflection
- Add plugin/lib/haiku.sh for opt-in org memory integration - Inject organizational memory into session and subagent context - Enhance /reflect with session transcript analysis and settings recommendations - Remove haiku_profile metadata from plugin.json - Clean up leftover haiku-website Mermaid component Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 71b32a6 commit ed90396

File tree

6 files changed

+407
-55
lines changed

6 files changed

+407
-55
lines changed

haiku-website/app/components/Mermaid.tsx

Lines changed: 0 additions & 35 deletions
This file was deleted.

plugin/.claude-plugin/plugin.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
"homepage": "https://ai-dlc.dev",
1010
"repository": "https://github.com/thebushidocollective/ai-dlc",
1111
"license": "Apache-2.0",
12-
"haiku_profile": "software",
1312
"keywords": [
1413
"ai-dlc",
1514
"methodology",

plugin/hooks/inject-context.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,13 @@ if [ -f "$CONFIG_LIB" ]; then
4242
source "$CONFIG_LIB"
4343
fi
4444

45+
# Source HAIKU workspace integration (opt-in org memory)
46+
HAIKU_LIB="${CLAUDE_PLUGIN_ROOT}/lib/haiku.sh"
47+
if [ -f "$HAIKU_LIB" ]; then
48+
# shellcheck source=/dev/null
49+
source "$HAIKU_LIB"
50+
fi
51+
4552
# Detect project maturity (greenfield / early / established)
4653
PROJECT_MATURITY=""
4754
if type detect_project_maturity &>/dev/null; then
@@ -609,6 +616,19 @@ else
609616
echo "\`\`\`"
610617
fi
611618

619+
# Inject HAIKU organizational memory (if workspace configured)
620+
if type haiku_is_configured &>/dev/null && haiku_is_configured; then
621+
ORG_MEMORY=$(haiku_memory_context 100)
622+
if [ -n "$ORG_MEMORY" ]; then
623+
echo "### Organizational Memory (HAIKU)"
624+
echo ""
625+
echo "The following learnings are from your organization's HAIKU workspace:"
626+
echo ""
627+
echo "$ORG_MEMORY"
628+
echo ""
629+
fi
630+
fi
631+
612632
# ============================================================================
613633
# SHARED ITERATION MANAGEMENT INSTRUCTIONS
614634
# These apply to ALL hats and are not customizable

plugin/hooks/subagent-context.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,13 @@ if [ -f "${INTENT_DIR}/discovery.md" ]; then
131131
fi
132132
fi
133133

134+
# Source HAIKU workspace integration (opt-in org memory)
135+
HAIKU_LIB="${CLAUDE_PLUGIN_ROOT}/lib/haiku.sh"
136+
if [ -f "$HAIKU_LIB" ]; then
137+
# shellcheck source=/dev/null
138+
source "$HAIKU_LIB"
139+
fi
140+
134141
# Source DAG library if available
135142
DAG_LIB="${CLAUDE_PLUGIN_ROOT}/lib/dag.sh"
136143
if [ -f "$DAG_LIB" ]; then
@@ -207,6 +214,17 @@ if [ -z "${CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS:-}" ]; then
207214
fi
208215
fi
209216

217+
# Inject HAIKU organizational memory (if workspace configured)
218+
if type haiku_is_configured &>/dev/null && haiku_is_configured; then
219+
ORG_MEMORY=$(haiku_memory_context 60)
220+
if [ -n "$ORG_MEMORY" ]; then
221+
echo "### Organizational Memory (HAIKU)"
222+
echo ""
223+
echo "$ORG_MEMORY"
224+
echo ""
225+
fi
226+
fi
227+
210228
# AI-DLC Workflow Rules (mandatory for all subagents)
211229
echo "---"
212230
echo ""

plugin/lib/haiku.sh

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
#!/bin/bash
2+
# haiku.sh - HAIKU Workspace Integration for AI-DLC
3+
#
4+
# Detects and reads from an organization's HAIKU workspace.
5+
# This is opt-in: only activates if .haiku.yml exists in the project
6+
# or HAIKU_WORKSPACE is set.
7+
#
8+
# Usage:
9+
# source haiku.sh
10+
# ws=$(haiku_resolve_workspace)
11+
# context=$(haiku_memory_context 100)
12+
# haiku_memory_write "learnings" "$CONTENT" "append"
13+
14+
# Resolve the HAIKU workspace path (if configured)
15+
# Returns empty string if not configured.
16+
# Usage: haiku_resolve_workspace
17+
haiku_resolve_workspace() {
18+
# 1. Environment variable (highest priority)
19+
if [ -n "${HAIKU_WORKSPACE:-}" ]; then
20+
echo "$HAIKU_WORKSPACE"
21+
return
22+
fi
23+
24+
# 2. .haiku.yml in project root (walk up from cwd)
25+
local current
26+
current=$(pwd)
27+
while [ "$current" != "/" ]; do
28+
if [ -f "$current/.haiku.yml" ]; then
29+
local configured
30+
configured=$(_yaml_get_simple "workspace" "" < "$current/.haiku.yml" 2>/dev/null)
31+
if [ -n "$configured" ]; then
32+
# Expand ~ to home directory
33+
configured="${configured/#\~/$HOME}"
34+
echo "$configured"
35+
return
36+
fi
37+
fi
38+
current=$(dirname "$current")
39+
done
40+
41+
# Not configured
42+
echo ""
43+
}
44+
45+
# Read organizational memory from the HAIKU workspace.
46+
# Returns formatted markdown context block.
47+
# Usage: haiku_memory_context [max_lines]
48+
haiku_memory_context() {
49+
local max_lines="${1:-100}"
50+
local workspace
51+
workspace=$(haiku_resolve_workspace)
52+
[ -z "$workspace" ] && return
53+
54+
local memory_dir="$workspace/memory"
55+
[ -d "$memory_dir" ] || return
56+
57+
local output="" has_content=false
58+
59+
# Read top-level memory files
60+
for f in "$memory_dir"/*.md; do
61+
[ -f "$f" ] || continue
62+
local name content
63+
name=$(basename "$f" .md)
64+
content=$(cat "$f")
65+
[ -z "$content" ] && continue
66+
has_content=true
67+
output="${output}#### ${name}
68+
69+
${content}
70+
71+
"
72+
done
73+
74+
# Read subdirectory memory files (e.g., domain/)
75+
for subdir in "$memory_dir"/*/; do
76+
[ -d "$subdir" ] || continue
77+
local subdir_name
78+
subdir_name=$(basename "$subdir")
79+
for f in "$subdir"/*.md; do
80+
[ -f "$f" ] || continue
81+
local name content
82+
name=$(basename "$f" .md)
83+
content=$(cat "$f")
84+
[ -z "$content" ] && continue
85+
has_content=true
86+
output="${output}#### ${subdir_name}/${name}
87+
88+
${content}
89+
90+
"
91+
done
92+
done
93+
94+
if [ "$has_content" = "true" ]; then
95+
echo "$output" | head -n "$max_lines"
96+
fi
97+
}
98+
99+
# Write to organizational memory in the HAIKU workspace.
100+
# Usage: haiku_memory_write <name> <content> [mode]
101+
# mode: "overwrite" (default) or "append"
102+
haiku_memory_write() {
103+
local name="$1"
104+
local content="$2"
105+
local mode="${3:-overwrite}"
106+
local workspace
107+
workspace=$(haiku_resolve_workspace)
108+
[ -z "$workspace" ] && return 1
109+
110+
local dir="$workspace/memory"
111+
mkdir -p "$dir"
112+
local file="$dir/${name}.md"
113+
114+
case "$mode" in
115+
append)
116+
printf '\n%s' "$content" >> "$file"
117+
;;
118+
*)
119+
printf '%s' "$content" > "$file"
120+
;;
121+
esac
122+
}
123+
124+
# Check if a HAIKU workspace is configured.
125+
# Usage: haiku_is_configured && echo "yes"
126+
haiku_is_configured() {
127+
local ws
128+
ws=$(haiku_resolve_workspace)
129+
[ -n "$ws" ]
130+
}

0 commit comments

Comments
 (0)