Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
4d8594c
chore: ignore Claude agent worktrees and omp local data
9thLevelSoftware Oct 4, 2026
cb74022
feat: add outcome learning and repository-aware memory retrieval
9thLevelSoftware Oct 5, 2026
d0464b0
feat(mcp): restore guided covenant and core gateway ergonomics
9thLevelSoftware Oct 5, 2026
4462fd6
fix(v7): preserve discovery retries and tighten verification
9thLevelSoftware Oct 5, 2026
1cbe4da
fix: preserve filename affinity for qualified path queries; real comp…
9thLevelSoftware Oct 5, 2026
2e22add
fix: validate binding snapshot content instead of trusting mtime/size…
9thLevelSoftware Oct 5, 2026
0185f24
fix: preserve supplied path/symbol scope using boundary-suffix affini…
9thLevelSoftware Oct 5, 2026
2ab660b
perf: reuse byte-identical explore shadow composition in direct/feder…
9thLevelSoftware Oct 5, 2026
96d1a1c
perf: batch resolved binding reads with raw-byte budget and bounded s…
9thLevelSoftware Oct 5, 2026
09412c6
fix: normalize relative query-path separators/dot/repeatedslashes whi…
9thLevelSoftware Oct 5, 2026
e60ea16
fix: include AST-owned decorator envelopes in symbol fingerprints via…
9thLevelSoftware Oct 5, 2026
58d103c
fix: normalizecitationlookalikes onmisseddirect/federatedrenderingfie…
9thLevelSoftware Oct 5, 2026
dd44020
feat: query-sidecontent/rationale tier beforetag-assistedmatches, ful…
9thLevelSoftware Oct 5, 2026
2624241
fix: sortretainedfederatedchannels canonically. ActualseparatePythonh…
9thLevelSoftware Oct 5, 2026
6058d81
Parser absence/failure and unusable entities now map symbol-bound wri…
9thLevelSoftware Oct 5, 2026
3104a02
Content/rationale tier uses existing field weights with tag contribut…
9thLevelSoftware Oct 5, 2026
d1a00b1
Exact qualified identities precede unique short aliases; unrelated sa…
9thLevelSoftware Oct 5, 2026
d53fed1
Oversize refuses are unverifiable (capture INVALID_ARGUMENT); environ…
9thLevelSoftware Oct 5, 2026
8a517c0
Public RetrievalData now enforces same exact ordered/multiplicity mar…
9thLevelSoftware Oct 5, 2026
36afc1a
Outcome and each step honor existing source-aware limits consistently…
9thLevelSoftware Oct 5, 2026
ba5fe3d
Two-line memo canonicalization to exact-verified cache-owned immutabl…
9thLevelSoftware Oct 5, 2026
67bc8b9
Exactsource snapshots cache minimal frozen symbolspans/root and share…
9thLevelSoftware Oct 5, 2026
cfb59a6
Capture-local resolvedfile snapshots prevent mixed-source symbolsets,…
9thLevelSoftware Oct 5, 2026
cd7eb8b
fix: address v7 gateway and migration review findings
9thLevelSoftware Oct 5, 2026
b38753f
fix: preserve retryable recall across lexical publication
9thLevelSoftware Oct 5, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 13 additions & 23 deletions .claude/skills/daem0nmcp-protocol/SKILL.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: daem0nmcp-protocol
description: Enforce the Daem0n v7 scoped session, exact preflight, replay-safe memory, and outcome protocol
description: Enforce the Daem0n v7 guided session, inline counsel, replay-safe memory, and outcome protocol
---

# Daem0n v7 Protocol
Expand All @@ -24,13 +24,9 @@ Do not treat a substring or an older workflow name as a match.

## Required sequence

1. Establish the authenticated workspace session:
The first Daem0n call in a session briefs automatically; the compact brief is returned in `meta.covenant.auto_brief`. Call `session_brief` for the full brief.

```text
mcp__daem0nmcp__session_brief(workspace_id="<workspace_id>")
```

2. Recall relevant context when needed:
Recall relevant context when needed:

