thoth-agents 0.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/LICENSE +21 -0
- package/README.md +339 -0
- package/dist/agents/deep.d.ts +2 -0
- package/dist/agents/designer.d.ts +2 -0
- package/dist/agents/explorer.d.ts +2 -0
- package/dist/agents/index.d.ts +8 -0
- package/dist/agents/librarian.d.ts +2 -0
- package/dist/agents/oracle.d.ts +2 -0
- package/dist/agents/orchestrator.d.ts +15 -0
- package/dist/agents/prompt-dialects.d.ts +28 -0
- package/dist/agents/prompt-sections.d.ts +47 -0
- package/dist/agents/prompt-utils.d.ts +25 -0
- package/dist/agents/quick.d.ts +2 -0
- package/dist/cli/codex-config-io.d.ts +31 -0
- package/dist/cli/codex-install.d.ts +41 -0
- package/dist/cli/codex-paths.d.ts +29 -0
- package/dist/cli/config-io.d.ts +22 -0
- package/dist/cli/config-manager.d.ts +4 -0
- package/dist/cli/custom-skills.d.ts +48 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.js +4579 -0
- package/dist/cli/install.d.ts +3 -0
- package/dist/cli/model-key-normalization.d.ts +1 -0
- package/dist/cli/paths.d.ts +21 -0
- package/dist/cli/providers.d.ts +120 -0
- package/dist/cli/skill-manifest.d.ts +32 -0
- package/dist/cli/skills.d.ts +26 -0
- package/dist/cli/system.d.ts +6 -0
- package/dist/cli/types.d.ts +58 -0
- package/dist/config/constants.d.ts +17 -0
- package/dist/config/index.d.ts +5 -0
- package/dist/config/loader.d.ts +33 -0
- package/dist/config/schema.d.ts +279 -0
- package/dist/config/utils.d.ts +10 -0
- package/dist/delegation/project-id.d.ts +10 -0
- package/dist/delegation/types.d.ts +39 -0
- package/dist/harness/adapters/codex-surfaces.d.ts +219 -0
- package/dist/harness/adapters/codex.d.ts +8 -0
- package/dist/harness/adapters/opencode.d.ts +10 -0
- package/dist/harness/codex-plugin-paths.d.ts +1 -0
- package/dist/harness/core/agent-pack.d.ts +88 -0
- package/dist/harness/core/memory-governance.d.ts +33 -0
- package/dist/harness/core/sdd.d.ts +100 -0
- package/dist/harness/core/skills.d.ts +183 -0
- package/dist/harness/generate-codex-plugin.d.ts +9 -0
- package/dist/harness/registry.d.ts +6 -0
- package/dist/harness/types.d.ts +85 -0
- package/dist/harness/writers/codex-plugin-package.d.ts +26 -0
- package/dist/harness/writers/codex-toml.d.ts +10 -0
- package/dist/harness/writers/skill-layout.d.ts +15 -0
- package/dist/hooks/auto-update-checker/cache.d.ts +7 -0
- package/dist/hooks/auto-update-checker/checker.d.ts +28 -0
- package/dist/hooks/auto-update-checker/constants.d.ts +11 -0
- package/dist/hooks/auto-update-checker/index.d.ts +18 -0
- package/dist/hooks/auto-update-checker/types.d.ts +23 -0
- package/dist/hooks/chat-headers.d.ts +16 -0
- package/dist/hooks/delegate-task-retry/guidance.d.ts +2 -0
- package/dist/hooks/delegate-task-retry/hook.d.ts +8 -0
- package/dist/hooks/delegate-task-retry/index.d.ts +4 -0
- package/dist/hooks/delegate-task-retry/patterns.d.ts +11 -0
- package/dist/hooks/foreground-fallback/index.d.ts +73 -0
- package/dist/hooks/index.d.ts +10 -0
- package/dist/hooks/json-error-recovery/hook.d.ts +18 -0
- package/dist/hooks/json-error-recovery/index.d.ts +1 -0
- package/dist/hooks/phase-reminder/index.d.ts +26 -0
- package/dist/hooks/post-read-nudge/index.d.ts +18 -0
- package/dist/hooks/skill-sync.d.ts +10 -0
- package/dist/hooks/thoth-mem/index.d.ts +46 -0
- package/dist/hooks/thoth-mem/protocol.d.ts +7 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +6509 -0
- package/dist/mcp/context7.d.ts +7 -0
- package/dist/mcp/exa.d.ts +6 -0
- package/dist/mcp/grep-app.d.ts +7 -0
- package/dist/mcp/index.d.ts +7 -0
- package/dist/mcp/thoth.d.ts +3 -0
- package/dist/mcp/types.d.ts +12 -0
- package/dist/sdd/artifact-governance/artifact-loader.d.ts +55 -0
- package/dist/sdd/artifact-governance/index.d.ts +6 -0
- package/dist/sdd/artifact-governance/tasks-validator.d.ts +17 -0
- package/dist/sdd/artifact-governance/types.d.ts +52 -0
- package/dist/thoth/client.d.ts +14 -0
- package/dist/thoth/index.d.ts +2 -0
- package/dist/tools/ast-grep/cli.d.ts +15 -0
- package/dist/tools/ast-grep/constants.d.ts +25 -0
- package/dist/tools/ast-grep/downloader.d.ts +5 -0
- package/dist/tools/ast-grep/index.d.ts +10 -0
- package/dist/tools/ast-grep/tools.d.ts +3 -0
- package/dist/tools/ast-grep/types.d.ts +30 -0
- package/dist/tools/ast-grep/utils.d.ts +4 -0
- package/dist/tools/index.d.ts +2 -0
- package/dist/tools/lsp/client.d.ts +42 -0
- package/dist/tools/lsp/config-store.d.ts +29 -0
- package/dist/tools/lsp/config.d.ts +4 -0
- package/dist/tools/lsp/constants.d.ts +25 -0
- package/dist/tools/lsp/index.d.ts +4 -0
- package/dist/tools/lsp/tools.d.ts +5 -0
- package/dist/tools/lsp/types.d.ts +35 -0
- package/dist/tools/lsp/utils.d.ts +34 -0
- package/dist/utils/agent-variant.d.ts +47 -0
- package/dist/utils/env.d.ts +1 -0
- package/dist/utils/file-io.d.ts +3 -0
- package/dist/utils/frontmatter-yaml.d.ts +4 -0
- package/dist/utils/index.d.ts +7 -0
- package/dist/utils/internal-initiator.d.ts +6 -0
- package/dist/utils/logger.d.ts +1 -0
- package/dist/utils/polling.d.ts +21 -0
- package/dist/utils/subprocess.d.ts +24 -0
- package/dist/utils/tmux-session-manager.d.ts +63 -0
- package/dist/utils/tmux.d.ts +32 -0
- package/dist/utils/zip-extractor.d.ts +1 -0
- package/package.json +81 -0
- package/src/skills/_shared/openspec-convention.md +131 -0
- package/src/skills/_shared/persistence-contract.md +162 -0
- package/src/skills/_shared/thoth-mem-convention.md +124 -0
- package/src/skills/executing-plans/SKILL.md +245 -0
- package/src/skills/plan-reviewer/SKILL.md +115 -0
- package/src/skills/requirements-interview/SKILL.md +212 -0
- package/src/skills/sdd-apply/SKILL.md +89 -0
- package/src/skills/sdd-archive/SKILL.md +87 -0
- package/src/skills/sdd-design/SKILL.md +92 -0
- package/src/skills/sdd-init/SKILL.md +148 -0
- package/src/skills/sdd-propose/SKILL.md +89 -0
- package/src/skills/sdd-spec/SKILL.md +93 -0
- package/src/skills/sdd-tasks/SKILL.md +142 -0
- package/src/skills/sdd-verify/SKILL.md +99 -0
- package/src/skills/thoth-mem-agents/SKILL.md +355 -0
- package/thoth-agents.schema.json +470 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { PluginInput } from '@opencode-ai/plugin';
|
|
2
|
+
import type { TmuxConfig } from '../config/schema';
|
|
3
|
+
/**
|
|
4
|
+
* Event shape for session events
|
|
5
|
+
*/
|
|
6
|
+
interface SessionEvent {
|
|
7
|
+
type: string;
|
|
8
|
+
properties?: {
|
|
9
|
+
info?: {
|
|
10
|
+
id?: string;
|
|
11
|
+
parentID?: string;
|
|
12
|
+
title?: string;
|
|
13
|
+
};
|
|
14
|
+
sessionID?: string;
|
|
15
|
+
status?: {
|
|
16
|
+
type: string;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* TmuxSessionManager tracks child sessions and spawns/closes tmux panes for them.
|
|
22
|
+
*
|
|
23
|
+
* Uses session.status events for completion detection instead of polling.
|
|
24
|
+
*/
|
|
25
|
+
export declare class TmuxSessionManager {
|
|
26
|
+
private client;
|
|
27
|
+
private tmuxConfig;
|
|
28
|
+
private serverUrl;
|
|
29
|
+
private sessions;
|
|
30
|
+
private pollInterval?;
|
|
31
|
+
private enabled;
|
|
32
|
+
constructor(ctx: PluginInput, tmuxConfig: TmuxConfig);
|
|
33
|
+
/**
|
|
34
|
+
* Handle session.created events.
|
|
35
|
+
* Spawns a tmux pane for child sessions (those with parentID).
|
|
36
|
+
*/
|
|
37
|
+
onSessionCreated(event: SessionEvent): Promise<void>;
|
|
38
|
+
/**
|
|
39
|
+
* Handle session.status events for completion detection.
|
|
40
|
+
* Uses session.status instead of deprecated session.idle.
|
|
41
|
+
*
|
|
42
|
+
* When a session becomes idle (completed), close its pane.
|
|
43
|
+
*/
|
|
44
|
+
onSessionStatus(event: SessionEvent): Promise<void>;
|
|
45
|
+
/**
|
|
46
|
+
* Handle session.deleted events.
|
|
47
|
+
* When a session is deleted, close its tmux pane immediately.
|
|
48
|
+
*/
|
|
49
|
+
onSessionDeleted(event: SessionEvent): Promise<void>;
|
|
50
|
+
private startPolling;
|
|
51
|
+
private stopPolling;
|
|
52
|
+
/**
|
|
53
|
+
* Poll sessions for status updates (fallback for reliability).
|
|
54
|
+
* Also handles timeout and missing session detection.
|
|
55
|
+
*/
|
|
56
|
+
private pollSessions;
|
|
57
|
+
private closeSession;
|
|
58
|
+
/**
|
|
59
|
+
* Clean up all tracked sessions.
|
|
60
|
+
*/
|
|
61
|
+
cleanup(): Promise<void>;
|
|
62
|
+
}
|
|
63
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { TmuxConfig } from '../config/schema';
|
|
2
|
+
/**
|
|
3
|
+
* Reset the server availability cache (useful when server might have started)
|
|
4
|
+
*/
|
|
5
|
+
export declare function resetServerCheck(): void;
|
|
6
|
+
/**
|
|
7
|
+
* Get cached tmux path, initializing if needed
|
|
8
|
+
*/
|
|
9
|
+
export declare function getTmuxPath(): Promise<string | null>;
|
|
10
|
+
/**
|
|
11
|
+
* Check if we're running inside tmux
|
|
12
|
+
*/
|
|
13
|
+
export declare function isInsideTmux(): boolean;
|
|
14
|
+
export interface SpawnPaneResult {
|
|
15
|
+
success: boolean;
|
|
16
|
+
paneId?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Spawn a new tmux pane running `opencode attach <serverUrl> --session <sessionId>`
|
|
20
|
+
* This connects the new TUI to the existing server so it receives streaming updates.
|
|
21
|
+
* After spawning, applies the configured layout to auto-rebalance all panes.
|
|
22
|
+
* Returns the pane ID so it can be closed later.
|
|
23
|
+
*/
|
|
24
|
+
export declare function spawnTmuxPane(sessionId: string, description: string, config: TmuxConfig, serverUrl: string): Promise<SpawnPaneResult>;
|
|
25
|
+
/**
|
|
26
|
+
* Close a tmux pane by its ID and reapply layout to rebalance remaining panes
|
|
27
|
+
*/
|
|
28
|
+
export declare function closeTmuxPane(paneId: string): Promise<boolean>;
|
|
29
|
+
/**
|
|
30
|
+
* Start background check for tmux availability
|
|
31
|
+
*/
|
|
32
|
+
export declare function startTmuxCheck(): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function extractZip(archivePath: string, destDir: string): Promise<void>;
|
package/package.json
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "thoth-agents",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Delegate-first OpenCode plugin with seven agents, thoth-mem persistence, and bundled SDD skills.",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"bin": {
|
|
8
|
+
"thoth-agents": "./dist/cli/index.js"
|
|
9
|
+
},
|
|
10
|
+
"type": "module",
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"engines": {
|
|
13
|
+
"node": ">=22.13"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"opencode",
|
|
17
|
+
"opencode-plugin",
|
|
18
|
+
"ai",
|
|
19
|
+
"agents",
|
|
20
|
+
"orchestration",
|
|
21
|
+
"llm",
|
|
22
|
+
"claude",
|
|
23
|
+
"gpt",
|
|
24
|
+
"gemini"
|
|
25
|
+
],
|
|
26
|
+
"repository": {
|
|
27
|
+
"type": "git",
|
|
28
|
+
"url": "https://github.com/EremesNG/thoth-agents"
|
|
29
|
+
},
|
|
30
|
+
"bugs": {
|
|
31
|
+
"url": "https://github.com/EremesNG/thoth-agents/issues"
|
|
32
|
+
},
|
|
33
|
+
"homepage": "https://github.com/EremesNG/thoth-agents#readme",
|
|
34
|
+
"files": [
|
|
35
|
+
"dist",
|
|
36
|
+
"src/skills",
|
|
37
|
+
"src/skills/_shared",
|
|
38
|
+
"thoth-agents.schema.json",
|
|
39
|
+
"README.md",
|
|
40
|
+
"LICENSE"
|
|
41
|
+
],
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"@ast-grep/cli": "^0.40.0",
|
|
44
|
+
"@modelcontextprotocol/sdk": "^1.26.0",
|
|
45
|
+
"@opencode-ai/plugin": "1.4.7",
|
|
46
|
+
"@opencode-ai/sdk": "1.4.7",
|
|
47
|
+
"unique-names-generator": "^4.7.1",
|
|
48
|
+
"vscode-jsonrpc": "^8.2.0",
|
|
49
|
+
"vscode-languageserver-protocol": "^3.17.5",
|
|
50
|
+
"which": "^6.0.0",
|
|
51
|
+
"zod": "^4.1.8"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"@biomejs/biome": "2.4.2",
|
|
55
|
+
"@types/node": "^22.19.19",
|
|
56
|
+
"@types/which": "^3.0.4",
|
|
57
|
+
"tsup": "^8.5.1",
|
|
58
|
+
"tsx": "4.22.2",
|
|
59
|
+
"typescript": "^5.9.3",
|
|
60
|
+
"vitest": "4.1.6"
|
|
61
|
+
},
|
|
62
|
+
"overrides": {
|
|
63
|
+
"hono": "4.12.19",
|
|
64
|
+
"postcss": "8.5.14",
|
|
65
|
+
"tsx": "4.22.2"
|
|
66
|
+
},
|
|
67
|
+
"scripts": {
|
|
68
|
+
"build": "tsup && tsc --emitDeclarationOnly && pnpm run generate-schema",
|
|
69
|
+
"generate-schema": "tsx scripts/generate-schema.ts",
|
|
70
|
+
"typecheck": "tsc --noEmit",
|
|
71
|
+
"test": "vitest run",
|
|
72
|
+
"lint": "biome lint .",
|
|
73
|
+
"format": "biome format . --write",
|
|
74
|
+
"check": "biome check --write .",
|
|
75
|
+
"check:ci": "biome check .",
|
|
76
|
+
"dev": "pnpm run build && opencode",
|
|
77
|
+
"release:patch": "npm version patch && git push --follow-tags && npm publish",
|
|
78
|
+
"release:minor": "npm version minor && git push --follow-tags && npm publish",
|
|
79
|
+
"release:major": "npm version major && git push --follow-tags && npm publish"
|
|
80
|
+
}
|
|
81
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# OpenSpec Convention
|
|
2
|
+
|
|
3
|
+
## Harness Scope
|
|
4
|
+
|
|
5
|
+
OpenSpec artifacts are harness-independent filesystem artifacts. The canonical
|
|
6
|
+
`openspec/` paths, filenames, and archive layout do not change across adapter
|
|
7
|
+
bindings.
|
|
8
|
+
|
|
9
|
+
This file defines harness-neutral artifact semantics. Any runtime-specific file
|
|
10
|
+
read/write, delegation, or blocking user input surface is an adapter binding
|
|
11
|
+
and must preserve the canonical behavior described here. If a runtime lacks a
|
|
12
|
+
required primitive, treat it as an unsupported-capability and report the
|
|
13
|
+
limitation instead of changing artifact semantics.
|
|
14
|
+
|
|
15
|
+
## Mode Scope
|
|
16
|
+
|
|
17
|
+
This convention applies only when the artifact store mode includes OpenSpec:
|
|
18
|
+
`openspec` and `hybrid`.
|
|
19
|
+
|
|
20
|
+
- In `thoth-mem` mode, skip canonical `openspec/` file writes.
|
|
21
|
+
- In `thoth-mem` mode, skip filesystem artifact recovery.
|
|
22
|
+
|
|
23
|
+
## Pre-flight Validation
|
|
24
|
+
|
|
25
|
+
When the selected persistence mode includes OpenSpec (`openspec` or `hybrid`),
|
|
26
|
+
every SDD skill must verify this structure before proceeding:
|
|
27
|
+
|
|
28
|
+
1. `openspec/config.yaml` exists
|
|
29
|
+
2. `openspec/specs/` exists
|
|
30
|
+
3. `openspec/changes/` exists
|
|
31
|
+
|
|
32
|
+
If any required item is missing:
|
|
33
|
+
|
|
34
|
+
- STOP and inform the orchestrator that `openspec/` is not initialized.
|
|
35
|
+
- Recommend running the `sdd-init` skill first.
|
|
36
|
+
- Do NOT attempt to create the structure in that skill.
|
|
37
|
+
|
|
38
|
+
If all required items exist, continue normally.
|
|
39
|
+
|
|
40
|
+
## Directory Structure
|
|
41
|
+
|
|
42
|
+
```text
|
|
43
|
+
openspec/
|
|
44
|
+
├── config.yaml
|
|
45
|
+
├── specs/
|
|
46
|
+
│ └── {domain}/spec.md
|
|
47
|
+
└── changes/
|
|
48
|
+
├── archive/
|
|
49
|
+
└── {change-name}/
|
|
50
|
+
├── proposal.md
|
|
51
|
+
├── specs/
|
|
52
|
+
│ └── {domain}/spec.md
|
|
53
|
+
├── design.md
|
|
54
|
+
├── tasks.md
|
|
55
|
+
└── verify-report.md
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Canonical Artifacts
|
|
59
|
+
|
|
60
|
+
| Artifact | Canonical path | Notes |
|
|
61
|
+
| --- | --- | --- |
|
|
62
|
+
| Proposal | `openspec/changes/{change-name}/proposal.md` | Intent, scope, approach |
|
|
63
|
+
| Delta specs | `openspec/changes/{change-name}/specs/{domain}/spec.md` | Use one file per domain |
|
|
64
|
+
| Main specs | `openspec/specs/{domain}/spec.md` | Source of truth after archive |
|
|
65
|
+
| Design | `openspec/changes/{change-name}/design.md` | Architecture and file plan |
|
|
66
|
+
| Tasks | `openspec/changes/{change-name}/tasks.md` | Checkbox checklist updated by apply |
|
|
67
|
+
| Verify report | `openspec/changes/{change-name}/verify-report.md` | Compliance matrix and evidence |
|
|
68
|
+
|
|
69
|
+
`apply-progress` and `archive-report` are durable SDD artifacts, but they are
|
|
70
|
+
primarily persisted through thoth-mem topic keys when the mode includes
|
|
71
|
+
thoth-mem.
|
|
72
|
+
|
|
73
|
+
The canonical OpenSpec copy is the filesystem representation of these artifacts
|
|
74
|
+
for `openspec` and `hybrid` modes. thoth-mem topic keys are the memory
|
|
75
|
+
representation when the mode includes thoth-mem; neither representation changes
|
|
76
|
+
the harness-neutral artifact names or lifecycle.
|
|
77
|
+
|
|
78
|
+
## Writing Rules
|
|
79
|
+
|
|
80
|
+
- Preserve canonical filenames and locations.
|
|
81
|
+
- Read an existing artifact before rewriting it.
|
|
82
|
+
- Keep change-specific artifacts under
|
|
83
|
+
`openspec/changes/{change-name}/...`.
|
|
84
|
+
- Keep long-lived specs under `openspec/specs/{domain}/spec.md`.
|
|
85
|
+
- Archive completed changes under
|
|
86
|
+
`openspec/changes/archive/YYYY-MM-DD-{change-name}/`.
|
|
87
|
+
|
|
88
|
+
## Artifact Content Rules
|
|
89
|
+
|
|
90
|
+
- `proposal.md` explains why the change exists.
|
|
91
|
+
- `spec.md` uses RFC 2119 keywords and Given/When/Then scenarios (full pipeline only).
|
|
92
|
+
- `design.md` explains how the change will be implemented (full pipeline only).
|
|
93
|
+
- `tasks.md` is phase-based and uses Markdown checkboxes.
|
|
94
|
+
- `verify-report.md` maps acceptance criteria to executed evidence: spec
|
|
95
|
+
scenarios in full pipeline, proposal success criteria in accelerated pipeline.
|
|
96
|
+
|
|
97
|
+
Progress tracking surfaces may mirror task status for user visibility, but
|
|
98
|
+
`tasks.md` remains the canonical OpenSpec task artifact whenever the selected
|
|
99
|
+
persistence mode includes OpenSpec.
|
|
100
|
+
|
|
101
|
+
## `config.yaml` Shape
|
|
102
|
+
|
|
103
|
+
```yaml
|
|
104
|
+
schema: spec-driven
|
|
105
|
+
|
|
106
|
+
context: |
|
|
107
|
+
Project background, stack, and constraints.
|
|
108
|
+
|
|
109
|
+
rules:
|
|
110
|
+
proposal:
|
|
111
|
+
- Proposal-specific guidance
|
|
112
|
+
specs:
|
|
113
|
+
- Require RFC 2119 keywords
|
|
114
|
+
- Require Given/When/Then scenarios
|
|
115
|
+
design:
|
|
116
|
+
- Document architecture decisions with rationale
|
|
117
|
+
tasks:
|
|
118
|
+
- Use phased checklists with hierarchical numbering
|
|
119
|
+
apply:
|
|
120
|
+
- Match repository conventions
|
|
121
|
+
tdd: false
|
|
122
|
+
test_command: ''
|
|
123
|
+
verify:
|
|
124
|
+
test_command: ''
|
|
125
|
+
build_command: ''
|
|
126
|
+
coverage_threshold: 0
|
|
127
|
+
archive:
|
|
128
|
+
- Warn before destructive merges
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Treat `rules` entries as mandatory phase-specific constraints whenever present.
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
# Persistence Contract
|
|
2
|
+
|
|
3
|
+
## Supported Persistence Modes
|
|
4
|
+
|
|
5
|
+
| Mode | Read order | Write targets | Use when |
|
|
6
|
+
| --- | --- | --- | --- |
|
|
7
|
+
| `thoth-mem` | thoth-mem only | thoth-mem only | The user wants no repo artifact changes |
|
|
8
|
+
| `openspec` | filesystem only | OpenSpec files only | The user wants visible repo artifacts without memory overhead |
|
|
9
|
+
| `hybrid` | thoth-mem, then filesystem fallback | thoth-mem and OpenSpec files | The change should survive compaction and exist in the repo |
|
|
10
|
+
| `none` | orchestrator prompt context only | nowhere (inline response only) | Ephemeral exploration, privacy-sensitive work, or no persistence backend available |
|
|
11
|
+
|
|
12
|
+
SDD skills MUST obey the selected artifact store mode. Do not reference or rely
|
|
13
|
+
on engram.
|
|
14
|
+
|
|
15
|
+
## Mode Rules
|
|
16
|
+
|
|
17
|
+
### `thoth-mem`
|
|
18
|
+
|
|
19
|
+
1. Read SDD artifacts from thoth-mem only.
|
|
20
|
+
2. Write SDD artifacts to thoth-mem only.
|
|
21
|
+
3. Do not create or modify canonical `openspec/` artifacts.
|
|
22
|
+
|
|
23
|
+
### `openspec`
|
|
24
|
+
|
|
25
|
+
1. Read SDD artifacts from canonical OpenSpec paths only.
|
|
26
|
+
2. Write SDD artifacts to canonical OpenSpec paths only.
|
|
27
|
+
3. Do not call thoth-mem save or recovery tools.
|
|
28
|
+
|
|
29
|
+
### `none`
|
|
30
|
+
|
|
31
|
+
1. Read SDD artifacts from orchestrator prompt context only.
|
|
32
|
+
2. Do not persist artifacts to any external store.
|
|
33
|
+
3. Return all artifacts as inline text in the response.
|
|
34
|
+
4. Do not call thoth-mem save tools.
|
|
35
|
+
5. Do not create or modify OpenSpec files.
|
|
36
|
+
6. Recommend enabling `thoth-mem` or `openspec` for persistent work.
|
|
37
|
+
|
|
38
|
+
## Hybrid Rules
|
|
39
|
+
|
|
40
|
+
When running in `hybrid` mode:
|
|
41
|
+
|
|
42
|
+
1. Write the canonical OpenSpec artifact to the filesystem.
|
|
43
|
+
2. Persist the same full artifact to thoth-mem with a deterministic `topic_key`.
|
|
44
|
+
3. Treat the operation as complete only when both writes succeed.
|
|
45
|
+
4. If filesystem and memory diverge, repair them immediately by rewriting the
|
|
46
|
+
stale copy from the freshest full artifact.
|
|
47
|
+
|
|
48
|
+
## Memory Ownership
|
|
49
|
+
|
|
50
|
+
Memory responsibilities are split by semantic role between orchestrator and
|
|
51
|
+
sub-agents:
|
|
52
|
+
|
|
53
|
+
**Orchestrator owns general memory:**
|
|
54
|
+
- Decisions, discoveries, bug fixes, session summaries
|
|
55
|
+
- Progress checkpoints (SDD task state updates)
|
|
56
|
+
- User preferences and configuration notes
|
|
57
|
+
|
|
58
|
+
**Sub-agents write deterministic SDD artifacts:**
|
|
59
|
+
- Canonical SDD artifacts with topic_key matching `sdd/{change}/{artifact}`
|
|
60
|
+
- Includes: proposal, spec, design, tasks, apply-progress, verify-report,
|
|
61
|
+
archive-report, state
|
|
62
|
+
- Sub-agents persist these directly when the active mode includes thoth-mem
|
|
63
|
+
- Sub-agents do NOT write general memory observations
|
|
64
|
+
|
|
65
|
+
This split preserves artifact nuance (sub-agents have full context when writing)
|
|
66
|
+
while keeping general memory centralized under orchestrator control. In
|
|
67
|
+
harnesses that cannot hard-enforce the split, treat it as instruction-level
|
|
68
|
+
governance and disclose any unsupported-capability that prevents compliance.
|
|
69
|
+
|
|
70
|
+
## Retrieval Protocol
|
|
71
|
+
|
|
72
|
+
### 3-Layer Recall for thoth-mem and hybrid modes
|
|
73
|
+
|
|
74
|
+
Always complete the full 3-layer recall before using content as source material:
|
|
75
|
+
|
|
76
|
+
1. **Layer 1 (Compact Index):** call the memory tool binding for `mem_search`
|
|
77
|
+
with compact mode to scan observation IDs and titles. This is the most
|
|
78
|
+
token-efficient entry point.
|
|
79
|
+
2. **Layer 2 (Timeline Context):** call the memory tool binding for
|
|
80
|
+
`mem_timeline` to retrieve chronological context (before/after
|
|
81
|
+
observations) to disambiguate or verify the correct artifact.
|
|
82
|
+
3. **Layer 3 (Full Body):** call the memory tool binding for
|
|
83
|
+
`mem_get_observation` to retrieve the complete artifact body for use as
|
|
84
|
+
source material.
|
|
85
|
+
|
|
86
|
+
**Mode guidance:**
|
|
87
|
+
- Use `mode: "compact"` (default) for most queries; it returns only IDs and
|
|
88
|
+
titles.
|
|
89
|
+
- Use `mode: "preview"` only when compact results are insufficient to
|
|
90
|
+
disambiguate between multiple candidates.
|
|
91
|
+
|
|
92
|
+
**Never treat `mem_search` output—compact or preview—as the artifact body.**
|
|
93
|
+
Always complete the 3-layer recall before using content as source material.
|
|
94
|
+
|
|
95
|
+
### Mode-specific retrieval
|
|
96
|
+
|
|
97
|
+
1. If the mode is `thoth-mem`, apply the 3-layer recall with the exact SDD
|
|
98
|
+
topic key.
|
|
99
|
+
2. If the mode is `openspec`, read the canonical OpenSpec path from the
|
|
100
|
+
filesystem only.
|
|
101
|
+
3. If the mode is `hybrid`, apply the 3-layer recall with the exact SDD topic
|
|
102
|
+
key.
|
|
103
|
+
4. In `hybrid`, if nothing is found in thoth-mem, read the canonical OpenSpec
|
|
104
|
+
path from the filesystem.
|
|
105
|
+
5. In `hybrid`, if filesystem recovery succeeds, re-save the artifact to
|
|
106
|
+
thoth-mem so the two stores converge again.
|
|
107
|
+
6. If the mode is `none`, read artifacts from the orchestrator prompt context
|
|
108
|
+
only. Do not attempt to retrieve from thoth-mem or filesystem.
|
|
109
|
+
|
|
110
|
+
## Artifact Ownership
|
|
111
|
+
|
|
112
|
+
- `sdd-propose` persists `sdd/{change-name}/proposal`
|
|
113
|
+
- `sdd-spec` persists `sdd/{change-name}/spec`
|
|
114
|
+
- `sdd-design` persists `sdd/{change-name}/design`
|
|
115
|
+
- `sdd-tasks` persists `sdd/{change-name}/tasks`
|
|
116
|
+
- `sdd-apply` persists `sdd/{change-name}/apply-progress` and re-persists
|
|
117
|
+
updated `sdd/{change-name}/tasks`
|
|
118
|
+
- `sdd-verify` persists `sdd/{change-name}/verify-report`
|
|
119
|
+
- `sdd-archive` persists `sdd/{change-name}/archive-report`
|
|
120
|
+
- `state` persists `sdd/{change-name}/state`
|
|
121
|
+
|
|
122
|
+
## Governance Placement
|
|
123
|
+
|
|
124
|
+
- The artifact governance validator is **report-only**.
|
|
125
|
+
- It runs after `sdd-tasks` produces the canonical checklist and before any
|
|
126
|
+
future `sdd-apply` entrypoint consumes the report.
|
|
127
|
+
- It does **not** replace `plan-reviewer` or `executing-plans`.
|
|
128
|
+
- It does **not** mark task state, enforce execution, or alter review gating.
|
|
129
|
+
- Root-session memory and progress checkpoints remain orchestrator-owned;
|
|
130
|
+
sub-agents may surface governance findings, but they must stay within the
|
|
131
|
+
active artifact store mode and delegate-first boundaries.
|
|
132
|
+
|
|
133
|
+
## Pipeline Type Impact on Prerequisites
|
|
134
|
+
|
|
135
|
+
The orchestrator passes `pipeline-type` (`accelerated` or `full`) alongside the
|
|
136
|
+
persistence mode. This affects which artifacts each skill requires:
|
|
137
|
+
|
|
138
|
+
| Artifact | Full pipeline | Accelerated pipeline |
|
|
139
|
+
| --- | --- | --- |
|
|
140
|
+
| Proposal | Required by all phases | Required by all phases (serves as acceptance reference) |
|
|
141
|
+
| Spec | Required by design, tasks, apply, verify, archive | Not produced; not required |
|
|
142
|
+
| Design | Required by tasks, apply, verify, archive | Not produced; not required |
|
|
143
|
+
| Tasks | Required by apply, verify, archive | Required by apply, verify, archive |
|
|
144
|
+
| Verify report | Required by archive | Required by archive |
|
|
145
|
+
|
|
146
|
+
In accelerated pipeline, the proposal serves as the acceptance reference where
|
|
147
|
+
specs would normally be used. Skills must adapt their retrieval, compliance
|
|
148
|
+
checks, and archive behavior accordingly.
|
|
149
|
+
|
|
150
|
+
## Recovery Notes
|
|
151
|
+
|
|
152
|
+
- Prefer exact topic-key queries over fuzzy natural-language search.
|
|
153
|
+
- Always use the 3-layer recall (`mem_search` → `mem_timeline` →
|
|
154
|
+
`mem_get_observation`) before treating an artifact as source material.
|
|
155
|
+
- If multiple observations match in `mem_search`, use `mem_timeline` to inspect
|
|
156
|
+
chronological context and disambiguate.
|
|
157
|
+
- In `openspec` mode, repair missing or stale artifacts by rewriting the
|
|
158
|
+
canonical OpenSpec file only.
|
|
159
|
+
- In `thoth-mem` mode, repair missing or stale artifacts by re-saving the full
|
|
160
|
+
artifact to thoth-mem only.
|
|
161
|
+
- In `hybrid` mode, use the filesystem copy only as fallback or repair input,
|
|
162
|
+
then converge both stores.
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
# thoth-mem Convention
|
|
2
|
+
|
|
3
|
+
## Harness Scope
|
|
4
|
+
|
|
5
|
+
This convention defines harness-neutral thoth-mem semantics for SDD artifacts.
|
|
6
|
+
Tool names are adapter bindings, not universal semantics. Use the thoth-mem
|
|
7
|
+
operation names (`mem_search`, `mem_timeline`, `mem_get_observation`,
|
|
8
|
+
`mem_save`, `mem_update`) as the portable vocabulary and map them to the
|
|
9
|
+
callable tool names exposed by the active binding surface.
|
|
10
|
+
|
|
11
|
+
If a needed thoth-mem operation is not available, treat it as an
|
|
12
|
+
unsupported-capability, disclose the limitation, and do not pretend
|
|
13
|
+
persistence or recovery succeeded.
|
|
14
|
+
|
|
15
|
+
Governance that a harness cannot hard-enforce remains instruction-level:
|
|
16
|
+
semantic role ownership, parent session/project scoping, prompt-save
|
|
17
|
+
prohibitions, and SDD topic-key namespace protection still apply.
|
|
18
|
+
|
|
19
|
+
## Mode Scope
|
|
20
|
+
|
|
21
|
+
This convention applies only when the artifact store mode includes thoth-mem:
|
|
22
|
+
`thoth-mem` and `hybrid`.
|
|
23
|
+
|
|
24
|
+
- In `openspec` mode, skip thoth-mem saves.
|
|
25
|
+
- In `openspec` mode, skip thoth-mem recovery and use filesystem artifacts
|
|
26
|
+
instead.
|
|
27
|
+
|
|
28
|
+
## Tool Names
|
|
29
|
+
|
|
30
|
+
Use the thoth-mem operation names through the active binding surface. Prefer
|
|
31
|
+
the callable names actually exposed by the runtime.
|
|
32
|
+
|
|
33
|
+
## Topic Key Format
|
|
34
|
+
|
|
35
|
+
All SDD artifacts use this deterministic pattern:
|
|
36
|
+
|
|
37
|
+
```text
|
|
38
|
+
sdd/{change-name}/{artifact}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Supported artifact names:
|
|
42
|
+
|
|
43
|
+
- `proposal`
|
|
44
|
+
- `spec`
|
|
45
|
+
- `design`
|
|
46
|
+
- `design-brief`
|
|
47
|
+
- `tasks`
|
|
48
|
+
- `apply-progress`
|
|
49
|
+
- `verify-report`
|
|
50
|
+
- `archive-report`
|
|
51
|
+
- `state`
|
|
52
|
+
|
|
53
|
+
Use the same value for `title` and `topic_key` unless there is a strong reason
|
|
54
|
+
not to.
|
|
55
|
+
|
|
56
|
+
## State Artifact Format
|
|
57
|
+
|
|
58
|
+
The orchestrator semantic role persists a lightweight state checkpoint after
|
|
59
|
+
each SDD phase transition to enable recovery:
|
|
60
|
+
|
|
61
|
+
```yaml
|
|
62
|
+
change: {change-name}
|
|
63
|
+
phase: {last-completed-phase}
|
|
64
|
+
mode: {thoth-mem|openspec|hybrid|none}
|
|
65
|
+
pipeline: {accelerated|full}
|
|
66
|
+
artifacts:
|
|
67
|
+
proposal: true
|
|
68
|
+
spec: false # always false in accelerated pipeline
|
|
69
|
+
design: false # always false in accelerated pipeline
|
|
70
|
+
tasks: false
|
|
71
|
+
apply-progress: false
|
|
72
|
+
verify-report: false
|
|
73
|
+
archive-report: false
|
|
74
|
+
last_updated: {ISO 8601 timestamp}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Save with the memory tool binding for `mem_save`, using the canonical SDD
|
|
78
|
+
topic key and the required metadata fields:
|
|
79
|
+
`title`, `topic_key`, `type`, `project`, `scope`, and `content`.
|
|
80
|
+
|
|
81
|
+
Recovery: `mem_search("sdd/{change-name}/state")` using the active binding
|
|
82
|
+
surface → `mem_timeline(id)` when needed for chronology →
|
|
83
|
+
`mem_get_observation(id)` → parse YAML → restore phase state.
|
|
84
|
+
|
|
85
|
+
## Three-Layer Recall Protocol
|
|
86
|
+
|
|
87
|
+
1. **Scan compact index** by exact topic key:
|
|
88
|
+
|
|
89
|
+
Use the memory tool binding for `mem_search` with
|
|
90
|
+
`query: "topic_key:sdd/{change-name}/{artifact}"`, `project`, and
|
|
91
|
+
`mode: "compact"`.
|
|
92
|
+
|
|
93
|
+
Use `mode: "compact"` (the default) for token efficiency. Switch to `mode: "preview"`
|
|
94
|
+
only when compact results are insufficient to disambiguate between multiple results.
|
|
95
|
+
|
|
96
|
+
2. **Get chronological context** around the found observation:
|
|
97
|
+
|
|
98
|
+
Use the memory tool binding for `mem_timeline` with `observation_id`,
|
|
99
|
+
`before`, and `after`.
|
|
100
|
+
|
|
101
|
+
This shows related observations in the same session, helping you understand the
|
|
102
|
+
artifact's evolution and dependencies.
|
|
103
|
+
|
|
104
|
+
3. **Retrieve full artifact content**:
|
|
105
|
+
|
|
106
|
+
Use the memory tool binding for `mem_get_observation` with the observation ID.
|
|
107
|
+
|
|
108
|
+
Search returns compact results (IDs + titles) by default. Neither compact nor
|
|
109
|
+
preview mode returns the full artifact body. Always complete the 3-layer recall
|
|
110
|
+
to get the actual content.
|
|
111
|
+
|
|
112
|
+
## Save Contract
|
|
113
|
+
|
|
114
|
+
**CRITICAL:** The orchestrator MUST persist the state artifact after each SDD
|
|
115
|
+
phase transition. This is the canonical checkpoint for resume/recovery.
|
|
116
|
+
|
|
117
|
+
Persist SDD artifacts with a stable topic key so repeated saves upsert instead
|
|
118
|
+
of creating duplicates:
|
|
119
|
+
|
|
120
|
+
Use the memory tool binding for `mem_save` with the canonical SDD topic key
|
|
121
|
+
and the full artifact markdown in `content`.
|
|
122
|
+
|
|
123
|
+
For `sdd-apply`, save the progress report under `apply-progress` and re-save the
|
|
124
|
+
updated task list under `tasks` after checkboxes change.
|