arkaos 2.0.2 → 2.1.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.
- package/VERSION +1 -1
- package/config/constitution.yaml +2 -0
- package/config/hooks/user-prompt-submit-v2.sh +11 -0
- package/core/budget/__pycache__/__init__.cpython-313.pyc +0 -0
- package/core/budget/__pycache__/manager.cpython-313.pyc +0 -0
- package/core/budget/__pycache__/schema.cpython-313.pyc +0 -0
- package/core/knowledge/__init__.py +6 -0
- package/core/knowledge/__pycache__/__init__.cpython-313.pyc +0 -0
- package/core/knowledge/__pycache__/chunker.cpython-313.pyc +0 -0
- package/core/knowledge/__pycache__/embedder.cpython-313.pyc +0 -0
- package/core/knowledge/__pycache__/indexer.cpython-313.pyc +0 -0
- package/core/knowledge/__pycache__/ingest.cpython-313.pyc +0 -0
- package/core/knowledge/__pycache__/vector_store.cpython-313.pyc +0 -0
- package/core/knowledge/chunker.py +121 -0
- package/core/knowledge/embedder.py +52 -0
- package/core/knowledge/indexer.py +97 -0
- package/core/knowledge/ingest.py +270 -0
- package/core/knowledge/vector_store.py +213 -0
- package/core/obsidian/__pycache__/__init__.cpython-313.pyc +0 -0
- package/core/obsidian/__pycache__/templates.cpython-313.pyc +0 -0
- package/core/obsidian/__pycache__/writer.cpython-313.pyc +0 -0
- package/core/orchestration/__pycache__/__init__.cpython-313.pyc +0 -0
- package/core/orchestration/__pycache__/patterns.cpython-313.pyc +0 -0
- package/core/orchestration/__pycache__/protocol.cpython-313.pyc +0 -0
- package/core/runtime/__pycache__/subagent.cpython-313.pyc +0 -0
- package/core/runtime/subagent.py +5 -0
- package/core/squads/__pycache__/schema.cpython-313.pyc +0 -0
- package/core/squads/schema.py +3 -0
- package/core/squads/templates/project-squad.yaml +28 -0
- package/core/synapse/__pycache__/engine.cpython-313.pyc +0 -0
- package/core/synapse/__pycache__/layers.cpython-313.pyc +0 -0
- package/core/synapse/engine.py +5 -1
- package/core/synapse/layers.py +95 -9
- package/core/tasks/__pycache__/schema.cpython-313.pyc +0 -0
- package/core/tasks/schema.py +1 -0
- package/core/workflow/__pycache__/engine.cpython-313.pyc +0 -0
- package/core/workflow/__pycache__/schema.cpython-313.pyc +0 -0
- package/departments/dev/agents/research-assistant.yaml +51 -0
- package/departments/kb/agents/data-collector.yaml +51 -0
- package/departments/ops/agents/doc-writer.yaml +51 -0
- package/departments/pm/agents/pm-director.yaml +1 -1
- package/installer/cli.js +49 -0
- package/installer/init.js +105 -0
- package/installer/migrate.js +4 -1
- package/package.json +1 -1
- package/pyproject.toml +16 -1
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
"""Vector store — SQLite-VSS backed semantic search.
|
|
2
|
+
|
|
3
|
+
Stores document chunks with embeddings for fast similarity search.
|
|
4
|
+
Graceful degradation: works without sqlite-vss (brute-force fallback).
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import json
|
|
8
|
+
import sqlite3
|
|
9
|
+
import time
|
|
10
|
+
from pathlib import Path
|
|
11
|
+
from typing import Any, Optional
|
|
12
|
+
|
|
13
|
+
from core.knowledge.embedder import embed, embed_batch, EMBEDDING_DIMS
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def _load_vss(db: sqlite3.Connection) -> bool:
|
|
17
|
+
"""Try to load sqlite-vss extension."""
|
|
18
|
+
try:
|
|
19
|
+
db.enable_load_extension(True)
|
|
20
|
+
import sqlite_vss
|
|
21
|
+
sqlite_vss.load(db)
|
|
22
|
+
return True
|
|
23
|
+
except (ImportError, Exception):
|
|
24
|
+
return False
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class VectorStore:
|
|
28
|
+
"""SQLite-VSS backed vector store for knowledge retrieval."""
|
|
29
|
+
|
|
30
|
+
def __init__(self, db_path: str | Path = ":memory:") -> None:
|
|
31
|
+
self._db_path = str(db_path)
|
|
32
|
+
self._db = sqlite3.connect(self._db_path)
|
|
33
|
+
self._db.row_factory = sqlite3.Row
|
|
34
|
+
self._vss_available = _load_vss(self._db)
|
|
35
|
+
self._init_schema()
|
|
36
|
+
|
|
37
|
+
def _init_schema(self) -> None:
|
|
38
|
+
"""Create tables if they don't exist."""
|
|
39
|
+
self._db.executescript("""
|
|
40
|
+
CREATE TABLE IF NOT EXISTS chunks (
|
|
41
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
42
|
+
text TEXT NOT NULL,
|
|
43
|
+
heading TEXT DEFAULT '',
|
|
44
|
+
source TEXT DEFAULT '',
|
|
45
|
+
file_hash TEXT DEFAULT '',
|
|
46
|
+
metadata TEXT DEFAULT '{}',
|
|
47
|
+
created_at REAL DEFAULT (unixepoch('now')),
|
|
48
|
+
embedding BLOB
|
|
49
|
+
);
|
|
50
|
+
CREATE INDEX IF NOT EXISTS idx_chunks_source ON chunks(source);
|
|
51
|
+
CREATE INDEX IF NOT EXISTS idx_chunks_hash ON chunks(file_hash);
|
|
52
|
+
""")
|
|
53
|
+
if self._vss_available:
|
|
54
|
+
try:
|
|
55
|
+
self._db.execute(
|
|
56
|
+
f"CREATE VIRTUAL TABLE IF NOT EXISTS vss_chunks USING vss0(embedding({EMBEDDING_DIMS}))"
|
|
57
|
+
)
|
|
58
|
+
except Exception:
|
|
59
|
+
self._vss_available = False
|
|
60
|
+
self._db.commit()
|
|
61
|
+
|
|
62
|
+
def index_chunks(
|
|
63
|
+
self,
|
|
64
|
+
texts: list[str],
|
|
65
|
+
headings: list[str] | None = None,
|
|
66
|
+
source: str = "",
|
|
67
|
+
file_hash: str = "",
|
|
68
|
+
metadata: dict[str, Any] | None = None,
|
|
69
|
+
) -> int:
|
|
70
|
+
"""Index multiple text chunks with embeddings.
|
|
71
|
+
|
|
72
|
+
Returns number of chunks indexed.
|
|
73
|
+
"""
|
|
74
|
+
if not texts:
|
|
75
|
+
return 0
|
|
76
|
+
|
|
77
|
+
embeddings = embed_batch(texts)
|
|
78
|
+
meta_json = json.dumps(metadata or {})
|
|
79
|
+
count = 0
|
|
80
|
+
|
|
81
|
+
for i, text in enumerate(texts):
|
|
82
|
+
heading = headings[i] if headings and i < len(headings) else ""
|
|
83
|
+
emb_blob = None
|
|
84
|
+
|
|
85
|
+
if embeddings and i < len(embeddings):
|
|
86
|
+
emb_blob = _vec_to_blob(embeddings[i])
|
|
87
|
+
|
|
88
|
+
cursor = self._db.execute(
|
|
89
|
+
"INSERT INTO chunks (text, heading, source, file_hash, metadata, embedding) VALUES (?, ?, ?, ?, ?, ?)",
|
|
90
|
+
(text, heading, source, file_hash, meta_json, emb_blob),
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
if self._vss_available and emb_blob:
|
|
94
|
+
self._db.execute(
|
|
95
|
+
"INSERT INTO vss_chunks (rowid, embedding) VALUES (?, ?)",
|
|
96
|
+
(cursor.lastrowid, emb_blob),
|
|
97
|
+
)
|
|
98
|
+
count += 1
|
|
99
|
+
|
|
100
|
+
self._db.commit()
|
|
101
|
+
return count
|
|
102
|
+
|
|
103
|
+
def search(self, query: str, top_k: int = 5) -> list[dict]:
|
|
104
|
+
"""Search for similar chunks.
|
|
105
|
+
|
|
106
|
+
Returns list of dicts with: text, heading, source, score, metadata.
|
|
107
|
+
"""
|
|
108
|
+
# Check if store has any data
|
|
109
|
+
total = self._db.execute("SELECT COUNT(*) as cnt FROM chunks").fetchone()["cnt"]
|
|
110
|
+
if total == 0:
|
|
111
|
+
return []
|
|
112
|
+
|
|
113
|
+
query_emb = embed(query)
|
|
114
|
+
|
|
115
|
+
if query_emb and self._vss_available:
|
|
116
|
+
try:
|
|
117
|
+
return self._vss_search(query_emb, top_k)
|
|
118
|
+
except Exception:
|
|
119
|
+
return self._keyword_search(query, top_k)
|
|
120
|
+
|
|
121
|
+
# Fallback: keyword search
|
|
122
|
+
return self._keyword_search(query, top_k)
|
|
123
|
+
|
|
124
|
+
def _vss_search(self, query_emb: list[float], top_k: int) -> list[dict]:
|
|
125
|
+
"""Vector similarity search via sqlite-vss."""
|
|
126
|
+
query_blob = _vec_to_blob(query_emb)
|
|
127
|
+
rows = self._db.execute("""
|
|
128
|
+
SELECT c.text, c.heading, c.source, c.metadata, v.distance
|
|
129
|
+
FROM vss_chunks v
|
|
130
|
+
JOIN chunks c ON c.id = v.rowid
|
|
131
|
+
WHERE vss_search(v.embedding, vss_search_params(?, ?))
|
|
132
|
+
""", (query_blob, top_k)).fetchall()
|
|
133
|
+
|
|
134
|
+
return [
|
|
135
|
+
{
|
|
136
|
+
"text": r["text"],
|
|
137
|
+
"heading": r["heading"],
|
|
138
|
+
"source": r["source"],
|
|
139
|
+
"score": 1.0 - r["distance"], # Convert distance to similarity
|
|
140
|
+
"metadata": json.loads(r["metadata"]),
|
|
141
|
+
}
|
|
142
|
+
for r in rows
|
|
143
|
+
]
|
|
144
|
+
|
|
145
|
+
def _keyword_search(self, query: str, top_k: int) -> list[dict]:
|
|
146
|
+
"""Fallback keyword search when VSS unavailable."""
|
|
147
|
+
words = query.lower().split()
|
|
148
|
+
if not words:
|
|
149
|
+
return []
|
|
150
|
+
|
|
151
|
+
conditions = " OR ".join(["lower(text) LIKE ?" for _ in words])
|
|
152
|
+
params = [f"%{w}%" for w in words[:5]] # Max 5 keywords
|
|
153
|
+
|
|
154
|
+
rows = self._db.execute(
|
|
155
|
+
f"SELECT text, heading, source, metadata FROM chunks WHERE {conditions} LIMIT ?",
|
|
156
|
+
params + [top_k],
|
|
157
|
+
).fetchall()
|
|
158
|
+
|
|
159
|
+
return [
|
|
160
|
+
{
|
|
161
|
+
"text": r["text"],
|
|
162
|
+
"heading": r["heading"],
|
|
163
|
+
"source": r["source"],
|
|
164
|
+
"score": 0.5, # No real score for keyword search
|
|
165
|
+
"metadata": json.loads(r["metadata"]),
|
|
166
|
+
}
|
|
167
|
+
for r in rows
|
|
168
|
+
]
|
|
169
|
+
|
|
170
|
+
def is_file_indexed(self, file_hash: str) -> bool:
|
|
171
|
+
"""Check if a file has already been indexed."""
|
|
172
|
+
row = self._db.execute(
|
|
173
|
+
"SELECT COUNT(*) as cnt FROM chunks WHERE file_hash = ?", (file_hash,)
|
|
174
|
+
).fetchone()
|
|
175
|
+
return row["cnt"] > 0
|
|
176
|
+
|
|
177
|
+
def remove_file(self, source: str) -> int:
|
|
178
|
+
"""Remove all chunks from a source file."""
|
|
179
|
+
if self._vss_available:
|
|
180
|
+
rows = self._db.execute("SELECT id FROM chunks WHERE source = ?", (source,)).fetchall()
|
|
181
|
+
for r in rows:
|
|
182
|
+
self._db.execute("DELETE FROM vss_chunks WHERE rowid = ?", (r["id"],))
|
|
183
|
+
deleted = self._db.execute("DELETE FROM chunks WHERE source = ?", (source,)).rowcount
|
|
184
|
+
self._db.commit()
|
|
185
|
+
return deleted
|
|
186
|
+
|
|
187
|
+
def get_stats(self) -> dict:
|
|
188
|
+
"""Get store statistics."""
|
|
189
|
+
total = self._db.execute("SELECT COUNT(*) as cnt FROM chunks").fetchone()["cnt"]
|
|
190
|
+
sources = self._db.execute("SELECT COUNT(DISTINCT source) as cnt FROM chunks").fetchone()["cnt"]
|
|
191
|
+
return {
|
|
192
|
+
"total_chunks": total,
|
|
193
|
+
"total_files": sources,
|
|
194
|
+
"vss_available": self._vss_available,
|
|
195
|
+
"db_path": self._db_path,
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
def clear(self) -> None:
|
|
199
|
+
"""Remove all data."""
|
|
200
|
+
if self._vss_available:
|
|
201
|
+
self._db.execute("DELETE FROM vss_chunks")
|
|
202
|
+
self._db.execute("DELETE FROM chunks")
|
|
203
|
+
self._db.commit()
|
|
204
|
+
|
|
205
|
+
def close(self) -> None:
|
|
206
|
+
"""Close database connection."""
|
|
207
|
+
self._db.close()
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
def _vec_to_blob(vec: list[float]) -> bytes:
|
|
211
|
+
"""Convert float vector to bytes for SQLite storage."""
|
|
212
|
+
import struct
|
|
213
|
+
return struct.pack(f"{len(vec)}f", *vec)
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/core/runtime/subagent.py
CHANGED
|
@@ -102,6 +102,11 @@ class SubagentDispatcher:
|
|
|
102
102
|
The dispatcher creates HandoffArtifacts from agent definitions
|
|
103
103
|
and task descriptions, then delegates to the runtime adapter
|
|
104
104
|
for actual execution.
|
|
105
|
+
|
|
106
|
+
Nesting policy: Maximum 1 level of nesting (agent -> subagent).
|
|
107
|
+
Sub-subagent dispatch is not recommended -- creates context fragmentation
|
|
108
|
+
and debugging complexity. If a subagent needs help, it should escalate
|
|
109
|
+
to its squad lead rather than spawning another subagent.
|
|
105
110
|
"""
|
|
106
111
|
|
|
107
112
|
def __init__(self) -> None:
|
|
Binary file
|
package/core/squads/schema.py
CHANGED
|
@@ -35,6 +35,9 @@ class SquadMember(BaseModel):
|
|
|
35
35
|
borrowed: bool = False # Borrowed from another department?
|
|
36
36
|
source_department: str = "" # Original department if borrowed
|
|
37
37
|
availability: float = 1.0 # 0.0-1.0, for shared agents
|
|
38
|
+
# Tier 2 agents can collaborate directly within project squads
|
|
39
|
+
# without requiring Tier 1 approval for each interaction.
|
|
40
|
+
can_collaborate_directly: bool = True
|
|
38
41
|
|
|
39
42
|
|
|
40
43
|
class SquadWorkflow(BaseModel):
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Project Squad Template
|
|
2
|
+
# Copy and customize for cross-department projects
|
|
3
|
+
id: project-{name}
|
|
4
|
+
name: "{Project Name} Squad"
|
|
5
|
+
description: "Cross-department squad for {project description}"
|
|
6
|
+
department: "" # No single department — cross-cutting
|
|
7
|
+
squad_type: project
|
|
8
|
+
topology: stream-aligned
|
|
9
|
+
|
|
10
|
+
members:
|
|
11
|
+
# Borrow from department squads
|
|
12
|
+
- agent_id: "{lead-agent-id}"
|
|
13
|
+
role: "Project Lead"
|
|
14
|
+
is_lead: true
|
|
15
|
+
borrowed: true # Borrowed from department squad
|
|
16
|
+
availability: 0.5 # 50% allocation
|
|
17
|
+
|
|
18
|
+
- agent_id: "{specialist-id}"
|
|
19
|
+
role: "Technical Implementation"
|
|
20
|
+
borrowed: true
|
|
21
|
+
availability: 0.3
|
|
22
|
+
|
|
23
|
+
# Project squads:
|
|
24
|
+
# - Created by COO (Sofia) or any Squad Lead
|
|
25
|
+
# - Agents are borrowed, not moved
|
|
26
|
+
# - Max 10 members (Two-Pizza Team)
|
|
27
|
+
# - Dissolved when project completes
|
|
28
|
+
# - Quality Gate still mandatory
|
|
Binary file
|
|
Binary file
|
package/core/synapse/engine.py
CHANGED
|
@@ -10,6 +10,7 @@ Design goals:
|
|
|
10
10
|
|
|
11
11
|
import time
|
|
12
12
|
from dataclasses import dataclass, field
|
|
13
|
+
from typing import Any
|
|
13
14
|
|
|
14
15
|
from core.synapse.layers import Layer, LayerResult, PromptContext
|
|
15
16
|
from core.synapse.cache import LayerCache
|
|
@@ -152,6 +153,7 @@ def create_default_engine(
|
|
|
152
153
|
constitution_compressed: str = "",
|
|
153
154
|
commands: list[dict] | None = None,
|
|
154
155
|
agents_registry: dict[str, dict] | None = None,
|
|
156
|
+
vector_store: Any = None,
|
|
155
157
|
) -> SynapseEngine:
|
|
156
158
|
"""Create a SynapseEngine with all 8 default layers.
|
|
157
159
|
|
|
@@ -166,7 +168,7 @@ def create_default_engine(
|
|
|
166
168
|
from core.synapse.layers import (
|
|
167
169
|
ConstitutionLayer, DepartmentLayer, AgentLayer,
|
|
168
170
|
ProjectLayer, BranchLayer, CommandHintsLayer,
|
|
169
|
-
QualityGateLayer, TimeLayer,
|
|
171
|
+
QualityGateLayer, TimeLayer, KnowledgeRetrievalLayer,
|
|
170
172
|
)
|
|
171
173
|
|
|
172
174
|
engine = SynapseEngine()
|
|
@@ -176,6 +178,8 @@ def create_default_engine(
|
|
|
176
178
|
engine.register_layer(DepartmentLayer())
|
|
177
179
|
engine.register_layer(AgentLayer(agents_registry=agents_registry))
|
|
178
180
|
engine.register_layer(ProjectLayer())
|
|
181
|
+
if vector_store is not None:
|
|
182
|
+
engine.register_layer(KnowledgeRetrievalLayer(vector_store=vector_store))
|
|
179
183
|
engine.register_layer(BranchLayer())
|
|
180
184
|
engine.register_layer(CommandHintsLayer(commands=commands))
|
|
181
185
|
engine.register_layer(QualityGateLayer())
|
package/core/synapse/layers.py
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
"""Synapse layer definitions — the
|
|
1
|
+
"""Synapse layer definitions — the 9 context layers.
|
|
2
2
|
|
|
3
3
|
Each layer extracts a specific type of context and compresses it
|
|
4
4
|
for injection into the prompt. Layers are pluggable and ordered.
|
|
5
5
|
|
|
6
6
|
Layer Architecture:
|
|
7
|
-
L0:
|
|
8
|
-
L1:
|
|
9
|
-
L2:
|
|
10
|
-
L3:
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
L0: Constitution — Compressed governance rules (TTL: 300s)
|
|
8
|
+
L1: Department — Detected department from input (no cache)
|
|
9
|
+
L2: Agent — Agent profile + last gotchas (TTL: 30s)
|
|
10
|
+
L3: Project — Active project context (TTL: 30s)
|
|
11
|
+
L3.5: KnowledgeRetrieval — Semantic search from vector DB (TTL: 30s)
|
|
12
|
+
L4: Branch — Current git branch (no cache)
|
|
13
|
+
L5: Command Hints — Matching commands from registry (TTL: 30s)
|
|
14
|
+
L6: Quality Gate — QG status and last verdicts (TTL: 60s)
|
|
15
|
+
L7: Time — Time-of-day signal (no cache)
|
|
15
16
|
"""
|
|
16
17
|
|
|
17
18
|
import re
|
|
@@ -439,3 +440,88 @@ class TimeLayer(Layer):
|
|
|
439
440
|
layer_id=self.id, tag=tag, content=period,
|
|
440
441
|
tokens_est=1, compute_ms=ms, cached=False,
|
|
441
442
|
)
|
|
443
|
+
|
|
444
|
+
|
|
445
|
+
# --- L3.5: Knowledge Retrieval ---
|
|
446
|
+
|
|
447
|
+
class KnowledgeRetrievalLayer(Layer):
|
|
448
|
+
"""L3.5: Semantic knowledge retrieval from vector DB.
|
|
449
|
+
|
|
450
|
+
Searches the local vector store for chunks relevant to the user's
|
|
451
|
+
input and injects them as context. Gracefully skips if vector store
|
|
452
|
+
is unavailable or empty.
|
|
453
|
+
"""
|
|
454
|
+
|
|
455
|
+
def __init__(self, vector_store: Any = None, max_chunks: int = 3, max_tokens: int = 400) -> None:
|
|
456
|
+
self._store = vector_store
|
|
457
|
+
self._max_chunks = max_chunks
|
|
458
|
+
self._max_tokens = max_tokens
|
|
459
|
+
|
|
460
|
+
@property
|
|
461
|
+
def id(self) -> str:
|
|
462
|
+
return "L3.5"
|
|
463
|
+
|
|
464
|
+
@property
|
|
465
|
+
def name(self) -> str:
|
|
466
|
+
return "KnowledgeRetrieval"
|
|
467
|
+
|
|
468
|
+
@property
|
|
469
|
+
def cache_ttl(self) -> int:
|
|
470
|
+
return 30
|
|
471
|
+
|
|
472
|
+
@property
|
|
473
|
+
def priority(self) -> int:
|
|
474
|
+
return 35
|
|
475
|
+
|
|
476
|
+
def compute(self, ctx: PromptContext) -> LayerResult:
|
|
477
|
+
start = time.time()
|
|
478
|
+
|
|
479
|
+
if not self._store or not ctx.user_input:
|
|
480
|
+
return LayerResult(
|
|
481
|
+
layer_id=self.id, tag="", content="",
|
|
482
|
+
tokens_est=0, compute_ms=0, cached=False,
|
|
483
|
+
)
|
|
484
|
+
|
|
485
|
+
try:
|
|
486
|
+
results = self._store.search(ctx.user_input, top_k=self._max_chunks)
|
|
487
|
+
except Exception:
|
|
488
|
+
return LayerResult(
|
|
489
|
+
layer_id=self.id, tag="", content="",
|
|
490
|
+
tokens_est=0, compute_ms=0, cached=False,
|
|
491
|
+
)
|
|
492
|
+
|
|
493
|
+
if not results:
|
|
494
|
+
ms = int((time.time() - start) * 1000)
|
|
495
|
+
return LayerResult(
|
|
496
|
+
layer_id=self.id, tag="", content="",
|
|
497
|
+
tokens_est=0, compute_ms=ms, cached=False,
|
|
498
|
+
)
|
|
499
|
+
|
|
500
|
+
# Build compact knowledge context
|
|
501
|
+
snippets = []
|
|
502
|
+
total_tokens = 0
|
|
503
|
+
for r in results:
|
|
504
|
+
text = r["text"][:200].replace("\n", " ").strip()
|
|
505
|
+
tokens = len(text.split())
|
|
506
|
+
if total_tokens + tokens > self._max_tokens:
|
|
507
|
+
break
|
|
508
|
+
source = r.get("source", "").split("/")[-1] if r.get("source") else ""
|
|
509
|
+
snippet = f"{source}: {text}" if source else text
|
|
510
|
+
snippets.append(snippet)
|
|
511
|
+
total_tokens += tokens
|
|
512
|
+
|
|
513
|
+
if not snippets:
|
|
514
|
+
ms = int((time.time() - start) * 1000)
|
|
515
|
+
return LayerResult(
|
|
516
|
+
layer_id=self.id, tag="", content="",
|
|
517
|
+
tokens_est=0, compute_ms=ms, cached=False,
|
|
518
|
+
)
|
|
519
|
+
|
|
520
|
+
content = " | ".join(snippets)
|
|
521
|
+
tag = f"[knowledge:{len(snippets)} chunks]"
|
|
522
|
+
ms = int((time.time() - start) * 1000)
|
|
523
|
+
|
|
524
|
+
return LayerResult(
|
|
525
|
+
layer_id=self.id, tag=tag, content=content,
|
|
526
|
+
tokens_est=total_tokens, compute_ms=ms, cached=False,
|
|
527
|
+
)
|
|
Binary file
|
package/core/tasks/schema.py
CHANGED
|
@@ -29,6 +29,7 @@ class TaskType(str, Enum):
|
|
|
29
29
|
RESEARCH = "research" # Background research
|
|
30
30
|
GENERATION = "generation" # AI content/image generation
|
|
31
31
|
EXPORT = "export" # Export to external system
|
|
32
|
+
KB_INDEX = "kb_index" # Index documents into vector store
|
|
32
33
|
CUSTOM = "custom"
|
|
33
34
|
|
|
34
35
|
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
id: research-assistant
|
|
2
|
+
name: Maria
|
|
3
|
+
role: Research Assistant
|
|
4
|
+
department: dev
|
|
5
|
+
tier: 3
|
|
6
|
+
|
|
7
|
+
behavioral_dna:
|
|
8
|
+
disc:
|
|
9
|
+
primary: C
|
|
10
|
+
secondary: S
|
|
11
|
+
communication_style: "Thorough, detail-oriented, presents findings systematically"
|
|
12
|
+
under_pressure: "Digs deeper into data before responding"
|
|
13
|
+
motivator: "Understanding the full picture"
|
|
14
|
+
enneagram:
|
|
15
|
+
type: 5
|
|
16
|
+
wing: 6
|
|
17
|
+
core_motivation: "To understand and be competent"
|
|
18
|
+
core_fear: "Being ignorant or uninformed"
|
|
19
|
+
subtype: social
|
|
20
|
+
big_five:
|
|
21
|
+
openness: 90
|
|
22
|
+
conscientiousness: 85
|
|
23
|
+
extraversion: 30
|
|
24
|
+
agreeableness: 70
|
|
25
|
+
neuroticism: 35
|
|
26
|
+
mbti:
|
|
27
|
+
type: INTP
|
|
28
|
+
|
|
29
|
+
authority:
|
|
30
|
+
veto: false
|
|
31
|
+
approve_budget: false
|
|
32
|
+
approve_architecture: false
|
|
33
|
+
approve_quality: false
|
|
34
|
+
block_release: false
|
|
35
|
+
block_delivery: false
|
|
36
|
+
orchestrate: false
|
|
37
|
+
delegates_to: []
|
|
38
|
+
escalates_to: tech-lead-paulo
|
|
39
|
+
|
|
40
|
+
expertise:
|
|
41
|
+
domains: ["research", "documentation", "analysis", "literature-review"]
|
|
42
|
+
frameworks: ["Systematic Review", "PRISMA", "Research Methodology"]
|
|
43
|
+
depth: proficient
|
|
44
|
+
years_equivalent: 5
|
|
45
|
+
|
|
46
|
+
communication:
|
|
47
|
+
language: en
|
|
48
|
+
tone: "Precise and informative"
|
|
49
|
+
vocabulary_level: specialist
|
|
50
|
+
preferred_format: "Structured reports with citations"
|
|
51
|
+
avoid: ["assumptions without evidence", "vague conclusions"]
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
id: data-collector
|
|
2
|
+
name: Tomas Jr
|
|
3
|
+
role: Data Collector
|
|
4
|
+
department: kb
|
|
5
|
+
tier: 3
|
|
6
|
+
|
|
7
|
+
behavioral_dna:
|
|
8
|
+
disc:
|
|
9
|
+
primary: C
|
|
10
|
+
secondary: D
|
|
11
|
+
communication_style: "Data-driven, factual, structured"
|
|
12
|
+
under_pressure: "Relies on systematic data collection"
|
|
13
|
+
motivator: "Complete and accurate data"
|
|
14
|
+
enneagram:
|
|
15
|
+
type: 6
|
|
16
|
+
wing: 5
|
|
17
|
+
core_motivation: "To have reliable information"
|
|
18
|
+
core_fear: "Making decisions on incomplete data"
|
|
19
|
+
subtype: self-preservation
|
|
20
|
+
big_five:
|
|
21
|
+
openness: 70
|
|
22
|
+
conscientiousness: 88
|
|
23
|
+
extraversion: 35
|
|
24
|
+
agreeableness: 65
|
|
25
|
+
neuroticism: 40
|
|
26
|
+
mbti:
|
|
27
|
+
type: ISTJ
|
|
28
|
+
|
|
29
|
+
authority:
|
|
30
|
+
veto: false
|
|
31
|
+
approve_budget: false
|
|
32
|
+
approve_architecture: false
|
|
33
|
+
approve_quality: false
|
|
34
|
+
block_release: false
|
|
35
|
+
block_delivery: false
|
|
36
|
+
orchestrate: false
|
|
37
|
+
delegates_to: []
|
|
38
|
+
escalates_to: kb-lead-clara
|
|
39
|
+
|
|
40
|
+
expertise:
|
|
41
|
+
domains: ["data-collection", "web-scraping", "API-integration", "data-validation"]
|
|
42
|
+
frameworks: ["ETL", "Data Quality Framework"]
|
|
43
|
+
depth: proficient
|
|
44
|
+
years_equivalent: 4
|
|
45
|
+
|
|
46
|
+
communication:
|
|
47
|
+
language: en
|
|
48
|
+
tone: "Factual and precise"
|
|
49
|
+
vocabulary_level: specialist
|
|
50
|
+
preferred_format: "Data tables with quality scores"
|
|
51
|
+
avoid: ["subjective interpretations", "unverified claims"]
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
id: doc-writer
|
|
2
|
+
name: Isabel
|
|
3
|
+
role: Documentation Writer
|
|
4
|
+
department: ops
|
|
5
|
+
tier: 3
|
|
6
|
+
|
|
7
|
+
behavioral_dna:
|
|
8
|
+
disc:
|
|
9
|
+
primary: S
|
|
10
|
+
secondary: C
|
|
11
|
+
communication_style: "Clear, structured, audience-aware"
|
|
12
|
+
under_pressure: "Focuses on clarity and completeness"
|
|
13
|
+
motivator: "Making complex things accessible"
|
|
14
|
+
enneagram:
|
|
15
|
+
type: 1
|
|
16
|
+
wing: 2
|
|
17
|
+
core_motivation: "To produce correct, helpful documentation"
|
|
18
|
+
core_fear: "Publishing inaccurate information"
|
|
19
|
+
subtype: social
|
|
20
|
+
big_five:
|
|
21
|
+
openness: 75
|
|
22
|
+
conscientiousness: 92
|
|
23
|
+
extraversion: 40
|
|
24
|
+
agreeableness: 80
|
|
25
|
+
neuroticism: 30
|
|
26
|
+
mbti:
|
|
27
|
+
type: ISFJ
|
|
28
|
+
|
|
29
|
+
authority:
|
|
30
|
+
veto: false
|
|
31
|
+
approve_budget: false
|
|
32
|
+
approve_architecture: false
|
|
33
|
+
approve_quality: false
|
|
34
|
+
block_release: false
|
|
35
|
+
block_delivery: false
|
|
36
|
+
orchestrate: false
|
|
37
|
+
delegates_to: []
|
|
38
|
+
escalates_to: ops-lead-daniel
|
|
39
|
+
|
|
40
|
+
expertise:
|
|
41
|
+
domains: ["technical-writing", "API-docs", "user-guides", "SOPs"]
|
|
42
|
+
frameworks: ["Diátaxis", "Google Developer Documentation Style"]
|
|
43
|
+
depth: proficient
|
|
44
|
+
years_equivalent: 5
|
|
45
|
+
|
|
46
|
+
communication:
|
|
47
|
+
language: en
|
|
48
|
+
tone: "Clear, concise, helpful"
|
|
49
|
+
vocabulary_level: accessible
|
|
50
|
+
preferred_format: "Step-by-step guides with examples"
|
|
51
|
+
avoid: ["jargon without explanation", "walls of text"]
|