@lucieri/daxiom 0.2.1
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.
- package/README.md +122 -0
- package/bin/daxiom.js +4 -0
- package/package.json +47 -0
- package/src/agents.js +100 -0
- package/src/cli.js +423 -0
- package/src/connection.js +43 -0
- package/src/constants.js +91 -0
- package/src/embeddings.js +52 -0
- package/src/hooks/env.js +52 -0
- package/src/hooks/index.js +59 -0
- package/src/hooks/post-task.js +186 -0
- package/src/hooks/pre-compact.js +128 -0
- package/src/hooks/pre-task.js +97 -0
- package/src/hooks/session-start.js +108 -0
- package/src/hooks/summarize.js +141 -0
- package/src/index.js +67 -0
- package/src/patterns.js +339 -0
- package/src/quality-gates.js +183 -0
- package/src/self-manage.js +105 -0
- package/src/tiers.js +305 -0
package/README.md
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# DAXIOM
|
|
2
|
+
|
|
3
|
+
**Danny's Autonomous eXtended Intelligence Operating Mind**
|
|
4
|
+
|
|
5
|
+
A Life Operating System / Second Brain built on RuVector PostgreSQL with 1536-dimensional embeddings, HNSW indexing, and 16 specialized AI agents.
|
|
6
|
+
|
|
7
|
+
## Architecture
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
┌─────────────────────────────────────────────────────────────────┐
|
|
11
|
+
│ DAXIOM │
|
|
12
|
+
│ │
|
|
13
|
+
│ ┌───────────────────────────────────────────────────────────┐ │
|
|
14
|
+
│ │ 6-LAYER SECURITY MODEL │ │
|
|
15
|
+
│ │ L1: Transport │ L2: Auth │ L3: Authorization │ │
|
|
16
|
+
│ │ L4: Data Protection │ L5: AI Defense │ L6: Sandbox │ │
|
|
17
|
+
│ └───────────────────────────────────────────────────────────┘ │
|
|
18
|
+
│ │
|
|
19
|
+
│ ┌─────────────────────┐ ┌─────────────────────────────┐ │
|
|
20
|
+
│ │ RuVector Core │ │ Multi-Channel Gateway │ │
|
|
21
|
+
│ │ PostgreSQL │◄──►│ WhatsApp │ Telegram │ │
|
|
22
|
+
│ │ • 1536 dims │ │ Discord │ Slack │ │
|
|
23
|
+
│ │ • 30+ HNSW idx │ │ Signal │ iMessage │ │
|
|
24
|
+
│ │ • RLS isolation │ │ Voice │ Web │ │
|
|
25
|
+
│ └─────────────────────┘ └─────────────────────────────┘ │
|
|
26
|
+
│ │
|
|
27
|
+
│ ┌─────────────────────────────────────────────────────────┐ │
|
|
28
|
+
│ │ 10 SCHEMAS │ 48 TABLES │ 30+ HNSW INDEXES │ │
|
|
29
|
+
│ │ daxiom │ memory │ work │ projects │ business │ │
|
|
30
|
+
│ │ personal │ mind │ comms │ planning │ audit │ │
|
|
31
|
+
│ └─────────────────────────────────────────────────────────┘ │
|
|
32
|
+
│ │
|
|
33
|
+
│ ┌─────────────────────────────────────────────────────────┐ │
|
|
34
|
+
│ │ 16 SPECIALIZED AGENTS │ │
|
|
35
|
+
│ │ daxiom-router │ daxiom-memory │ philanthropy-analyst │ │
|
|
36
|
+
│ │ adhd-coach │ pattern-detector │ project-assistant │ │
|
|
37
|
+
│ └─────────────────────────────────────────────────────────┘ │
|
|
38
|
+
└─────────────────────────────────────────────────────────────────┘
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Schemas
|
|
42
|
+
|
|
43
|
+
| Schema | Tables | Purpose |
|
|
44
|
+
|--------|--------|---------|
|
|
45
|
+
| `daxiom` | 4 | Core: agents, routing, conversations, self-awareness |
|
|
46
|
+
| `memory` | 3 | Unified knowledge: entries, patterns, relationships |
|
|
47
|
+
| `work` | 18 | Cleveland Clinic $250M philanthropy campaign |
|
|
48
|
+
| `projects` | 4 | Tech repos, code patterns, tasks |
|
|
49
|
+
| `business` | 4 | Ventures: entities, finance, marketing |
|
|
50
|
+
| `personal` | 3 | Health, ADHD management, people |
|
|
51
|
+
| `mind` | 4 | Inner world: thoughts, aspirations, fears |
|
|
52
|
+
| `comms` | 3 | Communications: messages, contacts |
|
|
53
|
+
| `planning` | 3 | Documents: ADRs, PRDs, roadmaps |
|
|
54
|
+
| `audit` | 2 | Immutable history |
|
|
55
|
+
|
|
56
|
+
## Privacy Layers
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
System → Work → Business → Personal → Private/Encrypted → Audit
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Each layer has increasing privacy controls with Row-Level Security.
|
|
63
|
+
|
|
64
|
+
## Quick Start
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
# Clone
|
|
68
|
+
git clone https://github.com/yourusername/daxiom.git
|
|
69
|
+
cd daxiom
|
|
70
|
+
|
|
71
|
+
# Install dependencies
|
|
72
|
+
pnpm install
|
|
73
|
+
|
|
74
|
+
# Set up database
|
|
75
|
+
createdb daxiom
|
|
76
|
+
psql daxiom < db/schemas/000_init.sql
|
|
77
|
+
|
|
78
|
+
# Configure
|
|
79
|
+
cp config/default.json config/local.json
|
|
80
|
+
# Edit config/local.json with your settings
|
|
81
|
+
|
|
82
|
+
# Run
|
|
83
|
+
pnpm dev
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Tech Stack
|
|
87
|
+
|
|
88
|
+
- **Database**: PostgreSQL 16+ with RuVector extension
|
|
89
|
+
- **Embeddings**: OpenAI text-embedding-3-small (1536 dims)
|
|
90
|
+
- **Indexing**: HNSW for 150x-12,500x faster search
|
|
91
|
+
- **Runtime**: Node.js 22+ / Bun
|
|
92
|
+
- **Agents**: Claude Flow v3 orchestration
|
|
93
|
+
- **Channels**: OpenClaw-compatible gateway adapters
|
|
94
|
+
|
|
95
|
+
## Self-Building
|
|
96
|
+
|
|
97
|
+
DAXIOM is designed to build itself. This repo's knowledge is stored in RuVector so agents can:
|
|
98
|
+
|
|
99
|
+
1. Query the schema for table structures
|
|
100
|
+
2. Understand agent capabilities and routing
|
|
101
|
+
3. Generate migrations and code
|
|
102
|
+
4. Track progress in `projects.tasks`
|
|
103
|
+
|
|
104
|
+
```sql
|
|
105
|
+
-- Agents can query their own documentation
|
|
106
|
+
SELECT * FROM memory.entries
|
|
107
|
+
WHERE embedding <-> embed('DAXIOM architecture') < 0.3
|
|
108
|
+
ORDER BY embedding <-> embed('DAXIOM architecture')
|
|
109
|
+
LIMIT 5;
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## Documentation
|
|
113
|
+
|
|
114
|
+
- [Architecture](docs/daxiom-v1.md)
|
|
115
|
+
- [Full Schema](docs/daxiom-schema.md)
|
|
116
|
+
- [Agents](docs/agents.md)
|
|
117
|
+
- [Embeddings Guide](docs/embeddings-guide.md)
|
|
118
|
+
- [Integrations](docs/integrations.md)
|
|
119
|
+
|
|
120
|
+
## License
|
|
121
|
+
|
|
122
|
+
Private - All rights reserved.
|
package/bin/daxiom.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@lucieri/daxiom",
|
|
3
|
+
"version": "0.2.1",
|
|
4
|
+
"description": "DAXIOM SDK — Pattern database client with quality gates, tier management, and semantic search via RuVector PostgreSQL",
|
|
5
|
+
"main": "src/index.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"daxiom": "./bin/daxiom.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"src/",
|
|
11
|
+
"bin/",
|
|
12
|
+
"package.json",
|
|
13
|
+
"README.md",
|
|
14
|
+
"LICENSE"
|
|
15
|
+
],
|
|
16
|
+
"scripts": {
|
|
17
|
+
"test": "node tests/quality-gates.test.js && node tests/tiers.test.js && node tests/connection.test.js",
|
|
18
|
+
"test:quality": "node tests/quality-gates.test.js",
|
|
19
|
+
"test:tiers": "node tests/tiers.test.js",
|
|
20
|
+
"test:connection": "node tests/connection.test.js"
|
|
21
|
+
},
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"pg": "^8.13.0"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {},
|
|
26
|
+
"engines": {
|
|
27
|
+
"node": ">=18.0.0"
|
|
28
|
+
},
|
|
29
|
+
"keywords": [
|
|
30
|
+
"daxiom",
|
|
31
|
+
"second-brain",
|
|
32
|
+
"ruvector",
|
|
33
|
+
"postgresql",
|
|
34
|
+
"embeddings",
|
|
35
|
+
"pattern-database",
|
|
36
|
+
"quality-gates",
|
|
37
|
+
"semantic-search",
|
|
38
|
+
"ai-agents",
|
|
39
|
+
"vector-search"
|
|
40
|
+
],
|
|
41
|
+
"author": "Danny Alberttis",
|
|
42
|
+
"license": "MIT",
|
|
43
|
+
"repository": {
|
|
44
|
+
"type": "git",
|
|
45
|
+
"url": "https://github.com/ruvnet/daxiom"
|
|
46
|
+
}
|
|
47
|
+
}
|
package/src/agents.js
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { getPool } = require('./connection');
|
|
4
|
+
const { getEmbedding } = require('./embeddings');
|
|
5
|
+
const { EMBEDDING_DIM } = require('./constants');
|
|
6
|
+
|
|
7
|
+
// ── Agent performance profile (capability ledger) ────────────────────────────
|
|
8
|
+
async function getAgentProfile(agentId) {
|
|
9
|
+
const p = getPool();
|
|
10
|
+
const client = await p.connect();
|
|
11
|
+
try {
|
|
12
|
+
await client.query('SET jit = off');
|
|
13
|
+
const res = await client.query(`
|
|
14
|
+
SELECT
|
|
15
|
+
metadata->>'agent_type' as agent_type,
|
|
16
|
+
COUNT(*) as patterns_created,
|
|
17
|
+
ROUND(AVG(confidence)::numeric, 4) as avg_confidence,
|
|
18
|
+
ROUND(AVG(NULLIF(success_rate, 0))::numeric, 4) as avg_success_rate,
|
|
19
|
+
COUNT(*) FILTER (WHERE success_rate >= 0.7) as high_quality,
|
|
20
|
+
COUNT(*) FILTER (WHERE success_rate < 0.3) as low_quality,
|
|
21
|
+
array_agg(DISTINCT category) as task_types,
|
|
22
|
+
SUM(usage_count) as total_usage,
|
|
23
|
+
MAX(last_used_at) as last_active
|
|
24
|
+
FROM tribal_intelligence.patterns
|
|
25
|
+
WHERE metadata->>'agent_id' = $1
|
|
26
|
+
GROUP BY metadata->>'agent_type'
|
|
27
|
+
`, [agentId]);
|
|
28
|
+
|
|
29
|
+
if (res.rows.length === 0) return null;
|
|
30
|
+
|
|
31
|
+
return {
|
|
32
|
+
agentId,
|
|
33
|
+
profiles: res.rows.map(r => ({
|
|
34
|
+
agentType: r.agent_type,
|
|
35
|
+
patternsCreated: parseInt(r.patterns_created),
|
|
36
|
+
avgConfidence: parseFloat(r.avg_confidence) || 0,
|
|
37
|
+
avgSuccessRate: parseFloat(r.avg_success_rate) || 0,
|
|
38
|
+
highQuality: parseInt(r.high_quality),
|
|
39
|
+
lowQuality: parseInt(r.low_quality),
|
|
40
|
+
taskTypes: r.task_types,
|
|
41
|
+
totalUsage: parseInt(r.total_usage),
|
|
42
|
+
lastActive: r.last_active,
|
|
43
|
+
})),
|
|
44
|
+
};
|
|
45
|
+
} finally {
|
|
46
|
+
client.release();
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// ── Route to best agent (capability-based task routing) ──────────────────────
|
|
51
|
+
async function routeToAgent(taskDescription) {
|
|
52
|
+
const p = getPool();
|
|
53
|
+
const client = await p.connect();
|
|
54
|
+
try {
|
|
55
|
+
await client.query('SET jit = off');
|
|
56
|
+
const embedding = await getEmbedding(taskDescription);
|
|
57
|
+
const vecStr = '[' + embedding.join(',') + ']';
|
|
58
|
+
|
|
59
|
+
const res = await client.query(`
|
|
60
|
+
WITH nearest AS (
|
|
61
|
+
SELECT
|
|
62
|
+
metadata->>'agent_id' as agent_id,
|
|
63
|
+
metadata->>'agent_type' as agent_type,
|
|
64
|
+
confidence, success_rate,
|
|
65
|
+
ROUND((1 - (embedding <=> $1::ruvector(${EMBEDDING_DIM})))::numeric, 4) as similarity
|
|
66
|
+
FROM tribal_intelligence.patterns
|
|
67
|
+
WHERE embedding IS NOT NULL
|
|
68
|
+
AND metadata->>'agent_id' IS NOT NULL
|
|
69
|
+
AND metadata->>'agent_id' != 'unknown'
|
|
70
|
+
ORDER BY embedding <=> $1::ruvector(${EMBEDDING_DIM})
|
|
71
|
+
LIMIT 10
|
|
72
|
+
)
|
|
73
|
+
SELECT
|
|
74
|
+
agent_id, agent_type,
|
|
75
|
+
COUNT(*) as matching_patterns,
|
|
76
|
+
ROUND(AVG(confidence)::numeric, 4) as avg_confidence,
|
|
77
|
+
ROUND(AVG(NULLIF(success_rate, 0))::numeric, 4) as avg_success_rate,
|
|
78
|
+
ROUND(AVG(similarity)::numeric, 4) as avg_similarity,
|
|
79
|
+
ROUND((AVG(confidence) * AVG(NULLIF(success_rate, 0)))::numeric, 4) as score
|
|
80
|
+
FROM nearest
|
|
81
|
+
GROUP BY agent_id, agent_type
|
|
82
|
+
ORDER BY (AVG(confidence) * AVG(NULLIF(success_rate, 0))) DESC NULLS LAST
|
|
83
|
+
LIMIT 3
|
|
84
|
+
`, [vecStr]);
|
|
85
|
+
|
|
86
|
+
return res.rows.map(r => ({
|
|
87
|
+
agentId: r.agent_id,
|
|
88
|
+
agentType: r.agent_type,
|
|
89
|
+
matchingPatterns: parseInt(r.matching_patterns),
|
|
90
|
+
avgConfidence: parseFloat(r.avg_confidence) || 0,
|
|
91
|
+
avgSuccessRate: parseFloat(r.avg_success_rate) || 0,
|
|
92
|
+
avgSimilarity: parseFloat(r.avg_similarity) || 0,
|
|
93
|
+
score: parseFloat(r.score) || 0,
|
|
94
|
+
}));
|
|
95
|
+
} finally {
|
|
96
|
+
client.release();
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
module.exports = { getAgentProfile, routeToAgent };
|