Skip to content

Commit 0fbe82b

Browse files
authored
feat(plugin): synapse-coder-reporter learning-loop integration + companion plugins (#1)
* feat(plugin): add synapse-coder-reporter learning-loop plugin Detects LSP diagnostics after edit/write/apply_patch, holds the failing edit as pending, and reports an original->corrected pair to the Synapse Coder staging MCP (coder_report_correction) only when a follow-up same-file edit lands clean — the live schema requires non-empty original/corrected, so one-sided detections are dropped after 30 min. - Env-var opt-in gate (SYNAPSE_CODER_REPORTER_ENABLED, default off) with first-use TUI toast (once-per-project marker) - Offline queue (.opencode/synapse-coder-queue.json) with retry on load + 5-min timer; fire-and-forget hooks (no await on report path) - MCP wiring for synapse-coder + Alterspective servers in .opencode/opencode.jsonc (local entries fixed to schema shape) - 28 tests covering detection, pairing rules, opt-in, queue, model tracking, fire-and-forget, first-use toast - Plan/evidence docs under docs/implementation/current/SYN-001-* * feat(plugin): add alterspective-rag-standards system-prompt plugin Statically injects Alterspective standards awareness (rule-ID citation, RAG-first routing via rag_search/rag_ask, standards index pointers) into the chat system prompt via the experimental.chat.system.transform hook. Opt-out via ALTERSPECTIVE_STANDARDS_INJECTION_DISABLED=true or ALTERSPECTIVE_STANDARDS_INJECTION_ENABLED=false. 6 tests. * feat(scripts): add health/version sidecar for the opencode server Standalone HTTP sidecar exposing /health and /version (upstream probe optional via OPENCODE_SERVER_URL) — the fork-local fallback for operational visibility, since adding routes would touch high-churn upstream server files. 5 tests. * docs: mark ISS-002 resolved (global payload doc corrected + deployed)
1 parent a90c2b8 commit 0fbe82b

31 files changed

Lines changed: 2557 additions & 1 deletion

‎.opencode/.gitignore‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ bun.lock
55
.gitignore
66
package-lock.json
77
references/
8+
synapse-coder-queue.json
9+
synapse-coder-prompted

‎.opencode/opencode.jsonc‎

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,50 @@
1212
"description": "Contains opencode logs and data",
1313
},
1414
},
15-
"mcp": {},
15+
"mcp": {
16+
"synapse-coder": {
17+
"type": "remote",
18+
"url": "https://synapse-coder-mcp-staging.greenbay-703e5a45.australiaeast.azurecontainerapps.io/mcp",
19+
"headers": {
20+
"Authorization": "Bearer {env:SYNAPSE_CODER_STAGING_BEARER_TOKEN}",
21+
},
22+
},
23+
"alterspective-rag": {
24+
"type": "remote",
25+
"url": "https://rag.alterspective.com.au/mcp",
26+
"headers": {
27+
"Authorization": "Bearer {env:ALTERSPECTIVE_RAG_MCP_API_KEY}",
28+
},
29+
},
30+
"keystone": {
31+
"type": "remote",
32+
"url": "https://identity.alterspective.com.au/api/mcp",
33+
"headers": {
34+
"Authorization": "Bearer {env:KEYSTONE_AI_ADMIN_API_KEY}",
35+
},
36+
},
37+
"timely": {
38+
"type": "remote",
39+
"url": "https://timely-mcp.alterspective.com.au/mcp",
40+
},
41+
"sharedo": {
42+
"type": "remote",
43+
"url": "https://sharedo-api.alterspective.com.au/mcp",
44+
},
45+
"vault-local": {
46+
"type": "local",
47+
"command": ["node", "C:/GitHub/vault-mcp/dist/index.js"],
48+
"enabled": true,
49+
},
50+
"azure-devops": {
51+
"type": "local",
52+
"command": ["npx", "-y", "azure-devops-mcp"],
53+
"enabled": true,
54+
"environment": {
55+
"AZURE_DEVOPS_PAT": "{env:AZURE_DEVOPS_PAT}",
56+
},
57+
},
58+
},
1659
"tools": {
1760
"github-triage": false,
1861
"github-pr-search": false,
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import type { Plugin } from "@opencode-ai/plugin"
2+
3+
const STANDARDS_SYSTEM_PROMPT = `
4+
## Alterspective Standards Awareness
5+
6+
When asked about best practices, patterns, or standards, prefer Alterspective company standards over generic industry practices.
7+
8+
Alterspective standards are available via the \`alterspective-rag\` MCP server. Use the \`rag_search\` or \`rag_ask\` tools to query for relevant standards when:
9+
- The user asks "how to", "what's the best practice", "what's the standard for"
10+
- You're making architectural or pattern recommendations
11+
- You're reviewing code for compliance
12+
13+
Key standards areas and their rule ID prefixes:
14+
- Coding standards: WEBSTA-001-CODING-*
15+
- Testing standards: WEBSTA-001-TESTING / TST-VAL-*
16+
- Documentation standards: WEBSTA-001-DOCUMENTATION / DOC-*
17+
- Git standards: WEBSTA-001-GIT-STANDARDS / GIT-*
18+
- Error handling: WEBSTA-001-ERROR-HANDLING / ERR-*
19+
- Security: WEBSTA-001-SECURITY / SEC-*
20+
- UX/UI standards: UX-* (Active standards are mandatory)
21+
- MCP standards: WEBSTA-001-MCP-STANDARDS / MCP-*
22+
23+
When an Active standard applies:
24+
1. Cite the rule ID (e.g., CFG-WT-01, SEC-001)
25+
2. Flag violations explicitly
26+
3. Never silently deviate — if deviation is necessary, state the rule ID and reason
27+
4. Treat Draft standards as strong guidance
28+
29+
Standards routing indexes:
30+
- Web/API/CLI/infrastructure: load \`Principles/Web/standards/index.md\`
31+
- Sharedo platform: load \`Principles/Sharedo/standards/index.md\`
32+
- Both apply: load both indexes
33+
`.trim()
34+
35+
function injectionEnabled(): boolean {
36+
if (process.env.ALTERSPECTIVE_STANDARDS_INJECTION_DISABLED === "true") return false
37+
return process.env.ALTERSPECTIVE_STANDARDS_INJECTION_ENABLED !== "false"
38+
}
39+
40+
const plugin: Plugin = async () => {
41+
return {
42+
"experimental.chat.system.transform": async (_input, output) => {
43+
if (!injectionEnabled()) return
44+
output.system.push(STANDARDS_SYSTEM_PROMPT)
45+
},
46+
}
47+
}
48+
49+
export default plugin

0 commit comments

Comments
 (0)