```text
mcp__daem0nmcp__memory_recall(
Expand All @@ -40,33 +36,22 @@ Do not treat a substring or an older workflow name as a match.
)
```

3. Before a protected call, request a token bound to its exact arguments:
Call `memory_store` (or any protected tool) directly. If it returns `COUNSEL_REQUIRED`, read `error.counsel` (guidance and reasons), then retry exactly `error.remedy`. `memory_preflight` remains available for planning a change in advance.

```text
mcp__daem0nmcp__memory_preflight(
workspace_id="<workspace_id>",
target_tool="memory_store",
target_arguments={
"record_type": "decision",
"content": "Use append-only events",
"idempotency_key": "decision-events-0001"
}
)
```
Use `daem0n_tools_search(query)`, then `daem0n_tool_call(workspace_id, tool, arguments)`.

4. Execute that exact request with the returned token:
Store a durable decision directly:

```text
mcp__daem0nmcp__memory_store(
workspace_id="<workspace_id>",
record_type="decision",
content="Use append-only events",
idempotency_key="decision-events-0001",
preflight_token="<token-from-memory_preflight>"
idempotency_key="decision-events-0001"
)
```

5. After verification, record the outcome:
After verification, record the outcome:

```text
mcp__daem0nmcp__memory_record_outcome(
Expand All @@ -86,6 +71,11 @@ was lost.

- A `preflight_token` authorizes only the exact workspace, tool, arguments,
principal, and session for which it was issued.
- Tokens are single-use and valid for 300 seconds.
- Defaults are `DAEM0NMCP_COVENANT_MODE=guided` and `DAEM0NMCP_TOOL_SURFACE=core`.
Set `DAEM0NMCP_COVENANT_MODE=strict` for explicit `session_brief`, exact
`memory_preflight`, and token-bearing writes; `DAEM0NMCP_TOOL_SURFACE=full`
lists all registered tools.
- Never infer identity from headers, network address, client information, or
`_client_meta`.
- Treat `must_not` guidance as a hard constraint.
Expand Down
47 changes: 14 additions & 33 deletions .claude/skills/openspec-daem0n-bridge/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,16 @@ instead of copying an older invocation into this workflow.

## Session gate

Before inspecting or synchronizing OpenSpec state, establish the scoped v7
session:
The first Daem0n call in a session briefs automatically; the compact brief is returned in `meta.covenant.auto_brief`. Call `session_brief` for the full brief.

```text
mcp__daem0nmcp__session_brief(
workspace_id="<opaque-workspace-id>",
focus_areas=["OpenSpec", "specifications", "proposal outcomes"]
)
```
Call `memory_store` (or any protected tool) directly. If it returns `COUNSEL_REQUIRED`, read `error.counsel` (guidance and reasons), then retry exactly `error.remedy`. `memory_preflight` remains available for planning a change in advance.

Use `daem0n_tools_search(query)`, then `daem0n_tool_call(workspace_id, tool, arguments)`.

Tokens remain exact-argument, single-use, and valid for 300 seconds. Defaults
are guided/core. `DAEM0NMCP_COVENANT_MODE=strict` requires explicit
`session_brief`, exact `memory_preflight`, and token-bearing writes;
`DAEM0NMCP_TOOL_SURFACE=full` lists every registered tool.

Respect the returned warnings, failed outcomes, applicable rules, and next
steps. If the tool is unavailable, continue with OpenSpec file work only; do
Expand Down Expand Up @@ -102,26 +103,7 @@ mcp__daem0nmcp__memory_recall(
}
```

6. Preflight those exact fields, excluding only `workspace_id` and the future
token:

```text
mcp__daem0nmcp__memory_preflight(
workspace_id="<opaque-workspace-id>",
target_tool="memory_store",
target_arguments={
"record_type": "pattern",
"content": "<bounded specification summary>",
"rationale": "OpenSpec specification is the source of truth",
"tags": ["openspec", "spec", "<spec-name>"],
"relative_file_path": "openspec/specs/<spec-name>/spec.md",
"idempotency_key": "openspec-spec-<stable-content-key>"
},
description="Store the reviewed OpenSpec summary"
)
```

