mirror of
https://github.com/PR0M3TH3AN/TORCH.git
synced 2026-10-27 07:51:52 +00:00
Refactor memory scripts and fix configuration for new installs
- Replaced fragile inline Node.js scripts in `torch-config.json` with dedicated modules: `scripts/memory/retrieve.mjs` and `scripts/memory/store.mjs`. - Updated `src/ops.mjs` initialization logic to dynamically configure `scheduler.memoryPolicyByCadence` with correct paths based on the installation directory. - Added default memory policy configuration to `torch-config.example.json` to guide users. - Injected `torch:memory:list` and `torch:memory:inspect` convenience scripts into the host `package.json` during `init`. - Removed legacy shell scripts (`run-memory-retrieval.sh`, `run-memory-store.sh`). - Verified memory scripts function correctly and pass linting. Co-authored-by: PR0M3TH3AN <[email protected]>
This commit is contained in:
1 parent
ea5229d5d7
commit
d23e6ff0b3
84 files changed
+263
-693
No files matched your search
@@ -1 +0,0 @@
|
||||
- Memory retrieval seed for daily :: ## Required startup + artifacts + memory + issue capture
|
||||
@@ -1 +0,0 @@
|
||||
MEMORY_RETRIEVED
|
||||
@@ -1 +0,0 @@
|
||||
MEMORY_STORED
|
||||
@@ -1 +0,0 @@
|
||||
- Memory retrieval seed for weekly :: ## Required startup + artifacts + memory + issue capture
|
||||
@@ -1 +0,0 @@
|
||||
MEMORY_RETRIEVED
|
||||
@@ -1 +0,0 @@
|
||||
MEMORY_STORED
|
||||
@@ -1,15 +0,0 @@
|
||||
{
|
||||
"cadence": "daily",
|
||||
"operation": "retrieve",
|
||||
"servicePath": "src/services/memory/index.js#getRelevantMemories",
|
||||
"inputs": {
|
||||
"agentId": "scheduler-memory-daily",
|
||||
"query": "scheduler daily memory retrieval",
|
||||
"events": 1
|
||||
},
|
||||
"outputs": {
|
||||
"ingestedCount": 1,
|
||||
"retrievedCount": 1
|
||||
},
|
||||
"status": "ok"
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
MEMORY_RETRIEVED
|
||||
@@ -1,18 +0,0 @@
|
||||
{
|
||||
"cadence": "daily",
|
||||
"operation": "retrieve",
|
||||
"runId": "run-protocol-research-daily-1",
|
||||
"servicePath": "src/services/memory/index.js#getRelevantMemories",
|
||||
"inputs": {
|
||||
"agentId": "protocol-research-agent",
|
||||
"promptPath": "src/prompts/daily/protocol-research-agent.md",
|
||||
"promptIntent": "## Required startup + artifacts + memory + issue capture",
|
||||
"query": "scheduler | daily | agent | protocol-research-agent | intent | Required startup + artifacts + memory + issue capture",
|
||||
"events": 1
|
||||
},
|
||||
"outputs": {
|
||||
"ingestedCount": 1,
|
||||
"retrievedCount": 1
|
||||
},
|
||||
"status": "ok"
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
MEMORY_RETRIEVED
|
||||
@@ -1,19 +0,0 @@
|
||||
{
|
||||
"cadence": "daily",
|
||||
"operation": "store",
|
||||
"runId": "run-protocol-research-daily-1",
|
||||
"servicePath": "src/services/memory/index.js#ingestEvents",
|
||||
"inputs": {
|
||||
"agentId": "protocol-research-agent",
|
||||
"promptPath": "src/prompts/daily/protocol-research-agent.md",
|
||||
"promptIntent": "## Required startup + artifacts + memory + issue capture",
|
||||
"events": 2
|
||||
},
|
||||
"outputs": {
|
||||
"storedCount": 1,
|
||||
"summaries": [
|
||||
"Store memory event A for daily :: ## Required startup + artifacts + memory + issue capture Store memory event B for daily :: ## Required startup + artifacts + memory + issue capture"
|
||||
]
|
||||
},
|
||||
"status": "ok"
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
MEMORY_STORED
|
||||
@@ -1,18 +0,0 @@
|
||||
{
|
||||
"cadence": "daily",
|
||||
"operation": "retrieve",
|
||||
"runId": "session-1771179533",
|
||||
"servicePath": "src/services/memory/index.js#getRelevantMemories",
|
||||
"inputs": {
|
||||
"agentId": "torch-garbage-collection-agent",
|
||||
"promptPath": "src/prompts/daily/torch-garbage-collection-agent.md",
|
||||
"promptIntent": "## Required startup + artifacts + memory + issue capture",
|
||||
"query": "scheduler | daily | agent | torch-garbage-collection-agent | intent | Required startup + artifacts + memory + issue capture",
|
||||
"events": 1
|
||||
},
|
||||
"outputs": {
|
||||
"ingestedCount": 1,
|
||||
"retrievedCount": 1
|
||||
},
|
||||
"status": "ok"
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
MEMORY_RETRIEVED
|
||||
@@ -1,18 +0,0 @@
|
||||
{
|
||||
"cadence": "daily",
|
||||
"operation": "retrieve",
|
||||
"runId": "session-1771182629",
|
||||
"servicePath": "src/services/memory/index.js#getRelevantMemories",
|
||||
"inputs": {
|
||||
"agentId": "ci-health-agent",
|
||||
"promptPath": "src/prompts/daily/ci-health-agent.md",
|
||||
"promptIntent": "## Required startup + artifacts + memory + issue capture",
|
||||
"query": "scheduler | daily | agent | ci-health-agent | intent | Required startup + artifacts + memory + issue capture",
|
||||
"events": 1
|
||||
},
|
||||
"outputs": {
|
||||
"ingestedCount": 1,
|
||||
"retrievedCount": 1
|
||||
},
|
||||
"status": "ok"
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
MEMORY_RETRIEVED
|
||||
@@ -1,19 +0,0 @@
|
||||
{
|
||||
"cadence": "daily",
|
||||
"operation": "store",
|
||||
"runId": "session-1771182887",
|
||||
"servicePath": "src/services/memory/index.js#ingestEvents",
|
||||
"inputs": {
|
||||
"agentId": "ci-health-agent",
|
||||
"promptPath": "src/prompts/daily/ci-health-agent.md",
|
||||
"promptIntent": "## Required startup + artifacts + memory + issue capture",
|
||||
"events": 2
|
||||
},
|
||||
"outputs": {
|
||||
"storedCount": 1,
|
||||
"summaries": [
|
||||
"Store memory event A for daily :: ## Required startup + artifacts + memory + issue capture Store memory event B for daily :: ## Required startup + artifacts + memory + issue capture"
|
||||
]
|
||||
},
|
||||
"status": "ok"
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
MEMORY_STORED
|
||||
@@ -1,18 +0,0 @@
|
||||
{
|
||||
"cadence": "daily",
|
||||
"operation": "retrieve",
|
||||
"runId": "session-2026-02-15T08-00-00Z",
|
||||
"servicePath": "src/services/memory/index.js#getRelevantMemories",
|
||||
"inputs": {
|
||||
"agentId": "scheduler-update-agent",
|
||||
"promptPath": "src/prompts/daily/scheduler-update-agent.md",
|
||||
"promptIntent": "## Required startup + artifacts + memory + issue capture",
|
||||
"query": "scheduler | daily | agent | scheduler-update-agent | intent | Required startup + artifacts + memory + issue capture",
|
||||
"events": 1
|
||||
},
|
||||
"outputs": {
|
||||
"ingestedCount": 1,
|
||||
"retrievedCount": 1
|
||||
},
|
||||
"status": "ok"
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
MEMORY_RETRIEVED
|
||||
@@ -1,19 +0,0 @@
|
||||
{
|
||||
"cadence": "daily",
|
||||
"operation": "store",
|
||||
"runId": "session-2026-02-15T08-00-00Z",
|
||||
"servicePath": "src/services/memory/index.js#ingestEvents",
|
||||
"inputs": {
|
||||
"agentId": "scheduler-update-agent",
|
||||
"promptPath": "src/prompts/daily/scheduler-update-agent.md",
|
||||
"promptIntent": "## Required startup + artifacts + memory + issue capture",
|
||||
"events": 2
|
||||
},
|
||||
"outputs": {
|
||||
"storedCount": 1,
|
||||
"summaries": [
|
||||
"Store memory event A for daily :: ## Required startup + artifacts + memory + issue capture Store memory event B for daily :: ## Required startup + artifacts + memory + issue capture"
|
||||
]
|
||||
},
|
||||
"status": "ok"
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
MEMORY_STORED
|
||||
@@ -1,18 +0,0 @@
|
||||
{
|
||||
"cadence": "daily",
|
||||
"operation": "retrieve",
|
||||
"runId": "session-20260215T010331Z",
|
||||
"servicePath": "src/services/memory/index.js#getRelevantMemories",
|
||||
"inputs": {
|
||||
"agentId": "onboarding-audit-agent",
|
||||
"promptPath": "src/prompts/daily/onboarding-audit-agent.md",
|
||||
"promptIntent": "## Required startup + artifacts + memory + issue capture",
|
||||
"query": "scheduler | daily | agent | onboarding-audit-agent | intent | Required startup + artifacts + memory + issue capture",
|
||||
"events": 1
|
||||
},
|
||||
"outputs": {
|
||||
"ingestedCount": 1,
|
||||
"retrievedCount": 1
|
||||
},
|
||||
"status": "ok"
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
MEMORY_RETRIEVED
|
||||
@@ -1,19 +0,0 @@
|
||||
{
|
||||
"cadence": "daily",
|
||||
"operation": "store",
|
||||
"runId": "session-20260215T010331Z",
|
||||
"servicePath": "src/services/memory/index.js#ingestEvents",
|
||||
"inputs": {
|
||||
"agentId": "onboarding-audit-agent",
|
||||
"promptPath": "src/prompts/daily/onboarding-audit-agent.md",
|
||||
"promptIntent": "## Required startup + artifacts + memory + issue capture",
|
||||
"events": 2
|
||||
},
|
||||
"outputs": {
|
||||
"storedCount": 1,
|
||||
"summaries": [
|
||||
"Store memory event A for daily :: ## Required startup + artifacts + memory + issue capture Store memory event B for daily :: ## Required startup + artifacts + memory + issue capture"
|
||||
]
|
||||
},
|
||||
"status": "ok"
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
MEMORY_STORED
|
||||
@@ -1,18 +0,0 @@
|
||||
{
|
||||
"cadence": "daily",
|
||||
"operation": "retrieve",
|
||||
"runId": "session-daily-todo-triage-1771179464",
|
||||
"servicePath": "src/services/memory/index.js#getRelevantMemories",
|
||||
"inputs": {
|
||||
"agentId": "todo-triage-agent",
|
||||
"promptPath": "src/prompts/daily/todo-triage-agent.md",
|
||||
"promptIntent": "## Required startup + artifacts + memory + issue capture",
|
||||
"query": "scheduler | daily | agent | todo-triage-agent | intent | Required startup + artifacts + memory + issue capture",
|
||||
"events": 1
|
||||
},
|
||||
"outputs": {
|
||||
"ingestedCount": 1,
|
||||
"retrievedCount": 1
|
||||
},
|
||||
"status": "ok"
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
MEMORY_RETRIEVED
|
||||
@@ -1,19 +0,0 @@
|
||||
{
|
||||
"cadence": "daily",
|
||||
"operation": "store",
|
||||
"runId": "session-daily-todo-triage-1771179464",
|
||||
"servicePath": "src/services/memory/index.js#ingestEvents",
|
||||
"inputs": {
|
||||
"agentId": "todo-triage-agent",
|
||||
"promptPath": "src/prompts/daily/todo-triage-agent.md",
|
||||
"promptIntent": "## Required startup + artifacts + memory + issue capture",
|
||||
"events": 2
|
||||
},
|
||||
"outputs": {
|
||||
"storedCount": 1,
|
||||
"summaries": [
|
||||
"Store memory event A for daily :: ## Required startup + artifacts + memory + issue capture Store memory event B for daily :: ## Required startup + artifacts + memory + issue capture"
|
||||
]
|
||||
},
|
||||
"status": "ok"
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
MEMORY_STORED
|
||||
@@ -1,18 +0,0 @@
|
||||
{
|
||||
"cadence": "daily",
|
||||
"operation": "retrieve",
|
||||
"runId": "session-mlmz4wmm",
|
||||
"servicePath": "src/services/memory/index.js#getRelevantMemories",
|
||||
"inputs": {
|
||||
"agentId": "load-test-agent",
|
||||
"promptPath": "src/prompts/daily/load-test-agent.md",
|
||||
"promptIntent": "## Required startup + artifacts + memory + issue capture",
|
||||
"query": "scheduler | daily | agent | load-test-agent | intent | Required startup + artifacts + memory + issue capture",
|
||||
"events": 1
|
||||
},
|
||||
"outputs": {
|
||||
"ingestedCount": 1,
|
||||
"retrievedCount": 1
|
||||
},
|
||||
"status": "ok"
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
MEMORY_RETRIEVED
|
||||
@@ -1,19 +0,0 @@
|
||||
{
|
||||
"cadence": "daily",
|
||||
"operation": "store",
|
||||
"runId": "session-mlmz67os",
|
||||
"servicePath": "src/services/memory/index.js#ingestEvents",
|
||||
"inputs": {
|
||||
"agentId": "load-test-agent",
|
||||
"promptPath": "src/prompts/daily/load-test-agent.md",
|
||||
"promptIntent": "## Required startup + artifacts + memory + issue capture",
|
||||
"events": 2
|
||||
},
|
||||
"outputs": {
|
||||
"storedCount": 1,
|
||||
"summaries": [
|
||||
"Store memory event A for daily :: ## Required startup + artifacts + memory + issue capture Store memory event B for daily :: ## Required startup + artifacts + memory + issue capture"
|
||||
]
|
||||
},
|
||||
"status": "ok"
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
MEMORY_STORED
|
||||
@@ -1,18 +0,0 @@
|
||||
{
|
||||
"cadence": "daily",
|
||||
"operation": "retrieve",
|
||||
"runId": "session-mln28e1a",
|
||||
"servicePath": "src/services/memory/index.js#getRelevantMemories",
|
||||
"inputs": {
|
||||
"agentId": "perf-agent",
|
||||
"promptPath": "src/prompts/daily/perf-agent.md",
|
||||
"promptIntent": "## Required startup + artifacts + memory + issue capture",
|
||||
"query": "scheduler | daily | agent | perf-agent | intent | Required startup + artifacts + memory + issue capture",
|
||||
"events": 1
|
||||
},
|
||||
"outputs": {
|
||||
"ingestedCount": 1,
|
||||
"retrievedCount": 1
|
||||
},
|
||||
"status": "ok"
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
MEMORY_RETRIEVED
|
||||
@@ -1,19 +0,0 @@
|
||||
{
|
||||
"cadence": "daily",
|
||||
"operation": "store",
|
||||
"runId": "session-mln2aef9",
|
||||
"servicePath": "src/services/memory/index.js#ingestEvents",
|
||||
"inputs": {
|
||||
"agentId": "perf-agent",
|
||||
"promptPath": "src/prompts/daily/perf-agent.md",
|
||||
"promptIntent": "## Required startup + artifacts + memory + issue capture",
|
||||
"events": 2
|
||||
},
|
||||
"outputs": {
|
||||
"storedCount": 1,
|
||||
"summaries": [
|
||||
"Store memory event A for daily :: ## Required startup + artifacts + memory + issue capture Store memory event B for daily :: ## Required startup + artifacts + memory + issue capture"
|
||||
]
|
||||
},
|
||||
"status": "ok"
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
MEMORY_STORED
|
||||
@@ -1,18 +0,0 @@
|
||||
{
|
||||
"cadence": "weekly",
|
||||
"operation": "retrieve",
|
||||
"runId": "session-mln2x0te",
|
||||
"servicePath": "src/services/memory/index.js#getRelevantMemories",
|
||||
"inputs": {
|
||||
"agentId": "prompt-safety-agent",
|
||||
"promptPath": "src/prompts/weekly/prompt-safety-agent.md",
|
||||
"promptIntent": "## Required startup + artifacts + memory + issue capture",
|
||||
"query": "scheduler | weekly | agent | prompt-safety-agent | intent | Required startup + artifacts + memory + issue capture",
|
||||
"events": 1
|
||||
},
|
||||
"outputs": {
|
||||
"ingestedCount": 1,
|
||||
"retrievedCount": 1
|
||||
},
|
||||
"status": "ok"
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
MEMORY_RETRIEVED
|
||||
@@ -1,19 +0,0 @@
|
||||
{
|
||||
"cadence": "weekly",
|
||||
"operation": "store",
|
||||
"runId": "session-mln2ytlb",
|
||||
"servicePath": "src/services/memory/index.js#ingestEvents",
|
||||
"inputs": {
|
||||
"agentId": "prompt-safety-agent",
|
||||
"promptPath": "src/prompts/weekly/prompt-safety-agent.md",
|
||||
"promptIntent": "## Required startup + artifacts + memory + issue capture",
|
||||
"events": 2
|
||||
},
|
||||
"outputs": {
|
||||
"storedCount": 1,
|
||||
"summaries": [
|
||||
"Store memory event A for weekly :: ## Required startup + artifacts + memory + issue capture Store memory event B for weekly :: ## Required startup + artifacts + memory + issue capture"
|
||||
]
|
||||
},
|
||||
"status": "ok"
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
MEMORY_STORED
|
||||
@@ -1,18 +0,0 @@
|
||||
{
|
||||
"cadence": "weekly",
|
||||
"operation": "retrieve",
|
||||
"runId": "session-mlna5hvm",
|
||||
"servicePath": "src/services/memory/index.js#getRelevantMemories",
|
||||
"inputs": {
|
||||
"agentId": "prompt-fixer-agent",
|
||||
"promptPath": "src/prompts/weekly/prompt-fixer-agent.md",
|
||||
"promptIntent": "## Required startup + artifacts + memory + issue capture",
|
||||
"query": "scheduler | weekly | agent | prompt-fixer-agent | intent | Required startup + artifacts + memory + issue capture",
|
||||
"events": 1
|
||||
},
|
||||
"outputs": {
|
||||
"ingestedCount": 1,
|
||||
"retrievedCount": 1
|
||||
},
|
||||
"status": "ok"
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
MEMORY_RETRIEVED
|
||||
@@ -1,19 +0,0 @@
|
||||
{
|
||||
"cadence": "weekly",
|
||||
"operation": "store",
|
||||
"runId": "session-mlnaaq43",
|
||||
"servicePath": "src/services/memory/index.js#ingestEvents",
|
||||
"inputs": {
|
||||
"agentId": "prompt-fixer-agent",
|
||||
"promptPath": "src/prompts/weekly/prompt-fixer-agent.md",
|
||||
"promptIntent": "## Required startup + artifacts + memory + issue capture",
|
||||
"events": 2
|
||||
},
|
||||
"outputs": {
|
||||
"storedCount": 1,
|
||||
"summaries": [
|
||||
"Store memory event A for weekly :: ## Required startup + artifacts + memory + issue capture Store memory event B for weekly :: ## Required startup + artifacts + memory + issue capture"
|
||||
]
|
||||
},
|
||||
"status": "ok"
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
MEMORY_STORED
|
||||
@@ -1,18 +0,0 @@
|
||||
{
|
||||
"cadence": "weekly",
|
||||
"operation": "retrieve",
|
||||
"runId": "session-mlnw868c",
|
||||
"servicePath": "src/services/memory/index.js#getRelevantMemories",
|
||||
"inputs": {
|
||||
"agentId": "race-condition-agent",
|
||||
"promptPath": "src/prompts/weekly/race-condition-agent.md",
|
||||
"promptIntent": "## Required startup + artifacts + memory + issue capture",
|
||||
"query": "scheduler | weekly | agent | race-condition-agent | intent | Required startup + artifacts + memory + issue capture",
|
||||
"events": 1
|
||||
},
|
||||
"outputs": {
|
||||
"ingestedCount": 1,
|
||||
"retrievedCount": 1
|
||||
},
|
||||
"status": "ok"
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
MEMORY_RETRIEVED
|
||||
@@ -1,19 +0,0 @@
|
||||
{
|
||||
"cadence": "weekly",
|
||||
"operation": "store",
|
||||
"runId": "session-mlnwbg1h",
|
||||
"servicePath": "src/services/memory/index.js#ingestEvents",
|
||||
"inputs": {
|
||||
"agentId": "race-condition-agent",
|
||||
"promptPath": "src/prompts/weekly/race-condition-agent.md",
|
||||
"promptIntent": "## Required startup + artifacts + memory + issue capture",
|
||||
"events": 2
|
||||
},
|
||||
"outputs": {
|
||||
"storedCount": 1,
|
||||
"summaries": [
|
||||
"Store memory event A for weekly :: ## Required startup + artifacts + memory + issue capture Store memory event B for weekly :: ## Required startup + artifacts + memory + issue capture"
|
||||
]
|
||||
},
|
||||
"status": "ok"
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
MEMORY_STORED
|
||||
@@ -1,18 +0,0 @@
|
||||
{
|
||||
"cadence": "weekly",
|
||||
"operation": "retrieve",
|
||||
"runId": "session-mlnww6r0",
|
||||
"servicePath": "src/services/memory/index.js#getRelevantMemories",
|
||||
"inputs": {
|
||||
"agentId": "refactor-agent",
|
||||
"promptPath": "",
|
||||
"promptIntent": "scheduler memory retrieval",
|
||||
"query": "scheduler | weekly | agent | refactor-agent | intent | scheduler memory retrieval",
|
||||
"events": 1
|
||||
},
|
||||
"outputs": {
|
||||
"ingestedCount": 1,
|
||||
"retrievedCount": 1
|
||||
},
|
||||
"status": "ok"
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
MEMORY_RETRIEVED
|
||||
@@ -1,18 +0,0 @@
|
||||
{
|
||||
"cadence": "daily",
|
||||
"operation": "retrieve",
|
||||
"runId": "session-mlnwwayl",
|
||||
"servicePath": "src/services/memory/index.js#getRelevantMemories",
|
||||
"inputs": {
|
||||
"agentId": "style-agent",
|
||||
"promptPath": "src/prompts/daily/style-agent.md",
|
||||
"promptIntent": "## Required startup + artifacts + memory + issue capture",
|
||||
"query": "scheduler | daily | agent | style-agent | intent | Required startup + artifacts + memory + issue capture",
|
||||
"events": 1
|
||||
},
|
||||
"outputs": {
|
||||
"ingestedCount": 1,
|
||||
"retrievedCount": 1
|
||||
},
|
||||
"status": "ok"
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
MEMORY_RETRIEVED
|
||||
@@ -1,19 +0,0 @@
|
||||
{
|
||||
"cadence": "daily",
|
||||
"operation": "store",
|
||||
"runId": "session-mlnwyq3d",
|
||||
"servicePath": "src/services/memory/index.js#ingestEvents",
|
||||
"inputs": {
|
||||
"agentId": "style-agent",
|
||||
"promptPath": "src/prompts/daily/style-agent.md",
|
||||
"promptIntent": "## Required startup + artifacts + memory + issue capture",
|
||||
"events": 2
|
||||
},
|
||||
"outputs": {
|
||||
"storedCount": 1,
|
||||
"summaries": [
|
||||
"Store memory event A for daily :: ## Required startup + artifacts + memory + issue capture Store memory event B for daily :: ## Required startup + artifacts + memory + issue capture"
|
||||
]
|
||||
},
|
||||
"status": "ok"
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
MEMORY_STORED
|
||||
@@ -1,19 +0,0 @@
|
||||
{
|
||||
"cadence": "weekly",
|
||||
"operation": "store",
|
||||
"runId": "session-mlnx056f",
|
||||
"servicePath": "src/services/memory/index.js#ingestEvents",
|
||||
"inputs": {
|
||||
"agentId": "refactor-agent",
|
||||
"promptPath": "",
|
||||
"promptIntent": "scheduler memory store",
|
||||
"events": 2
|
||||
},
|
||||
"outputs": {
|
||||
"storedCount": 1,
|
||||
"summaries": [
|
||||
"Store memory event A for weekly :: scheduler memory store Store memory event B for weekly :: scheduler memory store"
|
||||
]
|
||||
},
|
||||
"status": "ok"
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
MEMORY_STORED
|
||||
@@ -1,18 +0,0 @@
|
||||
{
|
||||
"cadence": "daily",
|
||||
"operation": "retrieve",
|
||||
"runId": "session-mlny4il2",
|
||||
"servicePath": "src/services/memory/index.js#getRelevantMemories",
|
||||
"inputs": {
|
||||
"agentId": "test-audit-agent",
|
||||
"promptPath": "src/prompts/daily/test-audit-agent.md",
|
||||
"promptIntent": "## Required startup + artifacts + memory + issue capture",
|
||||
"query": "scheduler | daily | agent | test-audit-agent | intent | Required startup + artifacts + memory + issue capture",
|
||||
"events": 1
|
||||
},
|
||||
"outputs": {
|
||||
"ingestedCount": 1,
|
||||
"retrievedCount": 1
|
||||
},
|
||||
"status": "ok"
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
MEMORY_RETRIEVED
|
||||
@@ -1,18 +0,0 @@
|
||||
{
|
||||
"cadence": "weekly",
|
||||
"operation": "retrieve",
|
||||
"runId": "session-mlny5syo",
|
||||
"servicePath": "src/services/memory/index.js#getRelevantMemories",
|
||||
"inputs": {
|
||||
"agentId": "scheduler-memory-weekly",
|
||||
"promptPath": "",
|
||||
"promptIntent": "scheduler memory retrieval",
|
||||
"query": "scheduler | weekly | agent | scheduler-memory-weekly | intent | scheduler memory retrieval",
|
||||
"events": 1
|
||||
},
|
||||
"outputs": {
|
||||
"ingestedCount": 1,
|
||||
"retrievedCount": 1
|
||||
},
|
||||
"status": "ok"
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
MEMORY_RETRIEVED
|
||||
@@ -1,19 +0,0 @@
|
||||
{
|
||||
"cadence": "weekly",
|
||||
"operation": "store",
|
||||
"runId": "session-mlny8900",
|
||||
"servicePath": "src/services/memory/index.js#ingestEvents",
|
||||
"inputs": {
|
||||
"agentId": "scheduler-memory-weekly",
|
||||
"promptPath": "",
|
||||
"promptIntent": "scheduler memory store",
|
||||
"events": 2
|
||||
},
|
||||
"outputs": {
|
||||
"storedCount": 1,
|
||||
"summaries": [
|
||||
"Store memory event A for weekly :: scheduler memory store Store memory event B for weekly :: scheduler memory store"
|
||||
]
|
||||
},
|
||||
"status": "ok"
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
MEMORY_STORED
|
||||
@@ -1,19 +0,0 @@
|
||||
{
|
||||
"cadence": "daily",
|
||||
"operation": "store",
|
||||
"runId": "session-mlnyc1lp",
|
||||
"servicePath": "src/services/memory/index.js#ingestEvents",
|
||||
"inputs": {
|
||||
"agentId": "test-audit-agent",
|
||||
"promptPath": "src/prompts/daily/test-audit-agent.md",
|
||||
"promptIntent": "## Required startup + artifacts + memory + issue capture",
|
||||
"events": 2
|
||||
},
|
||||
"outputs": {
|
||||
"storedCount": 1,
|
||||
"summaries": [
|
||||
"Store memory event A for daily :: ## Required startup + artifacts + memory + issue capture Store memory event B for daily :: ## Required startup + artifacts + memory + issue capture"
|
||||
]
|
||||
},
|
||||
"status": "ok"
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
MEMORY_STORED
|
||||
@@ -1,18 +0,0 @@
|
||||
{
|
||||
"cadence": "daily",
|
||||
"operation": "retrieve",
|
||||
"runId": "session-mlo3pco8",
|
||||
"servicePath": "src/services/memory/index.js#getRelevantMemories",
|
||||
"inputs": {
|
||||
"agentId": "audit-agent",
|
||||
"promptPath": "",
|
||||
"promptIntent": "scheduler memory retrieval",
|
||||
"query": "scheduler | daily | agent | audit-agent | intent | scheduler memory retrieval",
|
||||
"events": 1
|
||||
},
|
||||
"outputs": {
|
||||
"ingestedCount": 1,
|
||||
"retrievedCount": 1
|
||||
},
|
||||
"status": "ok"
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
MEMORY_RETRIEVED
|
||||
@@ -1,19 +0,0 @@
|
||||
{
|
||||
"cadence": "daily",
|
||||
"operation": "store",
|
||||
"runId": "session-mlo3shyo",
|
||||
"servicePath": "src/services/memory/index.js#ingestEvents",
|
||||
"inputs": {
|
||||
"agentId": "audit-agent",
|
||||
"promptPath": "",
|
||||
"promptIntent": "scheduler memory store",
|
||||
"events": 2
|
||||
},
|
||||
"outputs": {
|
||||
"storedCount": 1,
|
||||
"summaries": [
|
||||
"Store memory event A for daily :: scheduler memory store Store memory event B for daily :: scheduler memory store"
|
||||
]
|
||||
},
|
||||
"status": "ok"
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
MEMORY_STORED
|
||||
@@ -1,18 +0,0 @@
|
||||
{
|
||||
"cadence": "daily",
|
||||
"operation": "retrieve",
|
||||
"runId": "session-mlodav44",
|
||||
"servicePath": "src/services/memory/index.js#getRelevantMemories",
|
||||
"inputs": {
|
||||
"agentId": "decompose-agent",
|
||||
"promptPath": "src/prompts/daily/decompose-agent.md",
|
||||
"promptIntent": "## Required startup + artifacts + memory + issue capture",
|
||||
"query": "scheduler | daily | agent | decompose-agent | intent | Required startup + artifacts + memory + issue capture",
|
||||
"events": 1
|
||||
},
|
||||
"outputs": {
|
||||
"ingestedCount": 1,
|
||||
"retrievedCount": 1
|
||||
},
|
||||
"status": "ok"
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
MEMORY_RETRIEVED
|
||||
@@ -1,19 +0,0 @@
|
||||
{
|
||||
"cadence": "daily",
|
||||
"operation": "store",
|
||||
"runId": "session-mlodg95q",
|
||||
"servicePath": "src/services/memory/index.js#ingestEvents",
|
||||
"inputs": {
|
||||
"agentId": "decompose-agent",
|
||||
"promptPath": "src/prompts/daily/decompose-agent.md",
|
||||
"promptIntent": "## Required startup + artifacts + memory + issue capture",
|
||||
"events": 2
|
||||
},
|
||||
"outputs": {
|
||||
"storedCount": 1,
|
||||
"summaries": [
|
||||
"Store memory event A for daily :: ## Required startup + artifacts + memory + issue capture Store memory event B for daily :: ## Required startup + artifacts + memory + issue capture"
|
||||
]
|
||||
},
|
||||
"status": "ok"
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
MEMORY_STORED
|
||||
@@ -1,16 +0,0 @@
|
||||
{
|
||||
"cadence": "daily",
|
||||
"operation": "store",
|
||||
"servicePath": "src/services/memory/index.js#ingestEvents",
|
||||
"inputs": {
|
||||
"agentId": "scheduler-memory-daily",
|
||||
"events": 2
|
||||
},
|
||||
"outputs": {
|
||||
"storedCount": 1,
|
||||
"summaries": [
|
||||
"Store memory event A for daily Store memory event B for daily"
|
||||
]
|
||||
},
|
||||
"status": "ok"
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
MEMORY_STORED
|
||||
+3
-1
@@ -46,7 +46,9 @@
|
||||
"test:integration:e2e": "node --test test/scheduler-preflight-lock.e2e.test.mjs",
|
||||
"validate:scheduler-failure-schema": "node --test test/scheduler-lock-failure-schema.contract.test.mjs",
|
||||
"test:ci-resilience": "node --test test/lock-acquisition-resilience.integration.test.mjs",
|
||||
"test:extended-main": "npm run test:integration:e2e && npm run test:ci-resilience"
|
||||
"test:extended-main": "npm run test:integration:e2e && npm run test:ci-resilience",
|
||||
"torch:memory:list": "node bin/torch-lock.mjs list-memories",
|
||||
"torch:memory:inspect": "node bin/torch-lock.mjs inspect-memory"
|
||||
},
|
||||
"dependencies": {
|
||||
"nostr-tools": "2.19.4",
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
import { ingestEvents, getRelevantMemories } from '../../src/services/memory/index.js';
|
||||
import { mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
||||
import path from 'node:path';
|
||||
|
||||
// Parse environment variables
|
||||
const fallbackCadence = 'daily';
|
||||
const cadence = process.env.SCHEDULER_CADENCE || fallbackCadence;
|
||||
const agentId = process.env.SCHEDULER_AGENT || `scheduler-memory-${cadence}`;
|
||||
const promptPath = process.env.SCHEDULER_PROMPT_PATH || '';
|
||||
const runId = process.env.SCHEDULER_RUN_ID ||
|
||||
process.env.SCHEDULER_SESSION_ID ||
|
||||
process.env.RUN_ID ||
|
||||
`session-${Date.now().toString(36)}`;
|
||||
|
||||
// Extract prompt intent
|
||||
let promptIntent = `scheduler memory retrieval`;
|
||||
if (promptPath) {
|
||||
try {
|
||||
const promptRaw = readFileSync(promptPath, 'utf8');
|
||||
const promptLines = promptRaw.split(/\r?\n/).map(line => line.trim()).filter(Boolean);
|
||||
const intentLine = promptLines.find(line => line.startsWith('#') || line.toLowerCase().startsWith('goal'));
|
||||
if (intentLine) {
|
||||
promptIntent = intentLine.replace(/^#+\s*/, '');
|
||||
} else if (promptLines.length > 0) {
|
||||
promptIntent = promptLines[0];
|
||||
}
|
||||
} catch (err) {
|
||||
console.warn(`Could not read prompt file: ${promptPath}`, err.message);
|
||||
}
|
||||
}
|
||||
|
||||
// Construct query
|
||||
const query = ['scheduler', cadence, 'agent', agentId, 'intent', promptIntent].join(' | ');
|
||||
const timestamp = Date.now();
|
||||
|
||||
// Create retrieval seed event
|
||||
const events = [{
|
||||
agent_id: agentId,
|
||||
content: `Memory retrieval seed for ${cadence} :: ${promptIntent}`,
|
||||
timestamp,
|
||||
tags: ['scheduler', cadence, 'retrieve'],
|
||||
metadata: {
|
||||
session_id: runId,
|
||||
source: 'scheduler-retrieve',
|
||||
importance: 0.4,
|
||||
prompt_path: promptPath
|
||||
}
|
||||
}];
|
||||
|
||||
try {
|
||||
// 1. Ingest seed event
|
||||
const ingested = await ingestEvents(events, { agent_id: agentId });
|
||||
|
||||
// 2. Retrieve memories
|
||||
const retrieved = await getRelevantMemories({ agent_id: agentId, query, k: 5 });
|
||||
|
||||
// 3. Prepare artifacts
|
||||
const sessionDir = path.join('.scheduler-memory', runId);
|
||||
const latestDir = path.join('.scheduler-memory', 'latest', cadence);
|
||||
|
||||
mkdirSync(sessionDir, { recursive: true });
|
||||
mkdirSync(latestDir, { recursive: true });
|
||||
|
||||
const artifact = {
|
||||
cadence,
|
||||
operation: 'retrieve',
|
||||
runId,
|
||||
servicePath: 'src/services/memory/index.js#getRelevantMemories',
|
||||
inputs: {
|
||||
agentId,
|
||||
promptPath,
|
||||
promptIntent,
|
||||
query,
|
||||
events: events.length
|
||||
},
|
||||
outputs: {
|
||||
ingestedCount: ingested.length,
|
||||
retrievedCount: retrieved.length
|
||||
},
|
||||
status: 'ok'
|
||||
};
|
||||
|
||||
// 4. Write artifacts
|
||||
writeFileSync(path.join(sessionDir, 'retrieve.json'), JSON.stringify(artifact, null, 2));
|
||||
writeFileSync(path.join(sessionDir, 'retrieve.ok'), 'MEMORY_RETRIEVED\n');
|
||||
writeFileSync(path.join(latestDir, 'retrieve.ok'), 'MEMORY_RETRIEVED\n');
|
||||
writeFileSync(path.join(latestDir, 'memories.md'), retrieved.map(m => `- ${m.content}`).join('\n'));
|
||||
|
||||
// 5. Output success marker to stdout (for scheduler verification)
|
||||
console.log('MEMORY_RETRIEVED');
|
||||
} catch (error) {
|
||||
console.error('Memory retrieval failed:', error);
|
||||
process.exit(1);
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
import { ingestEvents } from '../../src/services/memory/index.js';
|
||||
import { mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
||||
import path from 'node:path';
|
||||
|
||||
// Parse environment variables
|
||||
const fallbackCadence = 'weekly';
|
||||
const cadence = process.env.SCHEDULER_CADENCE || fallbackCadence;
|
||||
const agentId = process.env.SCHEDULER_AGENT || `scheduler-memory-${cadence}`;
|
||||
const promptPath = process.env.SCHEDULER_PROMPT_PATH || '';
|
||||
const runId = process.env.SCHEDULER_RUN_ID ||
|
||||
process.env.SCHEDULER_SESSION_ID ||
|
||||
process.env.RUN_ID ||
|
||||
`session-${Date.now().toString(36)}`;
|
||||
|
||||
// Extract prompt intent
|
||||
let promptIntent = `scheduler memory store`;
|
||||
if (promptPath) {
|
||||
try {
|
||||
const promptRaw = readFileSync(promptPath, 'utf8');
|
||||
const promptLines = promptRaw.split(/\r?\n/).map(line => line.trim()).filter(Boolean);
|
||||
const intentLine = promptLines.find(line => line.startsWith('#') || line.toLowerCase().startsWith('goal'));
|
||||
if (intentLine) {
|
||||
promptIntent = intentLine.replace(/^#+\s*/, '');
|
||||
} else if (promptLines.length > 0) {
|
||||
promptIntent = promptLines[0];
|
||||
}
|
||||
} catch (err) {
|
||||
console.warn(`Could not read prompt file: ${promptPath}`, err.message);
|
||||
}
|
||||
}
|
||||
|
||||
const baseTs = Date.now();
|
||||
const events = [
|
||||
{
|
||||
agent_id: agentId,
|
||||
content: `Store memory event A for ${cadence} :: ${promptIntent}`,
|
||||
timestamp: baseTs,
|
||||
tags: ['scheduler', cadence, 'store'],
|
||||
metadata: {
|
||||
session_id: runId,
|
||||
source: 'scheduler-store',
|
||||
importance: 0.55,
|
||||
prompt_path: promptPath
|
||||
}
|
||||
},
|
||||
{
|
||||
agent_id: agentId,
|
||||
content: `Store memory event B for ${cadence} :: ${promptIntent}`,
|
||||
timestamp: baseTs + 1,
|
||||
tags: ['scheduler', cadence, 'store'],
|
||||
metadata: {
|
||||
session_id: runId,
|
||||
source: 'scheduler-store',
|
||||
importance: 0.55,
|
||||
prompt_path: promptPath
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
try {
|
||||
// 1. Ingest events
|
||||
const stored = await ingestEvents(events, { agent_id: agentId });
|
||||
|
||||
// 2. Prepare artifacts
|
||||
const sessionDir = path.join('.scheduler-memory', runId);
|
||||
const latestDir = path.join('.scheduler-memory', 'latest', cadence);
|
||||
|
||||
mkdirSync(sessionDir, { recursive: true });
|
||||
mkdirSync(latestDir, { recursive: true });
|
||||
|
||||
const artifact = {
|
||||
cadence,
|
||||
operation: 'store',
|
||||
runId,
|
||||
servicePath: 'src/services/memory/index.js#ingestEvents',
|
||||
inputs: {
|
||||
agentId,
|
||||
promptPath,
|
||||
promptIntent,
|
||||
events: events.length
|
||||
},
|
||||
outputs: {
|
||||
storedCount: stored.length,
|
||||
summaries: stored.map(m => m.summary)
|
||||
},
|
||||
status: 'ok'
|
||||
};
|
||||
|
||||
// 3. Write artifacts
|
||||
writeFileSync(path.join(sessionDir, 'store.json'), JSON.stringify(artifact, null, 2));
|
||||
writeFileSync(path.join(sessionDir, 'store.ok'), 'MEMORY_STORED\n');
|
||||
writeFileSync(path.join(latestDir, 'store.ok'), 'MEMORY_STORED\n');
|
||||
|
||||
// 4. Output success marker to stdout (for scheduler verification)
|
||||
console.log('MEMORY_STORED');
|
||||
} catch (error) {
|
||||
console.error('Memory storage failed:', error);
|
||||
process.exit(1);
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
set -euo pipefail
|
||||
node --input-type=module -e "import { ingestEvents, getRelevantMemories } from './src/services/memory/index.js'; import { mkdirSync, readFileSync, writeFileSync } from 'node:fs'; const fallbackCadence='weekly'; const cadence=process.env.SCHEDULER_CADENCE || fallbackCadence; const agentId=process.env.SCHEDULER_AGENT || ('scheduler-memory-' + cadence); const promptPath=process.env.SCHEDULER_PROMPT_PATH || ''; const runId=(process.env.SCHEDULER_RUN_ID || process.env.SCHEDULER_SESSION_ID || process.env.RUN_ID || ('session-' + Date.now().toString(36))); const promptRaw=promptPath ? readFileSync(promptPath, 'utf8') : ''; const promptLines=promptRaw.split(/\\r?\\n/).map((line)=>line.trim()).filter(Boolean); const promptIntent=promptLines.find((line)=>line.startsWith('#') || line.toLowerCase().startsWith('goal')) || promptLines[0] || 'scheduler memory retrieval'; const query=['scheduler', cadence, 'agent', agentId, 'intent', promptIntent.replace(/^#+\\s*/, '')].join(' | '); const timestamp=Date.now(); const events=[{ agent_id: agentId, content: 'Memory retrieval seed for ' + cadence + ' :: ' + promptIntent, timestamp, tags:['scheduler', cadence, 'retrieve'], metadata:{ session_id:runId, source:'scheduler-retrieve', importance:0.4, prompt_path:promptPath } }]; const ingested=await ingestEvents(events,{ agent_id: agentId }); const retrieved=await getRelevantMemories({ agent_id: agentId, query, k: 5 }); const sessionDir='.scheduler-memory/' + runId; const latestDir='.scheduler-memory/latest/' + cadence; mkdirSync(sessionDir,{ recursive:true }); mkdirSync(latestDir,{ recursive:true }); const artifact={ cadence, operation:'retrieve', runId, servicePath:'src/services/memory/index.js#getRelevantMemories', inputs:{ agentId, promptPath, promptIntent, query, events:events.length }, outputs:{ ingestedCount:ingested.length, retrievedCount:retrieved.length }, status:'ok' }; writeFileSync(sessionDir + '/retrieve.json', JSON.stringify(artifact, null, 2)); writeFileSync(sessionDir + '/retrieve.ok', 'MEMORY_RETRIEVED\\n'); writeFileSync(latestDir + '/retrieve.ok', 'MEMORY_RETRIEVED\\n');"
|
||||
echo MEMORY_RETRIEVED
|
||||
@@ -1,3 +0,0 @@
|
||||
set -euo pipefail
|
||||
node --input-type=module -e "import { ingestEvents } from './src/services/memory/index.js'; import { mkdirSync, readFileSync, writeFileSync } from 'node:fs'; const fallbackCadence='weekly'; const cadence=process.env.SCHEDULER_CADENCE || fallbackCadence; const agentId=process.env.SCHEDULER_AGENT || ('scheduler-memory-' + cadence); const promptPath=process.env.SCHEDULER_PROMPT_PATH || ''; const runId=(process.env.SCHEDULER_RUN_ID || process.env.SCHEDULER_SESSION_ID || process.env.RUN_ID || ('session-' + Date.now().toString(36))); const promptRaw=promptPath ? readFileSync(promptPath, 'utf8') : ''; const promptLines=promptRaw.split(/\\r?\\n/).map((line)=>line.trim()).filter(Boolean); const promptIntent=promptLines.find((line)=>line.startsWith('#') || line.toLowerCase().startsWith('goal')) || promptLines[0] || 'scheduler memory store'; const baseTs=Date.now(); const events=[{ agent_id: agentId, content: 'Store memory event A for ' + cadence + ' :: ' + promptIntent, timestamp: baseTs, tags:['scheduler', cadence, 'store'], metadata:{ session_id:runId, source:'scheduler-store', importance:0.55, prompt_path:promptPath } },{ agent_id: agentId, content: 'Store memory event B for ' + cadence + ' :: ' + promptIntent, timestamp: baseTs + 1, tags:['scheduler', cadence, 'store'], metadata:{ session_id:runId, source:'scheduler-store', importance:0.55, prompt_path:promptPath } }]; const stored=await ingestEvents(events,{ agent_id: agentId }); const sessionDir='.scheduler-memory/' + runId; const latestDir='.scheduler-memory/latest/' + cadence; mkdirSync(sessionDir,{ recursive:true }); mkdirSync(latestDir,{ recursive:true }); const artifact={ cadence, operation:'store', runId, servicePath:'src/services/memory/index.js#ingestEvents', inputs:{ agentId, promptPath, promptIntent, events:events.length }, outputs:{ storedCount:stored.length, summaries:stored.map((m)=>m.summary) }, status:'ok' }; writeFileSync(sessionDir + '/store.json', JSON.stringify(artifact, null, 2)); writeFileSync(sessionDir + '/store.ok', 'MEMORY_STORED\\n'); writeFileSync(latestDir + '/store.ok', 'MEMORY_STORED\\n');"
|
||||
echo MEMORY_STORED
|
||||
+27
@@ -237,6 +237,31 @@ export async function cmdInit(force = false, cwd = process.cwd(), mockAnswers =
|
||||
configData.nostrLock.namespace = namespace;
|
||||
configData.nostrLock.relays = relays;
|
||||
|
||||
// Configure memory policy with correct paths
|
||||
if (!configData.scheduler) configData.scheduler = {};
|
||||
// Always ensure memory policy exists and points to the correct scripts
|
||||
// We use the installDir to construct the path
|
||||
const scriptPrefix = installDir === '.' ? '' : `${installDir}/`;
|
||||
|
||||
if (!configData.scheduler.memoryPolicyByCadence) {
|
||||
configData.scheduler.memoryPolicyByCadence = {};
|
||||
}
|
||||
|
||||
// Populate daily/weekly if missing
|
||||
['daily', 'weekly'].forEach(cadence => {
|
||||
if (!configData.scheduler.memoryPolicyByCadence[cadence]) {
|
||||
configData.scheduler.memoryPolicyByCadence[cadence] = {
|
||||
mode: "required",
|
||||
retrieveCommand: `node ${scriptPrefix}scripts/memory/retrieve.mjs`,
|
||||
storeCommand: `node ${scriptPrefix}scripts/memory/store.mjs`,
|
||||
retrieveSuccessMarkers: ["MEMORY_RETRIEVED"],
|
||||
storeSuccessMarkers: ["MEMORY_STORED"],
|
||||
retrieveArtifacts: [`.scheduler-memory/latest/${cadence}/retrieve.ok`],
|
||||
storeArtifacts: [`.scheduler-memory/latest/${cadence}/store.ok`]
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
fs.writeFileSync(configPath, JSON.stringify(configData, null, 2), 'utf8');
|
||||
console.log(`Saved configuration to ${path.relative(cwd, configPath)}`);
|
||||
|
||||
@@ -266,6 +291,8 @@ function injectScriptsIntoHost(hostRoot, installDirName) {
|
||||
'torch:check': `npm run --prefix ${installDirName} lock:check:daily`, // Default to daily check
|
||||
'torch:lock': `npm run --prefix ${installDirName} lock:lock`,
|
||||
'torch:health': `npm run --prefix ${installDirName} lock:health`,
|
||||
'torch:memory:list': `node ${installDirName === '.' ? '' : installDirName + '/'}bin/torch-lock.mjs list-memories`,
|
||||
'torch:memory:inspect': `node ${installDirName === '.' ? '' : installDirName + '/'}bin/torch-lock.mjs inspect-memory`,
|
||||
};
|
||||
|
||||
let modified = false;
|
||||
|
||||
@@ -24,6 +24,42 @@
|
||||
"firstPromptByCadence": {
|
||||
"daily": "scheduler-update-agent",
|
||||
"weekly": "bug-reproducer-agent"
|
||||
},
|
||||
"memoryPolicyByCadence": {
|
||||
"daily": {
|
||||
"mode": "required",
|
||||
"retrieveCommand": "node torch/scripts/memory/retrieve.mjs",
|
||||
"storeCommand": "node torch/scripts/memory/store.mjs",
|
||||
"retrieveSuccessMarkers": [
|
||||
"MEMORY_RETRIEVED"
|
||||
],
|
||||
"storeSuccessMarkers": [
|
||||
"MEMORY_STORED"
|
||||
],
|
||||
"retrieveArtifacts": [
|
||||
".scheduler-memory/latest/daily/retrieve.ok"
|
||||
],
|
||||
"storeArtifacts": [
|
||||
".scheduler-memory/latest/daily/store.ok"
|
||||
]
|
||||
},
|
||||
"weekly": {
|
||||
"mode": "required",
|
||||
"retrieveCommand": "node torch/scripts/memory/retrieve.mjs",
|
||||
"storeCommand": "node torch/scripts/memory/store.mjs",
|
||||
"retrieveSuccessMarkers": [
|
||||
"MEMORY_RETRIEVED"
|
||||
],
|
||||
"storeSuccessMarkers": [
|
||||
"MEMORY_STORED"
|
||||
],
|
||||
"retrieveArtifacts": [
|
||||
".scheduler-memory/latest/weekly/retrieve.ok"
|
||||
],
|
||||
"storeArtifacts": [
|
||||
".scheduler-memory/latest/weekly/store.ok"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -25,8 +25,8 @@
|
||||
"memoryPolicyByCadence": {
|
||||
"daily": {
|
||||
"mode": "required",
|
||||
"retrieveCommand": "set -euo pipefail; node --input-type=module -e \"import { ingestEvents, getRelevantMemories } from './src/services/memory/index.js'; import { mkdirSync, readFileSync, writeFileSync } from 'node:fs'; const fallbackCadence='daily'; const cadence=process.env.SCHEDULER_CADENCE || fallbackCadence; const agentId=process.env.SCHEDULER_AGENT || ('scheduler-memory-' + cadence); const promptPath=process.env.SCHEDULER_PROMPT_PATH || ''; const runId=(process.env.SCHEDULER_RUN_ID || process.env.SCHEDULER_SESSION_ID || process.env.RUN_ID || ('session-' + Date.now().toString(36))); const promptRaw=promptPath ? readFileSync(promptPath, 'utf8') : ''; const promptLines=promptRaw.split(/\\r?\\n/).map((line)=>line.trim()).filter(Boolean); const promptIntent=promptLines.find((line)=>line.startsWith('#') || line.toLowerCase().startsWith('goal')) || promptLines[0] || 'scheduler memory retrieval'; const query=['scheduler', cadence, 'agent', agentId, 'intent', promptIntent.replace(/^#+\\s*/, '')].join(' | '); const timestamp=Date.now(); const events=[{ agent_id: agentId, content: 'Memory retrieval seed for ' + cadence + ' :: ' + promptIntent, timestamp, tags:['scheduler', cadence, 'retrieve'], metadata:{ session_id:runId, source:'scheduler-retrieve', importance:0.4, prompt_path:promptPath } }]; const ingested=await ingestEvents(events,{ agent_id: agentId }); const retrieved=await getRelevantMemories({ agent_id: agentId, query, k: 5 }); const sessionDir='.scheduler-memory/' + runId; const latestDir='.scheduler-memory/latest/' + cadence; mkdirSync(sessionDir,{ recursive:true }); mkdirSync(latestDir,{ recursive:true }); const artifact={ cadence, operation:'retrieve', runId, servicePath:'src/services/memory/index.js#getRelevantMemories', inputs:{ agentId, promptPath, promptIntent, query, events:events.length }, outputs:{ ingestedCount:ingested.length, retrievedCount:retrieved.length }, status:'ok' }; writeFileSync(sessionDir + '/retrieve.json', JSON.stringify(artifact, null, 2)); writeFileSync(sessionDir + '/retrieve.ok', 'MEMORY_RETRIEVED\\n'); writeFileSync(latestDir + '/retrieve.ok', 'MEMORY_RETRIEVED\\n'); writeFileSync(latestDir + '/memories.md', retrieved.map(m => '- ' + m.content).join('\\n'));\"; echo MEMORY_RETRIEVED",
|
||||
"storeCommand": "set -euo pipefail; node --input-type=module -e \"import { ingestEvents } from './src/services/memory/index.js'; import { mkdirSync, readFileSync, writeFileSync } from 'node:fs'; const fallbackCadence='daily'; const cadence=process.env.SCHEDULER_CADENCE || fallbackCadence; const agentId=process.env.SCHEDULER_AGENT || ('scheduler-memory-' + cadence); const promptPath=process.env.SCHEDULER_PROMPT_PATH || ''; const runId=(process.env.SCHEDULER_RUN_ID || process.env.SCHEDULER_SESSION_ID || process.env.RUN_ID || ('session-' + Date.now().toString(36))); const promptRaw=promptPath ? readFileSync(promptPath, 'utf8') : ''; const promptLines=promptRaw.split(/\\r?\\n/).map((line)=>line.trim()).filter(Boolean); const promptIntent=promptLines.find((line)=>line.startsWith('#') || line.toLowerCase().startsWith('goal')) || promptLines[0] || 'scheduler memory store'; const baseTs=Date.now(); const events=[{ agent_id: agentId, content: 'Store memory event A for ' + cadence + ' :: ' + promptIntent, timestamp: baseTs, tags:['scheduler', cadence, 'store'], metadata:{ session_id:runId, source:'scheduler-store', importance:0.55, prompt_path:promptPath } },{ agent_id: agentId, content: 'Store memory event B for ' + cadence + ' :: ' + promptIntent, timestamp: baseTs + 1, tags:['scheduler', cadence, 'store'], metadata:{ session_id:runId, source:'scheduler-store', importance:0.55, prompt_path:promptPath } }]; const stored=await ingestEvents(events,{ agent_id: agentId }); const sessionDir='.scheduler-memory/' + runId; const latestDir='.scheduler-memory/latest/' + cadence; mkdirSync(sessionDir,{ recursive:true }); mkdirSync(latestDir,{ recursive:true }); const artifact={ cadence, operation:'store', runId, servicePath:'src/services/memory/index.js#ingestEvents', inputs:{ agentId, promptPath, promptIntent, events:events.length }, outputs:{ storedCount:stored.length, summaries:stored.map((m)=>m.summary) }, status:'ok' }; writeFileSync(sessionDir + '/store.json', JSON.stringify(artifact, null, 2)); writeFileSync(sessionDir + '/store.ok', 'MEMORY_STORED\\n'); writeFileSync(latestDir + '/store.ok', 'MEMORY_STORED\\n');\"; echo MEMORY_STORED",
|
||||
"retrieveCommand": "node scripts/memory/retrieve.mjs",
|
||||
"storeCommand": "node scripts/memory/store.mjs",
|
||||
"retrieveSuccessMarkers": [
|
||||
"MEMORY_RETRIEVED"
|
||||
],
|
||||
@@ -42,8 +42,8 @@
|
||||
},
|
||||
"weekly": {
|
||||
"mode": "required",
|
||||
"retrieveCommand": "set -euo pipefail; node --input-type=module -e \"import { ingestEvents, getRelevantMemories } from './src/services/memory/index.js'; import { mkdirSync, readFileSync, writeFileSync } from 'node:fs'; const fallbackCadence='weekly'; const cadence=process.env.SCHEDULER_CADENCE || fallbackCadence; const agentId=process.env.SCHEDULER_AGENT || ('scheduler-memory-' + cadence); const promptPath=process.env.SCHEDULER_PROMPT_PATH || ''; const runId=(process.env.SCHEDULER_RUN_ID || process.env.SCHEDULER_SESSION_ID || process.env.RUN_ID || ('session-' + Date.now().toString(36))); const promptRaw=promptPath ? readFileSync(promptPath, 'utf8') : ''; const promptLines=promptRaw.split(/\\r?\\n/).map((line)=>line.trim()).filter(Boolean); const promptIntent=promptLines.find((line)=>line.startsWith('#') || line.toLowerCase().startsWith('goal')) || promptLines[0] || 'scheduler memory retrieval'; const query=['scheduler', cadence, 'agent', agentId, 'intent', promptIntent.replace(/^#+\\s*/, '')].join(' | '); const timestamp=Date.now(); const events=[{ agent_id: agentId, content: 'Memory retrieval seed for ' + cadence + ' :: ' + promptIntent, timestamp, tags:['scheduler', cadence, 'retrieve'], metadata:{ session_id:runId, source:'scheduler-retrieve', importance:0.4, prompt_path:promptPath } }]; const ingested=await ingestEvents(events,{ agent_id: agentId }); const retrieved=await getRelevantMemories({ agent_id: agentId, query, k: 5 }); const sessionDir='.scheduler-memory/' + runId; const latestDir='.scheduler-memory/latest/' + cadence; mkdirSync(sessionDir,{ recursive:true }); mkdirSync(latestDir,{ recursive:true }); const artifact={ cadence, operation:'retrieve', runId, servicePath:'src/services/memory/index.js#getRelevantMemories', inputs:{ agentId, promptPath, promptIntent, query, events:events.length }, outputs:{ ingestedCount:ingested.length, retrievedCount:retrieved.length }, status:'ok' }; writeFileSync(sessionDir + '/retrieve.json', JSON.stringify(artifact, null, 2)); writeFileSync(sessionDir + '/retrieve.ok', 'MEMORY_RETRIEVED\\n'); writeFileSync(latestDir + '/retrieve.ok', 'MEMORY_RETRIEVED\\n'); writeFileSync(latestDir + '/memories.md', retrieved.map(m => '- ' + m.content).join('\\n'));\"; echo MEMORY_RETRIEVED",
|
||||
"storeCommand": "set -euo pipefail; node --input-type=module -e \"import { ingestEvents } from './src/services/memory/index.js'; import { mkdirSync, readFileSync, writeFileSync } from 'node:fs'; const fallbackCadence='weekly'; const cadence=process.env.SCHEDULER_CADENCE || fallbackCadence; const agentId=process.env.SCHEDULER_AGENT || ('scheduler-memory-' + cadence); const promptPath=process.env.SCHEDULER_PROMPT_PATH || ''; const runId=(process.env.SCHEDULER_RUN_ID || process.env.SCHEDULER_SESSION_ID || process.env.RUN_ID || ('session-' + Date.now().toString(36))); const promptRaw=promptPath ? readFileSync(promptPath, 'utf8') : ''; const promptLines=promptRaw.split(/\\r?\\n/).map((line)=>line.trim()).filter(Boolean); const promptIntent=promptLines.find((line)=>line.startsWith('#') || line.toLowerCase().startsWith('goal')) || promptLines[0] || 'scheduler memory store'; const baseTs=Date.now(); const events=[{ agent_id: agentId, content: 'Store memory event A for ' + cadence + ' :: ' + promptIntent, timestamp: baseTs, tags:['scheduler', cadence, 'store'], metadata:{ session_id:runId, source:'scheduler-store', importance:0.55, prompt_path:promptPath } },{ agent_id: agentId, content: 'Store memory event B for ' + cadence + ' :: ' + promptIntent, timestamp: baseTs + 1, tags:['scheduler', cadence, 'store'], metadata:{ session_id:runId, source:'scheduler-store', importance:0.55, prompt_path:promptPath } }]; const stored=await ingestEvents(events,{ agent_id: agentId }); const sessionDir='.scheduler-memory/' + runId; const latestDir='.scheduler-memory/latest/' + cadence; mkdirSync(sessionDir,{ recursive:true }); mkdirSync(latestDir,{ recursive:true }); const artifact={ cadence, operation:'store', runId, servicePath:'src/services/memory/index.js#ingestEvents', inputs:{ agentId, promptPath, promptIntent, events:events.length }, outputs:{ storedCount:stored.length, summaries:stored.map((m)=>m.summary) }, status:'ok' }; writeFileSync(sessionDir + '/store.json', JSON.stringify(artifact, null, 2)); writeFileSync(sessionDir + '/store.ok', 'MEMORY_STORED\\n'); writeFileSync(latestDir + '/store.ok', 'MEMORY_STORED\\n');\"; echo MEMORY_STORED",
|
||||
"retrieveCommand": "node scripts/memory/retrieve.mjs",
|
||||
"storeCommand": "node scripts/memory/store.mjs",
|
||||
"retrieveSuccessMarkers": [
|
||||
"MEMORY_RETRIEVED"
|
||||
],
|
||||
|
||||
Reference in new issue
Block a user