@agentuity/claude-code 2.0.10 → 3.0.0-alpha.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.
@@ -1,68 +0,0 @@
1
- #!/usr/bin/env bash
2
- # Session start hook: Gather Agentuity context
3
- set -euo pipefail
4
-
5
- # Find agentuity.json by walking up directories
6
- find_agentuity_json() {
7
- local dir="$PWD"
8
- while [ "$dir" != "/" ]; do
9
- if [ -f "$dir/agentuity.json" ]; then
10
- echo "$dir/agentuity.json"
11
- return 0
12
- fi
13
- dir="$(dirname "$dir")"
14
- done
15
- return 1
16
- }
17
-
18
- # Initialize context
19
- CONTEXT="{}"
20
-
21
- # Check CLI availability
22
- if command -v agentuity &>/dev/null; then
23
- CLI_AVAILABLE=true
24
- else
25
- CLI_AVAILABLE=false
26
- fi
27
-
28
- # Read agentuity.json
29
- AGENTUITY_JSON=""
30
- if AGENTUITY_JSON_PATH=$(find_agentuity_json); then
31
- AGENTUITY_JSON=$(cat "$AGENTUITY_JSON_PATH" 2>/dev/null || echo "{}")
32
- fi
33
-
34
- # Extract project info
35
- PROJECT_ID=$(echo "$AGENTUITY_JSON" | grep -o '"projectId"[[:space:]]*:[[:space:]]*"[^"]*"' | head -1 | sed 's/.*"projectId"[[:space:]]*:[[:space:]]*"\([^"]*\)"/\1/' || echo "")
36
- ORG_ID=$(echo "$AGENTUITY_JSON" | grep -o '"orgId"[[:space:]]*:[[:space:]]*"[^"]*"' | head -1 | sed 's/.*"orgId"[[:space:]]*:[[:space:]]*"\([^"]*\)"/\1/' || echo "")
37
-
38
- # If no orgId in agentuity.json, try CLI profile
39
- if [ -z "$ORG_ID" ] && [ -f "$HOME/.config/agentuity/production.yaml" ]; then
40
- ORG_ID=$(grep 'orgId' "$HOME/.config/agentuity/production.yaml" 2>/dev/null | head -1 | sed 's/.*orgId:[[:space:]]*//' | tr -d '"' || echo "")
41
- fi
42
-
43
- # Get user info from CLI
44
- USER_INFO=""
45
- if [ "$CLI_AVAILABLE" = true ]; then
46
- USER_INFO=$(agentuity auth whoami --json 2>/dev/null || echo "")
47
- fi
48
-
49
- # Get git info
50
- GIT_BRANCH=$(git branch --show-current 2>/dev/null || echo "unknown")
51
- GIT_REMOTE=$(git remote get-url origin 2>/dev/null || echo "unknown")
52
-
53
- # Output context
54
- cat <<EOF
55
- {
56
- "agentuity": {
57
- "cliAvailable": $CLI_AVAILABLE,
58
- "projectId": "$PROJECT_ID",
59
- "orgId": "$ORG_ID",
60
- "configPath": "${AGENTUITY_JSON_PATH:-}",
61
- "userInfo": ${USER_INFO:-null}
62
- },
63
- "git": {
64
- "branch": "$GIT_BRANCH",
65
- "remote": "$GIT_REMOTE"
66
- }
67
- }
68
- EOF
@@ -1,133 +0,0 @@
1
- #!/usr/bin/env bash
2
- # Setup script for Cadence mode.
3
- # Creates the .claude/agentuity-cadence.local.md state file and saves initial state to KV.
4
- #
5
- # Usage: setup-cadence.sh [--max-iterations N] [--completion-promise TEXT] PROMPT
6
- #
7
- # The state file is read by cadence-stop.sh (Stop hook) to keep
8
- # the loop running until the completion promise is detected.
9
- # State is also persisted to Agentuity Cloud KV for cross-session recall.
10
-
11
- set -euo pipefail
12
-
13
- MAX_ITERATIONS=50
14
- COMPLETION_PROMISE="DONE"
15
- PROMPT=""
16
-
17
- # Parse arguments
18
- while [[ $# -gt 0 ]]; do
19
- case "$1" in
20
- --max-iterations)
21
- MAX_ITERATIONS="$2"
22
- shift 2
23
- ;;
24
- --completion-promise)
25
- COMPLETION_PROMISE="$2"
26
- shift 2
27
- ;;
28
- -h|--help)
29
- echo "Usage: setup-cadence.sh [OPTIONS] PROMPT"
30
- echo ""
31
- echo "Options:"
32
- echo " --max-iterations N Maximum loop iterations (default: 50)"
33
- echo " --completion-promise TEXT Completion signal text (default: DONE)"
34
- echo " -h, --help Show this help"
35
- exit 0
36
- ;;
37
- *)
38
- # Everything else is the prompt
39
- if [ -z "$PROMPT" ]; then
40
- PROMPT="$1"
41
- else
42
- PROMPT="$PROMPT $1"
43
- fi
44
- shift
45
- ;;
46
- esac
47
- done
48
-
49
- if [ -z "$PROMPT" ]; then
50
- echo "Error: No prompt provided" >&2
51
- echo "Usage: setup-cadence.sh [OPTIONS] PROMPT" >&2
52
- exit 1
53
- fi
54
-
55
- # Validate max-iterations
56
- if ! [[ "$MAX_ITERATIONS" =~ ^[0-9]+$ ]] || [[ "$MAX_ITERATIONS" -lt 1 ]]; then
57
- echo "Error: --max-iterations must be a positive integer" >&2
58
- exit 1
59
- fi
60
-
61
- # Generate a loop ID: lp_{short_name}_{random}
62
- # Take first 3 words of prompt, lowercase, underscored, plus random suffix
63
- SHORT_NAME=$(echo "$PROMPT" | tr '[:upper:]' '[:lower:]' | tr -cs '[:alnum:]' '_' | cut -c1-30 | sed 's/_$//')
64
- RANDOM_SUFFIX=$(head -c 4 /dev/urandom | od -An -tx1 | tr -d ' \n' | cut -c1-6)
65
- LOOP_ID="lp_${SHORT_NAME}_${RANDOM_SUFFIX}"
66
-
67
- # Get git branch
68
- GIT_BRANCH=$(git branch --show-current 2>/dev/null || echo "unknown")
69
-
70
- # Create .claude directory if needed
71
- mkdir -p .claude
72
-
73
- # Check for existing cadence session
74
- if [ -f ".claude/agentuity-cadence.local.md" ]; then
75
- EXISTING_ITER=$(sed -n '/^---$/,/^---$/{ /^iteration:/s/iteration: *//p }' .claude/agentuity-cadence.local.md)
76
- EXISTING_LOOP=$(sed -n '/^---$/,/^---$/{ /^loop_id:/s/loop_id: *//p }' .claude/agentuity-cadence.local.md | tr -d '"')
77
- echo "Warning: Active Cadence loop found (${EXISTING_LOOP:-?} at iteration ${EXISTING_ITER:-?}). Replacing with new loop." >&2
78
- rm -f .claude/agentuity-cadence.local.md
79
- fi
80
-
81
- # Create state file
82
- CREATED_AT=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
83
- cat > .claude/agentuity-cadence.local.md << STATEFILE
84
- ---
85
- active: true
86
- loop_id: "${LOOP_ID}"
87
- iteration: 1
88
- max_iterations: ${MAX_ITERATIONS}
89
- completion_promise: "${COMPLETION_PROMISE}"
90
- branch: "${GIT_BRANCH}"
91
- created_at: ${CREATED_AT}
92
- ---
93
-
94
- ${PROMPT}
95
- STATEFILE
96
-
97
- # Save initial cadence state to KV (if agentuity CLI available)
98
- if command -v agentuity &>/dev/null; then
99
- KV_STATE=$(jq -n \
100
- --arg loopId "$LOOP_ID" \
101
- --arg prompt "$PROMPT" \
102
- --arg branch "$GIT_BRANCH" \
103
- --arg createdAt "$CREATED_AT" \
104
- --argjson iteration 1 \
105
- --argjson maxIterations "$MAX_ITERATIONS" \
106
- --arg completionPromise "$COMPLETION_PROMISE" \
107
- --arg status "active" \
108
- '{
109
- loopId: $loopId,
110
- prompt: $prompt,
111
- branch: $branch,
112
- iteration: $iteration,
113
- maxIterations: $maxIterations,
114
- completionPromise: $completionPromise,
115
- status: $status,
116
- startedAt: $createdAt,
117
- lastActivity: $createdAt,
118
- checkpoints: []
119
- }')
120
- agentuity cloud kv set agentuity-opencode-memory "cadence:${LOOP_ID}" "$KV_STATE" --region use 2>/dev/null || true
121
- fi
122
-
123
- echo "Cadence loop initialized:"
124
- echo " Loop ID: ${LOOP_ID}"
125
- echo " Max iterations: ${MAX_ITERATIONS}"
126
- echo " Completion promise: ${COMPLETION_PROMISE}"
127
- echo " Branch: ${GIT_BRANCH}"
128
- echo " State file: .claude/agentuity-cadence.local.md"
129
- echo " KV key: cadence:${LOOP_ID}"
130
- echo ""
131
- echo "The loop will continue until you output <promise>${COMPLETION_PROMISE}</promise>"
132
- echo "or reach ${MAX_ITERATIONS} iterations."
133
- echo "To cancel: /agentuity-cadence-cancel"
@@ -1,69 +0,0 @@
1
- #!/usr/bin/env bash
2
- # Stop hook: Request memory save before session ends (interactive mode only).
3
- #
4
- # In INTERACTIVE mode: blocks the first stop to request memory save via Memory agent.
5
- # In HEADLESS mode (-p): skips entirely — session-end.sh handles KV save directly.
6
- #
7
- # Exit 0 = let Claude stop normally.
8
- # Exit 2 + JSON with decision:block = prevent stop and inject instructions.
9
-
10
- INPUT=$(cat)
11
-
12
- # Check if agentuity CLI is available — if not, skip memory save
13
- if ! command -v agentuity &>/dev/null; then
14
- exit 0
15
- fi
16
-
17
- # If Cadence mode is active, skip memory save — cadence-stop.sh handles the loop
18
- # and includes Memory checkpoints at each iteration.
19
- if [ -f ".claude/agentuity-cadence.local.md" ]; then
20
- exit 0
21
- fi
22
-
23
- # Detect headless mode: check if CLAUDE_CODE_HEADLESS is set, or if
24
- # the session was started with -p (no TTY on parent's stdin).
25
- # In headless mode, session-end.sh handles memory save directly via KV.
26
- if [ "${CLAUDE_CODE_HEADLESS:-}" = "1" ] || [ "${CLAUDE_NON_INTERACTIVE:-}" = "1" ]; then
27
- exit 0
28
- fi
29
-
30
- # Also detect headless by checking if the parent process has no TTY
31
- if ! kill -0 $PPID 2>/dev/null || [ ! -t 0 ] 2>/dev/null; then
32
- # Can't reliably detect, but hooks don't have a TTY in either mode.
33
- # Use the marker-only approach and keep the block minimal.
34
- :
35
- fi
36
-
37
- # Use a session-specific marker file to track save state.
38
- # PPID is the Claude Code process that spawns hooks — consistent within a session.
39
- MARKER_DIR="/tmp/agentuity-coder-memory"
40
- mkdir -p "$MARKER_DIR" 2>/dev/null
41
- MARKER_FILE="$MARKER_DIR/saved-$PPID"
42
-
43
- # If we've already requested a save this session, let Claude stop
44
- if [ -f "$MARKER_FILE" ]; then
45
- exit 0
46
- fi
47
-
48
- # Mark that we've requested a save
49
- touch "$MARKER_FILE"
50
-
51
- # Clean up old markers (older than 24h)
52
- find "$MARKER_DIR" -name 'saved-*' -mtime +1 -delete 2>/dev/null || true
53
-
54
- # Get git branch for context
55
- GIT_BRANCH=$(git branch --show-current 2>/dev/null || echo "unknown")
56
-
57
- # Block the stop and request agentic memory save via Memory agent.
58
- # The Memory agent has full reasoning capabilities: entity extraction,
59
- # corrections identification, Vector upsert, and structured KV storage.
60
- #
61
- # IMPORTANT: We use the Task tool to delegate to Memory agent (subagent),
62
- # NOT Lead, to avoid complex multi-agent orchestration that can hang.
63
- cat <<EOF
64
- {
65
- "decision": "block",
66
- "reason": "Before ending this session, you MUST save session context to persistent memory. Use the Task tool to delegate to the Memory agent:\n\nTask tool parameters:\n- subagent_type: agentuity-coder:agentuity-coder-memory\n- description: Save session memory\n- prompt: \"Memorialize this session. You are being invoked automatically at session end. Review the conversation above and perform a full session memorialization:\\n\\n1. Create a session summary using the Session Summary Template (PROBLEM, CONTEXT, DECISIONS, CORRECTIONS, SOLUTIONS, PATTERNS, FILES, OPEN QUESTIONS)\\n2. Extract and store any corrections/mistakes as high-priority KV entries (correction:{name})\\n3. Store any key decisions (decision:{name})\\n4. Store any reusable patterns (pattern:{name})\\n5. Upsert the FULL session document to Vector storage for semantic search\\n6. Apply reasoning to extract conclusions (explicit, deductive, inductive, abductive) and update entity representations\\n7. Current branch: ${GIT_BRANCH}\\n\\nDo NOT ask questions. Summarize and store everything you can from the conversation history. Prioritize corrections and decisions.\"\n\nAfter the Memory agent completes, you may stop."
67
- }
68
- EOF
69
- exit 2
@@ -1,128 +0,0 @@
1
- ---
2
- name: agentuity-command-runner
3
- description: When running lint, build, test, typecheck, format, clean, or install commands and need structured, actionable output. Activates when executing development commands and parsing their output into structured error reports with file locations, error classification, and deduplication.
4
- version: 1.0.0
5
- ---
6
-
7
- # Command Runner Reference
8
-
9
- Reference for executing development commands and parsing output into structured, actionable summaries.
10
-
11
- ## Runtime Detection
12
-
13
- Before running ANY command, detect the correct runtime:
14
-
15
- ### Detection Priority
16
-
17
- 1. **Agentuity project** (highest priority):
18
- - If `agentuity.json` or `.agentuity/` exists → **bun**
19
- - Agentuity projects are ALWAYS bun-only
20
-
21
- 2. **JavaScript/TypeScript lockfiles**:
22
- - `bun.lockb` → **bun**
23
- - `package-lock.json` → **npm**
24
- - `pnpm-lock.yaml` → **pnpm**
25
- - `yarn.lock` → **yarn**
26
-
27
- 3. **Other ecosystems**:
28
- - `go.mod` → **go**
29
- - `Cargo.toml` → **cargo** (Rust)
30
- - `pyproject.toml` → **uv** or **poetry**
31
- - `requirements.txt` → **pip**
32
-
33
- ## Command Patterns by Ecosystem
34
-
35
- ### JavaScript/TypeScript (bun/npm/pnpm/yarn)
36
-
37
- | Task | bun | npm | pnpm |
38
- | --------- | ------------------- | ------------------- | -------------------- |
39
- | install | `bun install` | `npm install` | `pnpm install` |
40
- | build | `bun run build` | `npm run build` | `pnpm run build` |
41
- | test | `bun test` | `npm test` | `pnpm test` |
42
- | typecheck | `bun run typecheck` | `npm run typecheck` | `pnpm run typecheck` |
43
- | lint | `bun run lint` | `npm run lint` | `pnpm run lint` |
44
- | format | `bun run format` | `npm run format` | `pnpm run format` |
45
- | clean | `bun run clean` | `npm run clean` | `pnpm run clean` |
46
-
47
- ### Go
48
-
49
- | Task | Command |
50
- | ------ | ------------------- |
51
- | build | `go build ./...` |
52
- | test | `go test ./...` |
53
- | lint | `golangci-lint run` |
54
- | format | `go fmt ./...` |
55
-
56
- ### Rust (cargo)
57
-
58
- | Task | Command |
59
- | ------ | -------------- |
60
- | build | `cargo build` |
61
- | test | `cargo test` |
62
- | lint | `cargo clippy` |
63
- | format | `cargo fmt` |
64
-
65
- ## Output Parsing Intelligence
66
-
67
- ### Error Extraction Rules
68
-
69
- 1. **Deduplicate** — Same error in multiple files? Report once with count
70
- 2. **Prioritize** — Errors before warnings
71
- 3. **Truncate** — Top 10 issues max (note if more exist)
72
- 4. **Extract locations** — file:line format when available
73
- 5. **Classify** — type error, syntax error, lint error, test failure
74
-
75
- ### Error Classification
76
-
77
- | Type | Signal Words |
78
- | ------------ | ----------------------------------------------- |
79
- | Type Error | "Type", "TS", "cannot assign", "not assignable" |
80
- | Syntax Error | "Unexpected", "SyntaxError", "Parse error" |
81
- | Lint Error | "eslint", "biome", "warning", "rule" |
82
- | Test Failure | "FAIL", "AssertionError", "expect", "assert" |
83
- | Build Error | "Build failed", "Cannot find module" |
84
-
85
- ### Location Extraction
86
-
87
- Extract file:line from common formats:
88
-
89
- - TypeScript: `src/foo.ts(10,5): error TS2322`
90
- - ESLint: `src/foo.ts:10:5 error`
91
- - Go: `./pkg/foo.go:10:5:`
92
- - Rust: `--> src/main.rs:10:5`
93
- - Python: `File "src/foo.py", line 10`
94
-
95
- ## Structured Output Format
96
-
97
- ```markdown
98
- ## [Task] Result: [PASSED | FAILED | WARNINGS]
99
-
100
- **Runtime:** [bun | npm | pnpm | go | cargo | uv]
101
- **Command:** `[exact command executed]`
102
- **Duration:** [time in seconds]
103
- **Exit Code:** [0 | non-zero]
104
-
105
- ### Errors ([count])
106
-
107
- | File | Line | Type | Message |
108
- | ------------ | ---- | ---- | ------------------------------------------------ |
109
- | `src/foo.ts` | 45 | Type | Type 'string' is not assignable to type 'number' |
110
-
111
- ### Warnings ([count])
112
-
113
- | File | Line | Message |
114
- | ------------ | ---- | ----------------- |
115
- | `src/baz.ts` | 8 | Unused import 'y' |
116
-
117
- ### Summary
118
-
119
- [One sentence: what happened, what the calling agent should know]
120
- ```
121
-
122
- ## Execution Workflow
123
-
124
- 1. **Detect Runtime** — Check for agentuity.json, then lockfiles
125
- 2. **Discover or Use Explicit Command** — Auto-discover from package.json or use provided command
126
- 3. **Execute Command** — Capture stdout, stderr, exit code, duration
127
- 4. **Parse Output** — Extract and classify errors/warnings with file:line
128
- 5. **Return Structured Result** — Format using the template above