auroq-os 1.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.
- package/.auroq-core/constitution.md +153 -0
- package/.auroq-core/core/synapse/context/context-builder.js +34 -0
- package/.auroq-core/core/synapse/context/context-tracker.js +198 -0
- package/.auroq-core/core/synapse/diagnostics/collectors/consistency-collector.js +168 -0
- package/.auroq-core/core/synapse/diagnostics/collectors/hook-collector.js +129 -0
- package/.auroq-core/core/synapse/diagnostics/collectors/manifest-collector.js +82 -0
- package/.auroq-core/core/synapse/diagnostics/collectors/output-analyzer.js +134 -0
- package/.auroq-core/core/synapse/diagnostics/collectors/pipeline-collector.js +75 -0
- package/.auroq-core/core/synapse/diagnostics/collectors/quality-collector.js +252 -0
- package/.auroq-core/core/synapse/diagnostics/collectors/relevance-matrix.js +174 -0
- package/.auroq-core/core/synapse/diagnostics/collectors/safe-read-json.js +31 -0
- package/.auroq-core/core/synapse/diagnostics/collectors/session-collector.js +102 -0
- package/.auroq-core/core/synapse/diagnostics/collectors/timing-collector.js +126 -0
- package/.auroq-core/core/synapse/diagnostics/collectors/uap-collector.js +83 -0
- package/.auroq-core/core/synapse/diagnostics/report-formatter.js +484 -0
- package/.auroq-core/core/synapse/diagnostics/synapse-diagnostics.js +95 -0
- package/.auroq-core/core/synapse/domain/domain-loader.js +322 -0
- package/.auroq-core/core/synapse/engine.js +400 -0
- package/.auroq-core/core/synapse/layers/l0-constitution.js +80 -0
- package/.auroq-core/core/synapse/layers/l1-global.js +102 -0
- package/.auroq-core/core/synapse/layers/l2-agent.js +94 -0
- package/.auroq-core/core/synapse/layers/l3-workflow.js +94 -0
- package/.auroq-core/core/synapse/layers/l4-task.js +83 -0
- package/.auroq-core/core/synapse/layers/l5-squad.js +244 -0
- package/.auroq-core/core/synapse/layers/l6-keyword.js +154 -0
- package/.auroq-core/core/synapse/layers/l7-star-command.js +169 -0
- package/.auroq-core/core/synapse/layers/layer-processor.js +82 -0
- package/.auroq-core/core/synapse/memory/memory-bridge.js +220 -0
- package/.auroq-core/core/synapse/memory/synapse-memory-provider.js +201 -0
- package/.auroq-core/core/synapse/output/formatter.js +561 -0
- package/.auroq-core/core/synapse/runtime/hook-runtime.js +98 -0
- package/.auroq-core/core/synapse/scripts/generate-constitution.js +204 -0
- package/.auroq-core/core/synapse/session/session-manager.js +404 -0
- package/.auroq-core/core/synapse/utils/atomic-write.js +79 -0
- package/.auroq-core/core/synapse/utils/paths.js +57 -0
- package/.auroq-core/core/synapse/utils/tokens.js +25 -0
- package/.auroq-core/core-config.yaml +80 -0
- package/.auroq-core/development/sistema-gestao-projetos.md +193 -0
- package/.auroq-core/development/sistema-memoria.md +157 -0
- package/.auroq-core/dna-operacional.md +134 -0
- package/.claude/CLAUDE.md +399 -0
- package/.claude/commands/AuroqOS/agents/forge.md +374 -0
- package/.claude/commands/AuroqOS/agents/ops.md +277 -0
- package/.claude/commands/companion.md +7 -0
- package/.claude/hooks/precompact-session-digest.cjs +46 -0
- package/.claude/hooks/synapse-engine.cjs +99 -0
- package/.claude/rules/agent-authority.md +79 -0
- package/.claude/rules/agent-handoff.md +97 -0
- package/.claude/rules/commit-inteligente.md +86 -0
- package/.claude/rules/dna-operacional.md +53 -0
- package/.claude/rules/evolucao-incremental.md +43 -0
- package/.claude/rules/mcp-usage.md +38 -0
- package/.claude/rules/memoria-inteligente.md +65 -0
- package/.claude/rules/project-tracker.md +49 -0
- package/.claude/rules/tool-response-filtering.md +57 -0
- package/.claude/settings.json +1 -0
- package/.claude/settings.local.json +33 -0
- package/.env.example +22 -0
- package/.gitignore +23 -0
- package/.synapse/constitution +21 -0
- package/.synapse/context +8 -0
- package/.synapse/global +10 -0
- package/.synapse/manifest +35 -0
- package/README.md +67 -0
- package/agents/companion/agents/companion.md +306 -0
- package/agents/companion/data/contexto-dinamico.md +23 -0
- package/agents/companion/data/demandas-backlog.md +19 -0
- package/agents/companion/data/log-decisoes.md +11 -0
- package/agents/companion/data/padroes-observados.md +10 -0
- package/agents/companion/knowledge/companion-foundation.md +49 -0
- package/agents/companion/knowledge/expert-essencial.md +30 -0
- package/agents/companion/knowledge/modus-operandi.md +161 -0
- package/agents/companion/tasks/new-project.md +111 -0
- package/agents/companion/tasks/save-memory.md +73 -0
- package/agents/companion/tasks/start.md +136 -0
- package/agents/companion/tasks/weekly-review.md +82 -0
- package/bin/auroq-os.js +346 -0
- package/business/campanhas/_template/BRIEFING.md +45 -0
- package/business/campanhas/_template/CHECKLIST.md +29 -0
- package/business/campanhas/_template/DIARIO.md +15 -0
- package/business/campanhas/_template/RETROVISOR.md +34 -0
- package/business/cockpit.md +72 -0
- package/business/templates/tracker-template.md +71 -0
- package/docs/knowledge/expert-business/posicionamento.md +27 -0
- package/docs/knowledge/expert-business/publico-alvo.md +39 -0
- package/docs/knowledge/expert-mind/historia.md +27 -0
- package/docs/knowledge/expert-mind/identidade.md +23 -0
- package/docs/knowledge/expert-mind/tom-de-voz.md +30 -0
- package/docs/knowledge/expert-mind/valores.md +32 -0
- package/package.json +26 -0
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Domain Loader + Manifest Parser
|
|
3
|
+
*
|
|
4
|
+
* Loads and parses the .synapse/manifest (KEY=VALUE format, CARL-compatible)
|
|
5
|
+
* and individual domain files. Provides the data foundation for all 8 SYNAPSE layers.
|
|
6
|
+
*
|
|
7
|
+
* @module core/synapse/domain/domain-loader
|
|
8
|
+
* @version 1.0.0
|
|
9
|
+
* @created Story SYN-1 - Domain Loader + Manifest Parser
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
const fs = require('fs');
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Known domain attribute suffixes (order matters — longest first to avoid partial matches)
|
|
16
|
+
*/
|
|
17
|
+
const KNOWN_SUFFIXES = [
|
|
18
|
+
'_WORKFLOW_TRIGGER',
|
|
19
|
+
'_AGENT_TRIGGER',
|
|
20
|
+
'_NON_NEGOTIABLE',
|
|
21
|
+
'_ALWAYS_ON',
|
|
22
|
+
'_EXCLUDE',
|
|
23
|
+
'_RECALL',
|
|
24
|
+
'_STATE',
|
|
25
|
+
];
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Global-level keys that are NOT domain attributes
|
|
29
|
+
*/
|
|
30
|
+
const GLOBAL_KEYS = ['DEVMODE', 'GLOBAL_EXCLUDE'];
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Parse the .synapse/manifest file (KEY=VALUE format)
|
|
34
|
+
*
|
|
35
|
+
* Supports all CARL-compatible domain attributes:
|
|
36
|
+
* - {DOMAIN}_STATE=active|inactive
|
|
37
|
+
* - {DOMAIN}_ALWAYS_ON=true
|
|
38
|
+
* - {DOMAIN}_NON_NEGOTIABLE=true
|
|
39
|
+
* - {DOMAIN}_AGENT_TRIGGER=agent_id
|
|
40
|
+
* - {DOMAIN}_WORKFLOW_TRIGGER=workflow_id
|
|
41
|
+
* - {DOMAIN}_RECALL=keyword1,keyword2
|
|
42
|
+
* - {DOMAIN}_EXCLUDE=skip,ignore
|
|
43
|
+
* - DEVMODE=true|false
|
|
44
|
+
* - GLOBAL_EXCLUDE=skip,ignore
|
|
45
|
+
*
|
|
46
|
+
* @param {string} manifestPath - Absolute path to manifest file
|
|
47
|
+
* @returns {object} Parsed manifest with domains, devmode, and globalExclude
|
|
48
|
+
*/
|
|
49
|
+
function parseManifest(manifestPath) {
|
|
50
|
+
let content;
|
|
51
|
+
try {
|
|
52
|
+
content = fs.readFileSync(manifestPath, 'utf8');
|
|
53
|
+
} catch (_error) {
|
|
54
|
+
// Graceful degradation: missing manifest = empty config
|
|
55
|
+
return {
|
|
56
|
+
devmode: false,
|
|
57
|
+
globalExclude: [],
|
|
58
|
+
domains: {},
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const result = {
|
|
63
|
+
devmode: false,
|
|
64
|
+
globalExclude: [],
|
|
65
|
+
domains: {},
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
const lines = content.split(/\r?\n/);
|
|
69
|
+
|
|
70
|
+
for (const line of lines) {
|
|
71
|
+
const trimmed = line.trim();
|
|
72
|
+
|
|
73
|
+
// Skip empty lines and comments
|
|
74
|
+
if (!trimmed || trimmed.startsWith('#')) {
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// Split on first '=' only
|
|
79
|
+
const eqIndex = trimmed.indexOf('=');
|
|
80
|
+
if (eqIndex === -1) {
|
|
81
|
+
continue; // Malformed line — skip silently
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const key = trimmed.substring(0, eqIndex).trim();
|
|
85
|
+
const value = trimmed.substring(eqIndex + 1).trim();
|
|
86
|
+
|
|
87
|
+
if (!key) {
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// Handle global keys
|
|
92
|
+
if (key === 'DEVMODE') {
|
|
93
|
+
result.devmode = value.toLowerCase() === 'true';
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if (key === 'GLOBAL_EXCLUDE') {
|
|
98
|
+
result.globalExclude = parseCommaSeparated(value);
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// Extract domain name and attribute suffix
|
|
103
|
+
const { domainName, suffix } = extractDomainInfo(key);
|
|
104
|
+
|
|
105
|
+
if (!domainName) {
|
|
106
|
+
continue; // Unknown key format — skip
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// Ensure domain entry exists
|
|
110
|
+
if (!result.domains[domainName]) {
|
|
111
|
+
result.domains[domainName] = {
|
|
112
|
+
file: domainNameToFile(domainName),
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const domain = result.domains[domainName];
|
|
117
|
+
|
|
118
|
+
// Apply attribute based on suffix
|
|
119
|
+
switch (suffix) {
|
|
120
|
+
case '_STATE':
|
|
121
|
+
domain.state = value.toLowerCase();
|
|
122
|
+
break;
|
|
123
|
+
case '_ALWAYS_ON':
|
|
124
|
+
domain.alwaysOn = value.toLowerCase() === 'true';
|
|
125
|
+
break;
|
|
126
|
+
case '_NON_NEGOTIABLE':
|
|
127
|
+
domain.nonNegotiable = value.toLowerCase() === 'true';
|
|
128
|
+
break;
|
|
129
|
+
case '_AGENT_TRIGGER':
|
|
130
|
+
domain.agentTrigger = value;
|
|
131
|
+
break;
|
|
132
|
+
case '_WORKFLOW_TRIGGER':
|
|
133
|
+
domain.workflowTrigger = value;
|
|
134
|
+
break;
|
|
135
|
+
case '_RECALL':
|
|
136
|
+
domain.recall = parseCommaSeparated(value);
|
|
137
|
+
break;
|
|
138
|
+
case '_EXCLUDE':
|
|
139
|
+
domain.exclude = parseCommaSeparated(value);
|
|
140
|
+
break;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
return result;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Load a domain file and extract rules
|
|
149
|
+
*
|
|
150
|
+
* Supports two formats:
|
|
151
|
+
* 1. KEY=VALUE format: DOMAIN_RULE_N=text (extracts text)
|
|
152
|
+
* 2. Plain text format: each non-empty, non-comment line is a rule
|
|
153
|
+
*
|
|
154
|
+
* @param {string} domainPath - Absolute path to domain file
|
|
155
|
+
* @returns {string[]} Array of rule strings (empty array if file missing)
|
|
156
|
+
*/
|
|
157
|
+
function loadDomainFile(domainPath) {
|
|
158
|
+
let content;
|
|
159
|
+
try {
|
|
160
|
+
content = fs.readFileSync(domainPath, 'utf8');
|
|
161
|
+
} catch (_error) {
|
|
162
|
+
return []; // Graceful: missing file = empty rules
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
const lines = content.split(/\r?\n/);
|
|
166
|
+
const rules = [];
|
|
167
|
+
let hasKeyValueFormat = false;
|
|
168
|
+
|
|
169
|
+
// First pass: detect if file uses KEY=VALUE format
|
|
170
|
+
for (const line of lines) {
|
|
171
|
+
const trimmed = line.trim();
|
|
172
|
+
if (trimmed && !trimmed.startsWith('#') && /^[A-Z][A-Z0-9_]*=/.test(trimmed)) {
|
|
173
|
+
hasKeyValueFormat = true;
|
|
174
|
+
break;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
for (const line of lines) {
|
|
179
|
+
const trimmed = line.trim();
|
|
180
|
+
|
|
181
|
+
// Skip empty lines and comments
|
|
182
|
+
if (!trimmed || trimmed.startsWith('#')) {
|
|
183
|
+
continue;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
if (hasKeyValueFormat) {
|
|
187
|
+
// KEY=VALUE format: extract value from DOMAIN_RULE_N=text
|
|
188
|
+
const match = trimmed.match(/^[A-Z][A-Z0-9_]*=(.+)$/);
|
|
189
|
+
if (match) {
|
|
190
|
+
rules.push(match[1].trim());
|
|
191
|
+
}
|
|
192
|
+
} else {
|
|
193
|
+
// Plain text format: each line is a rule
|
|
194
|
+
rules.push(trimmed);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
return rules;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Check if a prompt should be excluded based on exclusion keywords
|
|
203
|
+
*
|
|
204
|
+
* @param {string} prompt - The user prompt to check
|
|
205
|
+
* @param {string[]} globalExcludes - Global exclusion keywords
|
|
206
|
+
* @param {string[]} domainExcludes - Per-domain exclusion keywords
|
|
207
|
+
* @returns {boolean} True if prompt should be excluded
|
|
208
|
+
*/
|
|
209
|
+
function isExcluded(prompt, globalExcludes = [], domainExcludes = []) {
|
|
210
|
+
if (!prompt) {
|
|
211
|
+
return false;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
const promptLower = prompt.toLowerCase();
|
|
215
|
+
const allExcludes = [...globalExcludes, ...domainExcludes];
|
|
216
|
+
|
|
217
|
+
for (const keyword of allExcludes) {
|
|
218
|
+
if (!keyword) {
|
|
219
|
+
continue;
|
|
220
|
+
}
|
|
221
|
+
// Escape regex special characters in keyword
|
|
222
|
+
const escaped = keyword.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
223
|
+
const regex = new RegExp(escaped, 'i');
|
|
224
|
+
if (regex.test(promptLower)) {
|
|
225
|
+
return true;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
return false;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Check if a prompt matches any recall keywords
|
|
234
|
+
*
|
|
235
|
+
* @param {string} prompt - The user prompt to check
|
|
236
|
+
* @param {string[]} recallKeywords - Array of keywords to match
|
|
237
|
+
* @returns {boolean} True if prompt matches any keyword
|
|
238
|
+
*/
|
|
239
|
+
function matchKeywords(prompt, recallKeywords = []) {
|
|
240
|
+
if (!prompt || recallKeywords.length === 0) {
|
|
241
|
+
return false;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
const promptLower = prompt.toLowerCase();
|
|
245
|
+
|
|
246
|
+
for (const keyword of recallKeywords) {
|
|
247
|
+
if (!keyword) {
|
|
248
|
+
continue;
|
|
249
|
+
}
|
|
250
|
+
// Escape regex special characters in keyword
|
|
251
|
+
const escaped = keyword.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
252
|
+
const regex = new RegExp(escaped, 'i');
|
|
253
|
+
if (regex.test(promptLower)) {
|
|
254
|
+
return true;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
return false;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* Extract domain name and suffix from a manifest key
|
|
263
|
+
*
|
|
264
|
+
* Logic:
|
|
265
|
+
* 1. Try each known suffix (longest first)
|
|
266
|
+
* 2. If suffix matches, the remainder is the domain name
|
|
267
|
+
* 3. If no suffix matches, skip the key
|
|
268
|
+
*
|
|
269
|
+
* @param {string} key - Manifest key (e.g., 'AGENT_DEV_STATE')
|
|
270
|
+
* @returns {{ domainName: string|null, suffix: string|null }}
|
|
271
|
+
*/
|
|
272
|
+
function extractDomainInfo(key) {
|
|
273
|
+
for (const suffix of KNOWN_SUFFIXES) {
|
|
274
|
+
if (key.endsWith(suffix)) {
|
|
275
|
+
const domainName = key.substring(0, key.length - suffix.length);
|
|
276
|
+
if (domainName) {
|
|
277
|
+
return { domainName, suffix };
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
return { domainName: null, suffix: null };
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* Convert domain name to file name
|
|
287
|
+
*
|
|
288
|
+
* Pattern: uppercase with underscores -> lowercase with hyphens
|
|
289
|
+
* Example: AGENT_DEV -> agent-dev, WORKFLOW_STORY_DEV -> workflow-story-dev
|
|
290
|
+
*
|
|
291
|
+
* @param {string} domainName - Domain name in UPPERCASE_SNAKE
|
|
292
|
+
* @returns {string} File name in lowercase-kebab
|
|
293
|
+
*/
|
|
294
|
+
function domainNameToFile(domainName) {
|
|
295
|
+
return domainName.toLowerCase().replace(/_/g, '-');
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* Parse comma-separated values into trimmed array
|
|
300
|
+
*
|
|
301
|
+
* @param {string} value - Comma-separated string
|
|
302
|
+
* @returns {string[]} Array of trimmed non-empty values
|
|
303
|
+
*/
|
|
304
|
+
function parseCommaSeparated(value) {
|
|
305
|
+
if (!value) {
|
|
306
|
+
return [];
|
|
307
|
+
}
|
|
308
|
+
return value.split(',')
|
|
309
|
+
.map(item => item.trim())
|
|
310
|
+
.filter(item => item.length > 0);
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
module.exports = {
|
|
314
|
+
parseManifest,
|
|
315
|
+
loadDomainFile,
|
|
316
|
+
isExcluded,
|
|
317
|
+
matchKeywords,
|
|
318
|
+
extractDomainInfo,
|
|
319
|
+
domainNameToFile,
|
|
320
|
+
KNOWN_SUFFIXES,
|
|
321
|
+
GLOBAL_KEYS,
|
|
322
|
+
};
|