7. If guidance permits, make the exact protected call:
6. Call `memory_store` directly with the reviewed fields:

```text
mcp__daem0nmcp__memory_store(
Expand All @@ -131,8 +113,7 @@ mcp__daem0nmcp__memory_store(
rationale="OpenSpec specification is the source of truth",
tags=["openspec", "spec", "<spec-name>"],
relative_file_path="openspec/specs/<spec-name>/spec.md",
idempotency_key="openspec-spec-<stable-content-key>",
preflight_token="<token-from-memory_preflight>"
idempotency_key="openspec-spec-<stable-content-key>"
)
```

Expand Down Expand Up @@ -202,9 +183,9 @@ mcp__daem0nmcp__memory_record_outcome(
Use `worked=false` when the implementation failed, was reverted, or did not
meet the archived specification. State the observed failure precisely.

5. Store any new reusable learning only through a fresh, exact
`memory_preflight` plus `memory_store` pair. Do not convert speculation into
a learning.
5. Store new reusable learning through direct `memory_store`; on
`COUNSEL_REQUIRED`, review `error.counsel` and retry exactly `error.remedy`.
Do not convert speculation into a learning.

## Read-only context resources

Expand Down
18 changes: 12 additions & 6 deletions .claude/skills/summon_daem0n/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ Use the opaque ID assigned to the configured project root:

```text
mcp__daem0nmcp__system_health(workspace_id="<workspace_id>")
mcp__daem0nmcp__session_brief(workspace_id="<workspace_id>")
```
Call `session_brief` only when you want the full briefing.

Do not send project paths, request headers, IP addresses, client information,
or `_client_meta` as identity. The transport supplies identity and the server
Expand All @@ -61,11 +61,17 @@ The four bounded JSON resources are:

## 5. Explain the write protocol

Before `memory_store` or another protected operation, call `memory_preflight`
with that exact target and its exact arguments. Reuse those arguments with the
returned token, include a stable `idempotency_key`, and retain the returned
`record_id`. Later call `memory_record_outcome` with another stable
idempotency key.
The first Daem0n call in a session briefs automatically; the compact brief is returned in `meta.covenant.auto_brief`. Call `session_brief` for the full brief.

Call `memory_store` (or any protected tool) directly. If it returns `COUNSEL_REQUIRED`, read `error.counsel` (guidance and reasons), then retry exactly `error.remedy`. `memory_preflight` remains available for planning a change in advance.

Use `daem0n_tools_search(query)`, then `daem0n_tool_call(workspace_id, tool, arguments)`.

Include a stable `idempotency_key`, retain `record_id`, and record verified
results using `memory_record_outcome` with another stable key. Tokens remain
exact-argument, single-use, and valid for 300 seconds. Defaults are guided/core;
`DAEM0NMCP_COVENANT_MODE=strict` requires explicit briefing and preflight,
and `DAEM0NMCP_TOOL_SURFACE=full` lists every registered tool.

For migrations from v6, use the generated mapping at
[`docs/v6-to-v7-tools.json`](../../../docs/v6-to-v7-tools.json). Do not invent
Expand Down
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ tests/fixtures/retrieval/events.jsonl text eol=crlf
tests/fixtures/retrieval/qdrant_fake.py text eol=crlf
tests/fixtures/retrieval/queries.jsonl text eol=crlf
tests/fixtures/retrieval/records.jsonl text eol=crlf

autoresearch.sh text eol=lf
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ logs/

# Worktrees
.worktrees/
.claude/worktrees/
.omp/
CLAUDE.md
.planning/

Expand Down
6 changes: 4 additions & 2 deletions .opencode/commands/commune.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
description: Start the Daem0n v7 session for a registered workspace
---

Call `daem0nmcp_session_brief(workspace_id="$ARGUMENTS")` immediately. The
argument must be the configured opaque `workspace_id`, not a path.
The first Daem0n call establishes the scoped session and briefs automatically
in `meta.covenant.auto_brief`. For the full brief, call
`daem0nmcp_session_brief(workspace_id="$ARGUMENTS")`.
The argument must be the configured opaque `workspace_id`, not a path.

After receiving the briefing results:
1. Report the session status, active warnings, and recent activity summary
Expand Down
6 changes: 3 additions & 3 deletions .opencode/commands/counsel.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
description: Request an exact Daem0n v7 preflight capability
description: Plan a protected change in advance with Daem0n v7 counsel
---

Parse `$ARGUMENTS` as the intended protected v7 tool and its arguments, then
call:
`memory_preflight` is optional advance planning in guided mode. Parse
`$ARGUMENTS` as the intended protected v7 tool and its arguments, then call:

```text
daem0nmcp_memory_preflight(
Expand Down
12 changes: 7 additions & 5 deletions .opencode/commands/inscribe.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,22 @@ Choose `record_type` from the content:
- "warning" for things to avoid
- "learning" for lessons from experience

Create one stable idempotency key. Call `daem0nmcp_memory_preflight` with
`target_tool="memory_store"` and the exact target arguments, then call:
Create one stable idempotency key and call `memory_store` directly:

```text
daem0nmcp_memory_store(
workspace_id="<workspace_id>",
record_type="<chosen>",
content="$ARGUMENTS",
rationale="<why this matters>",
idempotency_key="<stable-key>",
preflight_token="<token-from-memory_preflight>"
idempotency_key="<stable-key>"
)
```

If `COUNSEL_REQUIRED`, review `error.counsel` (guidance and reasons), then retry
exactly `error.remedy`, preserving the idempotency key. `memory_preflight`
remains available for planning a change in advance. The first Daem0n call
briefs automatically in `meta.covenant.auto_brief`; `session_brief` gives the full brief.

Report the returned `record_id`. After verification, use
`daem0nmcp_memory_record_outcome` with that ID and a separate stable
idempotency key.
4 changes: 4 additions & 0 deletions .opencode/commands/recall.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ description: Retrieve bounded memories from a Daem0n v7 workspace

Call `daem0nmcp_memory_recall(workspace_id="<workspace_id>", query="$ARGUMENTS", limit=10)` immediately.

The first Daem0n call briefs automatically in `meta.covenant.auto_brief`;
call `session_brief` for the full brief. For other capabilities, use
`daem0n_tools_search(query)`, then `daem0n_tool_call(workspace_id, tool, arguments)`.

Present the retrieved memories in a clear format:
- Show each record's content, type, and creation time
- Highlight any warnings or failed approaches
Expand Down
50 changes: 26 additions & 24 deletions .opencode/plugins/daem0n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*
* Mirrors the 5-hook discipline from Claude Code's hooks system:
* 1. System prompt injection (covenant rules in every LLM call)
* 2. Pre-edit enforcement (preflight token required)
* 2. Pre-edit reminders (gateway file recall)
* 3. Pre-bash enforcement (must_not rule checking)
* 4. Post-edit suggestions (informational, never blocks)
* 5. Session lifecycle events (best-effort, never blocks)
Expand All @@ -21,24 +21,25 @@ import type { Plugin } from "@opencode-ai/plugin";
const COVENANT_RULES_FULL = `<daem0n-covenant>
## The Daem0n v7 Covenant

This project is bound to Daem0n for persistent AI memory. When daem0nmcp tools
are available, use the exact workspace-scoped v7 tools. The core names are
session_brief, memory_preflight, memory_recall, memory_store,
memory_record_outcome, and system_health.
This project is bound to Daem0n for persistent AI memory. Use exact workspace-scoped
v7 tools: session_brief, memory_preflight, memory_recall, memory_store,
memory_record_outcome, system_health, daem0n_tools_search, and daem0n_tool_call.

### 1. SESSION START (Non-Negotiable)
IMMEDIATELY call:
daem0nmcp_session_brief(workspace_id="<workspace_id>")
### 1. BRIEF
The first Daem0n call in a session briefs automatically; the compact brief is returned in meta.covenant.auto_brief. Call session_brief for the full brief.

Use daem0nmcp_memory_recall(workspace_id="<workspace_id>", query="...", limit=10)
for relevant history. Before a protected operation call:
daem0nmcp_memory_preflight(workspace_id="<workspace_id>", target_tool="<exact-tool>", target_arguments={<exact arguments>})
Respect warnings, failed approaches, and must_not constraints. A preflight token
is valid only for the exact workspace, principal, session, tool, and arguments.
### 2. WRITE
Call memory_store (or any protected tool) directly. If it returns COUNSEL_REQUIRED, read error.counsel (guidance and reasons), then retry exactly error.remedy. memory_preflight remains available for planning a change in advance.
Use bounded memory_recall for relevant history. Respect warnings, failures and
must_not constraints. Tokens remain exact-argument, single-use capabilities
valid for 300 seconds, bound to workspace, principal, session, tool and arguments.
Use a stable idempotency_key for memory_store and save its record_id.

### 3. AFTER MAKING DECISIONS
Call daem0nmcp_memory_store with the same target arguments, a stable
idempotency_key, and the returned preflight_token. Save its record_id.
### 3. OTHER CAPABILITIES
Use daem0n_tools_search(query), then daem0n_tool_call(workspace_id, tool, arguments).
Defaults: DAEM0NMCP_COVENANT_MODE=guided and DAEM0NMCP_TOOL_SURFACE=core.
DAEM0NMCP_COVENANT_MODE=strict requires explicit session_brief, exact
memory_preflight, and token-bearing writes; DAEM0NMCP_TOOL_SURFACE=full lists all tools.

### 4. AFTER IMPLEMENTATION
Call: daem0nmcp_memory_record_outcome(workspace_id="<workspace_id>", record_id="<mem_id>", outcome_text="...", worked=true|false, idempotency_key="<stable-key>")
Expand All @@ -51,15 +52,16 @@ at /mcp. Migration mapping: docs/v6-to-v7-tools.json.
</daem0n-covenant>`;

const COVENANT_RULES_SIMPLIFIED = `<daem0n-covenant mode="simplified">
## Memory Protocol (Required Steps)
## Memory Protocol

This project uses Daem0n for persistent AI memory. Follow these 4 steps:

1. START: daem0nmcp_session_brief(workspace_id="<workspace_id>")
2. RECALL: daem0nmcp_memory_recall(workspace_id="<workspace_id>", query="...", limit=10)
3. PREFLIGHT: daem0nmcp_memory_preflight(workspace_id="<workspace_id>", target_tool="memory_store", target_arguments={<exact arguments>})
4. STORE: daem0nmcp_memory_store(workspace_id="<workspace_id>", record_type="decision", content="...", idempotency_key="<stable-key>", preflight_token="<token>")
5. OUTCOME: daem0nmcp_memory_record_outcome(workspace_id="<workspace_id>", record_id="<mem_id>", outcome_text="...", worked=true|false, idempotency_key="<stable-key>")
The first Daem0n call in a session briefs automatically; the compact brief is returned in meta.covenant.auto_brief. Call session_brief for the full brief.
Call memory_store (or any protected tool) directly. If it returns COUNSEL_REQUIRED, read error.counsel (guidance and reasons), then retry exactly error.remedy. memory_preflight remains available for planning a change in advance.
Use daem0n_tools_search(query), then daem0n_tool_call(workspace_id, tool, arguments).
RECALL: daem0nmcp_memory_recall(workspace_id="<workspace_id>", query="...", limit=10)
STORE: daem0nmcp_memory_store(workspace_id="<workspace_id>", record_type="decision", content="...", idempotency_key="<stable-key>")
OUTCOME: daem0nmcp_memory_record_outcome(workspace_id="<workspace_id>", record_id="<mem_id>", outcome_text="...", worked=true|false, idempotency_key="<stable-key>")
Tokens remain exact-argument, single-use, and valid for 300 seconds.
Strict ceremony: DAEM0NMCP_COVENANT_MODE=strict. Full listing: DAEM0NMCP_TOOL_SURFACE=full.

Rules:
- Never use paths as workspace selectors.
Expand Down
Loading
Loading