@simplium/hive 4.0.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 (43) hide show
  1. package/CHANGELOG.md +225 -0
  2. package/LICENSE +190 -0
  3. package/README.md +148 -0
  4. package/bin/hive-init.mjs +82 -0
  5. package/dist/claude/agents/ai-ml-engineer.md +3252 -0
  6. package/dist/claude/agents/api-designer.md +2425 -0
  7. package/dist/claude/agents/architecture-planner.md +3275 -0
  8. package/dist/claude/agents/backend-developer.md +1498 -0
  9. package/dist/claude/agents/billing-payments.md +2057 -0
  10. package/dist/claude/agents/competitive-intelligence.md +2695 -0
  11. package/dist/claude/agents/cost-optimization.md +1340 -0
  12. package/dist/claude/agents/customer-success.md +3382 -0
  13. package/dist/claude/agents/data-analyst.md +1764 -0
  14. package/dist/claude/agents/database-engineer.md +1758 -0
  15. package/dist/claude/agents/frontend-developer.md +3427 -0
  16. package/dist/claude/agents/incident-response.md +1777 -0
  17. package/dist/claude/agents/legal-compliance.md +2974 -0
  18. package/dist/claude/agents/orchestrator.md +1839 -0
  19. package/dist/claude/agents/product-manager.md +1247 -0
  20. package/dist/claude/agents/security-auditor.md +333 -0
  21. package/dist/claude/agents/test-engineer.md +1607 -0
  22. package/dist/claude/agents/ux-research.md +2563 -0
  23. package/dist/claude/hooks/hive-log.mjs +108 -0
  24. package/dist/claude/skills/accessibility.md +2973 -0
  25. package/dist/claude/skills/analytics-implementation.md +2810 -0
  26. package/dist/claude/skills/brand-design-system.md +1791 -0
  27. package/dist/claude/skills/cloud-infrastructure.md +1743 -0
  28. package/dist/claude/skills/devops-engineer.md +956 -0
  29. package/dist/claude/skills/documentation-writer.md +3243 -0
  30. package/dist/claude/skills/email-deliverability.md +2875 -0
  31. package/dist/claude/skills/growth-analytics.md +3187 -0
  32. package/dist/claude/skills/landing-page-cro.md +1844 -0
  33. package/dist/claude/skills/marketing-communications.md +2552 -0
  34. package/dist/claude/skills/mobile-development.md +1947 -0
  35. package/dist/claude/skills/observability.md +1550 -0
  36. package/dist/claude/skills/release-manager.md +1467 -0
  37. package/dist/claude/skills/search.md +1961 -0
  38. package/dist/claude/skills/seo-aeo-geo.md +878 -0
  39. package/dist/claude/skills/translator-i18n.md +1630 -0
  40. package/dist/claude/skills/voice-ai.md +554 -0
  41. package/dist/claude/skills/web-performance.md +1088 -0
  42. package/hooks/hive-log.mjs +108 -0
  43. package/package.json +77 -0
