claude-flow-novice 2.14.30 → 2.14.31

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 (32) hide show
  1. package/claude-assets/agents/cfn-dev-team/CLAUDE.md +10 -9
  2. package/claude-assets/agents/cfn-dev-team/architecture/base-template-generator.md +2 -9
  3. package/claude-assets/agents/cfn-dev-team/dev-ops/devops-engineer.md +7 -12
  4. package/claude-assets/agents/cfn-dev-team/dev-ops/docker-specialist.md +10 -5
  5. package/claude-assets/agents/cfn-dev-team/dev-ops/github-commit-agent.md +11 -10
  6. package/claude-assets/agents/cfn-dev-team/dev-ops/monitoring-specialist.md +10 -5
  7. package/claude-assets/agents/cfn-dev-team/developers/api-gateway-specialist.md +2 -5
  8. package/claude-assets/agents/cfn-dev-team/developers/backend-developer.md +11 -6
  9. package/claude-assets/agents/cfn-dev-team/developers/database/database-architect.md +2 -5
  10. package/claude-assets/agents/cfn-dev-team/developers/frontend/mobile-dev.md +2 -19
  11. package/claude-assets/agents/cfn-dev-team/developers/frontend/react-frontend-engineer.md +11 -6
  12. package/claude-assets/agents/cfn-dev-team/developers/frontend/ui-designer.md +9 -23
  13. package/claude-assets/agents/cfn-dev-team/developers/graphql-specialist.md +10 -5
  14. package/claude-assets/agents/cfn-dev-team/developers/rust-developer.md +2 -9
  15. package/claude-assets/agents/cfn-dev-team/documentation/pseudocode.md +2 -9
  16. package/claude-assets/agents/cfn-dev-team/product-owners/accessibility-advocate-persona.md +11 -6
  17. package/claude-assets/agents/cfn-dev-team/product-owners/cto-agent.md +0 -5
  18. package/claude-assets/agents/cfn-dev-team/product-owners/power-user-persona.md +0 -3
  19. package/claude-assets/agents/cfn-dev-team/product-owners/product-owner.md +2 -8
  20. package/claude-assets/agents/cfn-dev-team/utility/analyst.md +0 -7
  21. package/claude-assets/agents/cfn-dev-team/utility/code-booster.md +1 -38
  22. package/claude-assets/agents/cfn-dev-team/utility/memory-leak-specialist.md +10 -5
  23. package/claude-assets/agents/cfn-dev-team/utility/researcher.md +8 -34
  24. package/claude-assets/agents/cfn-dev-team/utility/z-ai-specialist.md +10 -5
  25. package/claude-assets/agents/project-only-agents/npm-package-specialist.md +9 -26
  26. package/claude-assets/skills/agent-lifecycle/SKILL.md +60 -0
  27. package/claude-assets/skills/agent-lifecycle/execute-lifecycle-hook.sh +573 -0
  28. package/claude-assets/skills/agent-lifecycle/simple-audit.sh +31 -0
  29. package/dist/agents/agent-loader.js +165 -146
  30. package/dist/agents/agent-loader.js.map +1 -1
  31. package/package.json +1 -1
  32. package/readme/README.md +71 -14
@@ -15,15 +15,6 @@ validation_hooks:
15
15
  - agent-template-validator
16
16
  - cfn-loop-memory-validator
17
17
  - test-coverage-validator
18
- lifecycle:
19
- pre_task: |
20
- sqlite-cli exec "INSERT INTO agents (id, type, status, spawned_at)
21
- VALUES ('${AGENT_ID}', 'npm-package-specialist', 'active', CURRENT_TIMESTAMP)"
22
- post_task: |
23
- sqlite-cli exec "UPDATE agents
24
- SET status = 'completed', confidence = ${CONFIDENCE_SCORE},
25
- completed_at = CURRENT_TIMESTAMP
26
- WHERE id = '${AGENT_ID}'"
27
18
  acl_level: 1
28
19
  coordination_role: implementer
29
20
  mode_support: [mvp, standard, enterprise]
@@ -311,23 +302,15 @@ npm publish --tag beta
311
302
  - [ ] Documentation accessible