@@ -0,0 +1,108 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * HIVE traceability hook (Claude Code PostToolUse, matcher: Task).
4
+ *
5
+ * When a HIVE agent is invoked as a subagent via the Task tool, this hook
6
+ * automatically appends:
7
+ * - a row to HIVE-LOG.md (ISO 42001 A.9 — human-readable audit trail)
8
+ * - a line to .claude/hive-events.jsonl (machine-readable event stream
9
+ * for external observability collectors, e.g. Argos)
10
+ *
11
+ * Replaces the honor-system footer: logging no longer depends on the agent
12
+ * remembering to run log-session. Manual log-session remains as fallback
13
+ * for skills and out-of-band work.
14
+ *
15
+ * Design constraints:
16
+ * - Zero dependencies (plain Node ≥18) — consumer projects need nothing installed.
17
+ * - Never blocks: always exits 0, even on malformed input.
18
+ * - Only logs agents that are HIVE adapters (checks the version stamp in
19
+ * .claude/agents/<name>.md) — other subagents are ignored.
20
+ */
21
+
22
+ import { readFileSync, writeFileSync, appendFileSync, existsSync, mkdirSync } from "node:fs";
23
+ import { join, dirname } from "node:path";
24
+
25
+ const LOG_HEADER = `# HIVE Session Log
26
+
27
+ AI agent invocation log for traceability (ISO 42001 A.9 — logging of AI decision-making events).
28
+
29
+ Rows are appended automatically by the HIVE hook on Task-tool invocations.
30
+ Manual fallback: \`npm run log-session -- --agent <name> --task "..." --outcome COMPLETED|PARTIAL|FAILED [--tokens N]\`
31
+
32
+ | Date | Agent | Task | Outcome | Tokens |
33
+ |------|-------|------|---------|--------|
34
+ `;
35
+
36
+ function sanitizeCell(text, maxLen = 120) {
37
+ return String(text ?? "")
38
+ .replace(/\s+/g, " ")
39
+ .replace(/\|/g, "\\|")
40
+ .trim()
41
+ .slice(0, maxLen);
42
+ }
43
+
44
+ function main() {
45
+ let input;
46
+ try {
47
+ input = JSON.parse(readFileSync(0, "utf-8"));
48
+ } catch {
49
+ return; // malformed stdin — never block
50
+ }
51
+
52
+ if (input.hook_event_name !== "PostToolUse" || input.tool_name !== "Task") return;
53
+
54
+ const agent = input.tool_input?.subagent_type;
55
+ if (!agent || !/^[a-z][a-z0-9-]*$/.test(agent)) return;
56
+
57
+ const projectDir = input.cwd || process.cwd();
58
+
59
+ // Only log HIVE agents: the adapter file must exist and carry the HIVE stamp
60
+ const adapterPath = join(projectDir, ".claude", "agents", `${agent}.md`);
61
+ if (!existsSync(adapterPath)) return;
62
+ const adapterHead = readFileSync(adapterPath, "utf-8").slice(0, 2000);
63
+ if (!adapterHead.includes("HIVE Framework v")) return;
64
+
65
+ const task = sanitizeCell(input.tool_input?.description || input.tool_input?.prompt || "—");
66
+ const date = new Date().toISOString().split("T")[0];
67
+
68
+ // Token count: only if the host provides it in the tool response; never invented
69
+ const usage = input.tool_response?.usage ?? input.tool_response?.totalTokens ?? undefined;
70
+ const tokens =
71
+ typeof usage === "number"
72
+ ? String(usage)
73
+ : typeof usage?.total_tokens === "number"
74
+ ? String(usage.total_tokens)
75
+ : "—";
76
+
77
+ // 1) HIVE-LOG.md (create with header if missing)
78
+ const logPath = join(projectDir, "HIVE-LOG.md");
79
+ const row = `| ${date} | ${agent} | ${task} | COMPLETED | ${tokens} |`;
80
+ if (existsSync(logPath)) {
81
+ const current = readFileSync(logPath, "utf-8");
82
+ writeFileSync(logPath, current.trimEnd() + "\n" + row + "\n", "utf-8");
83
+ } else {
84
+ writeFileSync(logPath, LOG_HEADER + row + "\n", "utf-8");
85
+ }
86
+
87
+ // 2) JSONL event stream
88
+ const eventsPath = join(projectDir, ".claude", "hive-events.jsonl");
89
+ mkdirSync(dirname(eventsPath), { recursive: true });
90
+ appendFileSync(
91
+ eventsPath,
92
+ JSON.stringify({
93
+ ts: new Date().toISOString(),
94
+ event: "hive_agent_invocation",
95
+ agent,
96
+ task,
97
+ session_id: input.session_id ?? null,
98
+ }) + "\n",
99
+ "utf-8",
100
+ );
101
+ }
102
+
103
+ try {
104
+ main();
105
+ } catch {
106
+ // never block the tool flow
107
+ }
108
+ process.exit(0);
package/package.json ADDED
@@ -0,0 +1,77 @@
1
+ {
2
+ "name": "@simplium/hive",
3
+ "version": "4.0.0",
4
+ "description": "Multi-agent AI framework for software development — 36 specialized agents, NestJS runtime, evidence-based validation, MCP integration",
5
+ "license": "Apache-2.0",
6
+ "author": "José (Simplium.io) <servicios@simplium.io>",
7
+ "homepage": "https://github.com/marcablanca/hive-framework#readme",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/marcablanca/hive-framework.git"
11
+ },
12
+ "bugs": {
13
+ "url": "https://github.com/marcablanca/hive-framework/issues"
14
+ },
15
+ "keywords": [
16
+ "ai-agents",
17
+ "claude",
18
+ "multi-agent",
19
+ "nestjs",
20
+ "mcp",
21
+ "orchestration",
22
+ "hive",
23
+ "llm"
24
+ ],
25
+ "engines": {
26
+ "node": ">=22"
27
+ },
28
+ "type": "module",
29
+ "packageManager": "npm@11.11.0",
30
+ "bin": {
31
+ "hive-init": "bin/hive-init.mjs"
32
+ },
33
+ "files": [
34
+ "bin/",
35
+ "dist/",
36
+ "hooks/",
37
+ "CHANGELOG.md"
38
+ ],
39
+ "publishConfig": {
40
+ "access": "public"
41
+ },
42
+ "scripts": {
43
+ "prepack": "tsx scripts/build-package.ts",
44
+ "test": "vitest run",
45
+ "lint": "eslint scripts bin hooks --max-warnings 0",
46
+ "typecheck": "tsc --noEmit",
47
+ "validate": "tsx scripts/validate.ts",
48
+ "reindex": "tsx scripts/reindex.ts",
49
+ "secrets-audit": "tsx scripts/secrets-audit.ts",
50
+ "adapters": "tsx scripts/generate-adapters.ts",
51
+ "log-session": "tsx scripts/log-session.ts",
52
+ "cost-report": "tsx scripts/cost-report.ts",
53
+ "init-project": "tsx scripts/init-project.ts",
54
+ "eval": "tsx scripts/eval-layer1.ts"
55
+ },
56
+ "devDependencies": {
57
+ "@anthropic-ai/sdk": "^0.109.1",
58
+ "@types/js-yaml": "^4.0.9",
59
+ "@types/node": "^22.20.0",
60
+ "eslint": "^10.5.0",
61
+ "eslint-config-prettier": "^10.1.8",
62
+ "prettier": "^3.8.4",
63
+ "tsx": "^4.19.0",
64
+ "typescript": "^5.6.0",
65
+ "typescript-eslint": "^8.61.1",
66
+ "vitest": "^3.2.6"
67
+ },
68
+ "overrides": {
69
+ "vite": ">=6.4.2"
70
+ },
71
+ "dependencies": {
72
+ "glob": "^11.0.0",
73
+ "gray-matter": "^4.0.3",
74
+ "js-yaml": "^4.1.0",
75
+ "zod": "^3.23.0"
76
+ }
77
+ }