312
303
  - [ ] npm registry page displays correctly
313
304
 
314
- ## SQLite Memory Integration
315
-
316
- ```javascript
317
- // Store package configuration
318
- await sqlite.memoryAdapter.set(
319
- `npm-package/${agentId}/config`,
320
- packageConfig,
321
- { aclLevel: 1, ttl: 2592000 } // 30 days
322
- );
323
-
324
- // Store publish metadata
325
- await sqlite.memoryAdapter.set(
326
- `npm-package/${agentId}/publish/${version}`,
327
- publishMetadata,
328
- { aclLevel: 1, ttl: 31536000 } // 1 year
329
- );
330
- ```
305
+ ## Completion Protocol
306
+
307
+ Complete your work and provide a structured response with:
308
+ - Confidence score (0.0-1.0) based on work quality
309
+ - Summary of analysis/review completed
310
+ - List of findings or deliverables
311
+ - Any recommendations made
312
+
313
+ **Note:** Coordination instructions are provided when spawned via CLI.
331
314
 
332
315
  ## Success Metrics
333
316
 
@@ -0,0 +1,60 @@
1
+ # Agent Lifecycle Management Skill
2
+
3
+ **Purpose:** Enable agents to execute SQLite lifecycle hooks for auditing purposes
4
+
5
+ **Description:** This skill provides agents with the ability to register their lifecycle events (spawn, confidence updates, completion) in a SQLite database for audit trail and cross-session recovery.
6
+
7
+ ## Usage
8
+
9
+ ### Agent Spawn Registration
10
+ ```bash
11
+ # Register agent when starting work
12
+ ./.claude/skills/agent-lifecycle/execute-lifecycle-hook.sh spawn \
13
+ --agent-id "${AGENT_ID}" \
14
+ --agent-type "${AGENT_TYPE}" \
15
+ --acl-level 1 \
16
+ --name "${AGENT_NAME}"
17
+ ```
18
+
19
+ ### Confidence Updates
20
+ ```bash
21
+ # Update confidence during work
22
+ ./.claude/skills/agent-lifecycle/execute-lifecycle-hook.sh update \
23
+ --agent-id "${AGENT_ID}" \
24
+ --confidence 0.85 \
25
+ --reasoning "Implementation complete, all tests passing"
26
+ ```
27
+
28
+ ### Agent Completion
29
+ ```bash
30
+ # Mark agent as completed
31
+ ./.claude/skills/agent-lifecycle/execute-lifecycle-hook.sh complete \
32
+ --agent-id "${AGENT_ID}" \
33
+ --confidence 0.90 \
34
+ --output "Successfully implemented feature with 95% test coverage"
35
+ ```
36
+
37
+ ## Integration in Agent Profiles
38
+
39
+ Add to agent completion protocol:
40
+
41
+ ```markdown
42
+ ## Lifecycle Management
43
+ - Execute spawn registration at start
44
+ - Update confidence during implementation
45
+ - Log completion with confidence score
46
+ - Maintain audit trail in SQLite database
47
+ ```
48
+
49
+ ## Database Schema
50
+
51
+ The SQLite database contains:
52
+ - `agents` table: Agent information and status
53
+ - `lifecycle_events` table: Complete audit trail
54
+
55
+ ## Security
56
+
57
+ - ACL levels enforced (1-6)
58
+ - Input validation for all parameters
59
+ - Sanitized error messages
60
+ - Atomic operations to prevent race conditions
@@ -0,0 +1,573 @@
1
+ #!/bin/bash
2
+
3
+ # Agent Lifecycle Hook Execution Script
4
+ # Provides SQLite-based lifecycle management for agent auditing
5
+ # Usage: ./execute-lifecycle-hook.sh <action> [options]
6
+
7
+ set -euo pipefail
8
+
9
+ # Configuration
10
+ DB_PATH="${AGENT_LIFECYCLE_DB:-./agent-lifecycle.db}"
11
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
12
+
13
+ # Colors for output
14
+ RED='\033[0;31m'
15
+ GREEN='\033[0;32m'
16
+ YELLOW='\033[1;33m'
17
+ BLUE='\033[0;34m'
18
+ NC='\033[0m' # No Color
19
+
20
+ # Logging functions
21
+ log_info() {
22
+ echo -e "${BLUE}[INFO]${NC} $1"
23
+ }
24
+
25
+ log_success() {
26
+ echo -e "${GREEN}[SUCCESS]${NC} $1"
27
+ }
28
+
29
+ log_warning() {
30
+ echo -e "${YELLOW}[WARNING]${NC} $1"
31
+ }
32
+
33
+ log_error() {
34
+ echo -e "${RED}[ERROR]${NC} $1"
35
+ }
36
+
37
+ # Initialize SQLite database
38
+ init_database() {
39
+ if [[ ! -f "$DB_PATH" ]]; then
40
+ log_info "Creating agent lifecycle database: $DB_PATH"
41
+ sqlite3 "$DB_PATH" << 'EOF'
42
+ -- Create agents table
43
+ CREATE TABLE IF NOT EXISTS agents (
44
+ id TEXT PRIMARY KEY,
45
+ name TEXT NOT NULL,
46
+ type TEXT NOT NULL,
47
+ status TEXT NOT NULL DEFAULT 'spawned',
48
+ confidence REAL,
49
+ output TEXT,
50
+ metadata TEXT,
51
+ spawned_at TEXT NOT NULL,
52
+ completed_at TEXT,
53
+ updated_at TEXT NOT NULL
54
+ );
55
+
56
+ -- Create lifecycle_events table
57
+ CREATE TABLE IF NOT EXISTS lifecycle_events (
58
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
59
+ agent_id TEXT NOT NULL,
60
+ event_type TEXT NOT NULL,
61
+ confidence REAL,
62
+ reasoning TEXT,
63
+ phase TEXT,
64
+ iteration INTEGER,
65
+ timestamp TEXT NOT NULL,
66
+ FOREIGN KEY (agent_id) REFERENCES agents(id)
67
+ );
68
+
69
+ -- Create indexes for performance
70
+ CREATE INDEX IF NOT EXISTS idx_agents_status ON agents(status);
71
+ CREATE INDEX IF NOT EXISTS idx_agents_type ON agents(type);
72
+ CREATE INDEX IF NOT EXISTS idx_lifecycle_agent_id ON lifecycle_events(agent_id);
73
+ CREATE INDEX IF NOT EXISTS idx_lifecycle_timestamp ON lifecycle_events(timestamp);
74
+ CREATE INDEX IF NOT EXISTS idx_lifecycle_event_type ON lifecycle_events(event_type);
75
+ EOF
76
+ log_success "Database initialized successfully"
77
+ fi
78
+ }
79
+
80
+ # Validate agent ID format
81
+ validate_agent_id() {
82
+ local agent_id="$1"
83
+ if [[ ! "$agent_id" =~ ^[a-zA-Z0-9_-]+$ ]]; then
84
+ log_error "Invalid agent ID format: $agent_id"
85
+ log_error "Agent ID must contain only alphanumeric characters, hyphens, and underscores"
86
+ exit 1
87
+ fi
88
+
89
+ if [[ ${#agent_id} -lt 3 || ${#agent_id} -gt 64 ]]; then
90
+ log_error "Agent ID must be between 3 and 64 characters: $agent_id"
91
+ exit 1
92
+ fi
93
+ }
94
+
95
+ # Validate confidence score
96
+ validate_confidence() {
97
+ local confidence="$1"
98
+ if [[ ! "$confidence" =~ ^0\.[0-9]+$|^1\.0$|^0$|^1$ ]]; then
99
+ log_error "Invalid confidence score: $confidence"
100
+ log_error "Confidence must be between 0.0 and 1.0"
101
+ exit 1
102
+ fi
103
+ }
104
+
105
+ # Spawn agent registration
106
+ spawn_agent() {
107
+ local agent_id="$1"
108
+ local agent_type="$2"
109
+ local acl_level="${3:-1}"
110
+ local agent_name="${4:-$agent_id}"
111
+
112
+ validate_agent_id "$agent_id"
113
+
114
+ if [[ ! "$acl_level" =~ ^[1-6]$ ]]; then
115
+ log_error "Invalid ACL level: $acl_level (must be 1-6)"
116
+ exit 1
117
+ fi
118
+
119
+ log_info "Registering agent spawn: $agent_id (type: $agent_type, ACL: $acl_level)"
120
+
121
+ sqlite3 "$DB_PATH" << EOF
122
+ INSERT OR REPLACE INTO agents (
123
+ id, name, type, status, metadata, spawned_at, updated_at
124
+ ) VALUES (
125
+ '$agent_id',
126
+ '$agent_name',
127
+ '$agent_type',
128
+ 'spawned',
129
+ '{"aclLevel": $acl_level, "spawnedAt": "$(date -u +%Y-%m-%dT%H:%M:%SZ)"}',
130
+ datetime('now'),
131
+ datetime('now')
132
+ );
133
+ EOF
134
+
135
+ # Log spawn event
136
+ sqlite3 "$DB_PATH" << EOF
137
+ INSERT INTO lifecycle_events (
138
+ agent_id, event_type, reasoning, timestamp
139
+ ) VALUES (
140
+ '$agent_id',
141
+ 'spawn',
142
+ 'Agent spawned via lifecycle hook',
143
+ datetime('now')
144
+ );
145
+ EOF
146
+
147
+ log_success "Agent $agent_id registered successfully"
148
+ }
149
+
150
+ # Update agent confidence
151
+ update_confidence() {
152
+ local agent_id="$1"
153
+ local confidence="$2"
154
+ local reasoning="${3:-No reasoning provided}"
155
+ local phase="${4:-}"
156
+ local iteration="${5:-}"
157
+
158
+ validate_agent_id "$agent_id"
159
+ validate_confidence "$confidence"
160
+
161
+ log_info "Updating confidence for agent $agent_id: $confidence"
162
+
163
+ # Update agent confidence
164
+ sqlite3 "$DB_PATH" << EOF
165
+ UPDATE agents
166
+ SET confidence = $confidence, updated_at = datetime('now')
167
+ WHERE id = '$agent_id';
168
+ EOF
169
+
170
+ # Log confidence update event
171
+ sqlite3 "$DB_PATH" << EOF
172
+ INSERT INTO lifecycle_events (
173
+ agent_id, event_type, confidence, reasoning, phase, iteration, timestamp
174
+ ) VALUES (
175
+ '$agent_id',
176
+ 'confidence_update',
177
+ $confidence,
178
+ '$reasoning',
179
+ ${phase:+"'${phase}'":NULL},
180
+ ${iteration:+$iteration},
181
+ datetime('now')
182
+ );
183
+ EOF
184
+
185
+ log_success "Confidence updated for agent $agent_id"
186
+ }
187
+
188
+ # Complete agent
189
+ complete_agent() {
190
+ local agent_id="$1"
191
+ local confidence="$2"
192
+ local output="${3:-}"
193
+ local phase="${4:-}"
194
+ local iteration="${5:-}"
195
+
196
+ validate_agent_id "$agent_id"
197
+ validate_confidence "$confidence"
198
+
199
+ log_info "Completing agent $agent_id with confidence: $confidence"
200
+
201
+ # Mark agent as completed
202
+ sqlite3 "$DB_PATH" << EOF
203
+ UPDATE agents
204
+ SET status = 'completed',
205
+ confidence = $confidence,
206
+ output = ${output:+"'${output}'":NULL},
207
+ completed_at = datetime('now'),
208
+ updated_at = datetime('now')
209
+ WHERE id = '$agent_id';
210
+ EOF
211
+
212
+ # Log completion event
213
+ sqlite3 "$DB_PATH" << EOF
214
+ INSERT INTO lifecycle_events (
215
+ agent_id, event_type, confidence, reasoning, phase, iteration, timestamp
216
+ ) VALUES (
217
+ '$agent_id',
218
+ 'complete',
219
+ $confidence,
220
+ ${output:="'${output}'":'Agent completed'},
221
+ ${phase:+"'${phase}'":NULL},
222
+ ${iteration:+$iteration},
223
+ datetime('now')
224
+ );
225
+ EOF
226
+
227
+ # Check CFN Loop gate
228
+ local gate_status="FAIL"
229
+ if (( $(echo "$confidence >= 0.75" | bc -l) )); then
230
+ gate_status="PASS"
231
+ fi
232
+
233
+ log_success "Agent $agent_id completed (CFN Loop 3 Gate: $gate_status)"
234
+ }
235
+
236
+ # Terminate agent
237
+ terminate_agent() {
238
+ local agent_id="$1"
239
+ local reason="${2:-Normal termination}"
240
+
241
+ validate_agent_id "$agent_id"
242
+
243
+ log_info "Terminating agent $agent_id: $reason"
244
+
245
+ # Mark agent as terminated
246
+ sqlite3 "$DB_PATH" << EOF
247
+ UPDATE agents
248
+ SET status = 'terminated', updated_at = datetime('now')
249
+ WHERE id = '$agent_id';
250
+ EOF
251
+
252
+ # Log termination event
253
+ sqlite3 "$DB_PATH" << EOF
254
+ INSERT INTO lifecycle_events (
255
+ agent_id, event_type, reasoning, timestamp
256
+ ) VALUES (
257
+ '$agent_id',
258
+ 'terminate',
259
+ '$reason',
260
+ datetime('now')
261
+ );
262
+ EOF
263
+
264
+ log_success "Agent $agent_id terminated"
265
+ }
266
+
267
+ # Query agent status
268
+ query_status() {
269
+ local agent_id="$1"
270
+ local limit="${2:-10}"
271
+
272
+ validate_agent_id "$agent_id"
273
+
274
+ log_info "Querying status for agent $agent_id"
275
+
276
+ echo ""
277
+ echo "=== Agent Status ==="
278
+ sqlite3 "$DB_PATH" << EOF
279
+ SELECT
280
+ id,
281
+ name,
282
+ type,
283
+ status,
284
+ confidence,
285
+ spawned_at,
286
+ completed_at,
287
+ updated_at
288
+ FROM agents
289
+ WHERE id = '$agent_id';
290
+ EOF
291
+
292
+ echo ""
293
+ echo "=== Recent Lifecycle Events ==="
294
+ sqlite3 "$DB_PATH" << EOF
295
+ SELECT
296
+ timestamp,
297
+ event_type,
298
+ confidence,
299
+ reasoning
300
+ FROM lifecycle_events
301
+ WHERE agent_id = '$agent_id'
302
+ ORDER BY timestamp DESC
303
+ LIMIT $limit;
304
+ EOF
305
+ }
306
+
307
+ # Show usage
308
+ show_usage() {
309
+ echo "Agent Lifecycle Hook Execution Script"
310
+ echo ""
311
+ echo "Usage: $0 <action> [options]"
312
+ echo ""
313
+ echo "Actions:"
314
+ echo " spawn --agent-id <id> --agent-type <type> [--acl-level <level>] [--name <name>]"
315
+ echo " update --agent-id <id> --confidence <score> --reasoning <text> [--phase <phase>] [--iteration <n>]"
316
+ echo " complete --agent-id <id> --confidence <score> [--output <text>] [--phase <phase>] [--iteration <n>]"
317
+ echo " terminate --agent-id <id> [--reason <text>]"
318
+ echo " status --agent-id <id> [--limit <n>]"
319
+ echo ""
320
+ echo "Environment Variables:"
321
+ echo " AGENT_LIFECYCLE_DB Path to SQLite database (default: ./agent-lifecycle.db)"
322
+ echo ""
323
+ echo "Examples:"
324
+ echo " $0 spawn --agent-id docker-1 --agent-type docker-specialist --acl-level 1"
325
+ echo " $0 update --agent-id docker-1 --confidence 0.85 --reasoning 'Implementation complete'"
326
+ echo " $0 complete --agent-id docker-1 --confidence 0.90 --output 'Docker setup complete'"
327
+ echo " $0 status --agent-id docker-1"
328
+ }
329
+
330
+ # Parse command line arguments
331
+ parse_args() {
332
+ local action="$1"
333
+ shift
334
+
335
+ case "$action" in
336
+ "spawn")
337
+ local agent_id=""
338
+ local agent_type=""
339
+ local acl_level="1"
340
+ local agent_name=""
341
+
342
+ while [[ $# -gt 0 ]]; do
343
+ case "$1" in
344
+ --agent-id)
345
+ agent_id="$2"
346
+ shift 2
347
+ ;;
348
+ --agent-type)
349
+ agent_type="$2"
350
+ shift 2
351
+ ;;
352
+ --acl-level)
353
+ acl_level="$2"
354
+ shift 2
355
+ ;;
356
+ --name)
357
+ agent_name="$2"
358
+ shift 2
359
+ ;;
360
+ *)
361
+ log_error "Unknown option: $1"
362
+ show_usage
363
+ exit 1
364
+ ;;
365
+ esac
366
+ done
367
+
368
+ if [[ -z "$agent_id" || -z "$agent_type" ]]; then
369
+ log_error "Missing required arguments for spawn"
370
+ show_usage
371
+ exit 1
372
+ fi
373
+
374
+ init_database
375
+ spawn_agent "$agent_id" "$agent_type" "$acl_level" "$agent_name"
376
+ ;;
377
+
378
+ "update")
379
+ local agent_id=""
380
+ local confidence=""
381
+ local reasoning=""
382
+ local phase=""
383
+ local iteration=""
384
+
385
+ while [[ $# -gt 0 ]]; do
386
+ case "$1" in
387
+ --agent-id)
388
+ agent_id="$2"
389
+ shift 2
390
+ ;;
391
+ --confidence)
392
+ confidence="$2"
393
+ shift 2
394
+ ;;
395
+ --reasoning)
396
+ reasoning="$2"
397
+ shift 2
398
+ ;;
399
+ --phase)
400
+ phase="$2"
401
+ shift 2
402
+ ;;
403
+ --iteration)
404
+ iteration="$2"
405
+ shift 2
406
+ ;;
407
+ *)
408
+ log_error "Unknown option: $1"
409
+ show_usage
410
+ exit 1
411
+ ;;
412
+ esac
413
+ done
414
+
415
+ if [[ -z "$agent_id" || -z "$confidence" ]]; then
416
+ log_error "Missing required arguments for update"
417
+ show_usage
418
+ exit 1
419
+ fi
420
+
421
+ init_database
422
+ update_confidence "$agent_id" "$confidence" "$reasoning" "$phase" "$iteration"
423
+ ;;
424
+
425
+ "complete")
426
+ local agent_id=""
427
+ local confidence=""
428
+ local output=""
429
+ local phase=""
430
+ local iteration=""
431
+
432
+ while [[ $# -gt 0 ]]; do
433
+ case "$1" in
434
+ --agent-id)
435
+ agent_id="$2"
436
+ shift 2
437
+ ;;
438
+ --confidence)
439
+ confidence="$2"
440
+ shift 2
441
+ ;;
442
+ --output)
443
+ output="$2"
444
+ shift 2
445
+ ;;
446
+ --phase)
447
+ phase="$2"
448
+ shift 2
449
+ ;;
450
+ --iteration)
451
+ iteration="$2"
452
+ shift 2
453
+ ;;
454
+ *)
455
+ log_error "Unknown option: $1"
456
+ show_usage
457
+ exit 1
458
+ ;;
459
+ esac
460
+ done
461
+
462
+ if [[ -z "$agent_id" || -z "$confidence" ]]; then
463
+ log_error "Missing required arguments for complete"
464
+ show_usage
465
+ exit 1
466
+ fi
467
+
468
+ init_database
469
+ complete_agent "$agent_id" "$confidence" "$output" "$phase" "$iteration"
470
+ ;;
471
+
472
+ "terminate")
473
+ local agent_id=""
474
+ local reason=""
475
+
476
+ while [[ $# -gt 0 ]]; do
477
+ case "$1" in
478
+ --agent-id)
479
+ agent_id="$2"
480
+ shift 2
481
+ ;;
482
+ --reason)
483
+ reason="$2"
484
+ shift 2
485
+ ;;
486
+ *)
487
+ log_error "Unknown option: $1"
488
+ show_usage
489
+ exit 1
490
+ ;;
491
+ esac
492
+ done
493
+
494
+ if [[ -z "$agent_id" ]]; then
495
+ log_error "Missing required arguments for terminate"
496
+ show_usage
497
+ exit 1
498
+ fi
499
+
500
+ init_database
501
+ terminate_agent "$agent_id" "$reason"
502
+ ;;
503
+
504
+ "status")
505
+ local agent_id=""
506
+ local limit="10"
507
+
508
+ while [[ $# -gt 0 ]]; do
509
+ case "$1" in
510
+ --agent-id)
511
+ agent_id="$2"
512
+ shift 2
513
+ ;;
514
+ --limit)
515
+ limit="$2"
516
+ shift 2
517
+ ;;
518
+ *)
519
+ log_error "Unknown option: $1"
520
+ show_usage
521
+ exit 1
522
+ ;;
523
+ esac
524
+ done
525
+
526
+ if [[ -z "$agent_id" ]]; then
527
+ log_error "Missing required arguments for status"
528
+ show_usage
529
+ exit 1
530
+ fi
531
+
532
+ init_database
533
+ query_status "$agent_id" "$limit"
534
+ ;;
535
+
536
+ "help"|"--help"|"-h")
537
+ show_usage
538
+ ;;
539
+
540
+ *)
541
+ log_error "Unknown action: $action"
542
+ show_usage
543
+ exit 1
544
+ ;;
545
+ esac
546
+ }
547
+
548
+ # Check for required dependencies
549
+ check_dependencies() {
550
+ if ! command -v sqlite3 &> /dev/null; then
551
+ log_error "sqlite3 is required but not installed"
552
+ exit 1
553
+ fi
554
+
555
+ if ! command -v bc &> /dev/null; then
556
+ log_warning "bc is recommended for confidence calculations"
557
+ fi
558
+ }
559
+
560
+ # Main execution
561
+ main() {
562
+ check_dependencies
563
+
564
+ if [[ $# -eq 0 ]]; then
565
+ show_usage
566
+ exit 1
567
+ fi
568
+
569
+ parse_args "$@"
570
+ }
571
+
572
+ # Execute main function
573
+ main "$@"
@@ -0,0 +1,31 @@
1
+ #!/bin/bash
2
+
3
+ # Simple Agent Audit Trail Script
4
+ # Usage: ./simple-audit.sh <agent_id> <agent_type> <confidence> <status>
5
+
6
+ AGENT_ID="$1"
7
+ AGENT_TYPE="$2"
8
+ CONFIDENCE="${3:-0.0}"
9
+ STATUS="${4:-spawned}"
10
+
11
+ DB_PATH="./claude-assets/skills/cfn-redis-coordination/data/cfn-loop.db"
12
+
13
+ if [[ -z "$AGENT_ID" || -z "$AGENT_TYPE" ]]; then
14
+ echo "Usage: $0 <agent_id> <agent_type> [confidence] [status]"
15
+ exit 1
16
+ fi
17
+
18
+ # Create agents table if not exists
19
+ sqlite3 "$DB_PATH" "CREATE TABLE IF NOT EXISTS agents (id TEXT PRIMARY KEY, type TEXT, status TEXT, confidence REAL, spawned_at TEXT, completed_at TEXT, metadata TEXT);" 2>/dev/null
20
+
21
+ # Record agent activity
22
+ case "$STATUS" in
23
+ "spawned")
24
+ sqlite3 "$DB_PATH" "INSERT OR REPLACE INTO agents (id, type, status, spawned_at, metadata) VALUES ('$AGENT_ID', '$AGENT_TYPE', 'spawned', datetime('now'), '{\"source\": \"task_mode\"}');"
25
+ ;;
26
+ "completed")
27
+ sqlite3 "$DB_PATH" "UPDATE agents SET status = 'completed', confidence = $CONFIDENCE, completed_at = datetime('now') WHERE id = '$AGENT_ID';"
28
+ ;;
29
+ esac
30
+
31
+ echo "✅ Agent $AGENT_ID ($AGENT_TYPE) audit recorded: $STATUS"