@gramatr/opencode-plugin 0.20.83 → 0.20.84

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.
Files changed (2) hide show
  1. package/README.md +104 -0
  2. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,104 @@
1
+ <p align="center">
2
+ <img alt="grāmatr" src="https://gramatr.com/brand/g-dark-sq.png" width="128" height="128">
3
+ </p>
4
+
5
+ # @gramatr/opencode-plugin
6
+
7
+ grāmatr lifecycle plugin for [OpenCode](https://opencode.ai). Maps OpenCode's
8
+ plugin events (`session.created`, `message.updated`, `tool.execute.before`,
9
+ `session.idle`, `session.compacted`) to grāmatr hooks — pre-classifying every
10
+ prompt through the remote MCP server at `api.gramatr.com/mcp`, restoring
11
+ session continuity on start, and enforcing git-gate hard rules before
12
+ destructive shell commands run. Same intelligent context engineering layer
13
+ used across Claude Code, ChatGPT, Cursor, Codex, and Gemini.
14
+
15
+ ## What you get
16
+
17
+ - **Cheaper, faster prompts.** A multi-head classification pipeline pre-routes
18
+ each request and replaces the tens-of-thousands-token system prompt you'd
19
+ otherwise hand-maintain. The effect compounds the longer you work.
20
+ - **Consistent behavior across sessions.** The same contract — directives plus
21
+ quality gates — runs on every prompt, so your AI acts the same on session
22
+ 200 as on session 1.
23
+ - **Continuity across tools.** A session you start in OpenCode resumes
24
+ cleanly in Claude Code, Cursor, or the web — the handoff is persisted by
25
+ the same backend.
26
+ - **Auditable safety rails.** Per-prompt hard gates (e.g. `git push --force`
27
+ to `main` is blocked locally before the tool runs).
28
+
29
+ ## Install
30
+
31
+ Add both entries to your `opencode.json`:
32
+
33
+ ```json
34
+ {
35
+ "mcp": {
36
+ "gramatr": {
37
+ "type": "remote",
38
+ "url": "https://api.gramatr.com/mcp",
39
+ "enabled": true
40
+ }
41
+ },
42
+ "plugin": [
43
+ "@gramatr/opencode-plugin"
44
+ ]
45
+ }
46
+ ```
47
+
48
+ OpenCode will fetch the package from npm on next start. No global install
49
+ required.
50
+
51
+ ## Authentication
52
+
53
+ The remote MCP connector authenticates via OAuth 2.0 Device Authorization
54
+ Grant ([RFC 8628](https://datatracker.ietf.org/doc/html/rfc8628)). On first
55
+ connect, OpenCode prompts you to visit a short URL and paste a user code —
56
+ the same flow used in SSH, WSL, and CI environments where a browser
57
+ redirect can't reach the client. Tokens are stored by OpenCode's MCP
58
+ client; the plugin never handles raw credentials.
59
+
60
+ If you don't have a grāmatr account yet, sign up at
61
+ [gramatr.com](https://gramatr.com).
62
+
63
+ ## How it works
64
+
65
+ ```
66
+ OpenCode
67
+
68
+ ├── plugin: @gramatr/opencode-plugin ──┐
69
+ │ │ lifecycle events
70
+ │ │ (session.created, message.updated, …)
71
+ │ ▼
72
+ └── mcp.gramatr (remote, OAuth) ──► api.gramatr.com/mcp
73
+ (route_request, load_handoff,
74
+ save_reflection, …)
75
+ ```
76
+
77
+ The plugin is a thin connector: every grāmatr hook is invoked against the
78
+ already-connected remote MCP server declared in the `mcp` block — there is
79
+ no local binary, no `execSync`, no shell-out. Guidance from the server is
80
+ injected into the active session as a `noReply` system message so the model
81
+ sees it before formulating its next response.
82
+
83
+ When OpenCode's plugin API exposes a typed `client.callTool()`, the
84
+ connector will switch to direct MCP tool invocation and drop the
85
+ prompt-injection path.
86
+
87
+ ## Requirements
88
+
89
+ - OpenCode with `@opencode-ai/plugin` ≥ 1.0.0
90
+ - Node.js ≥ 22
91
+ - Network access to `https://api.gramatr.com/mcp`
92
+
93
+ ## Links
94
+
95
+ - Docs: [gramatr.com/docs](https://gramatr.com/docs)
96
+ - OpenCode plugin reference: [opencode.ai/docs/plugins](https://opencode.ai/docs/plugins/)
97
+ - Source manifest: [`contracts/mcp/opencode-plugin-manifest.yaml`](https://github.com/gramatr/gramatr/blob/main/contracts/mcp/opencode-plugin-manifest.yaml)
98
+ - Privacy: [gramatr.com/privacy](https://gramatr.com/privacy/)
99
+ - Terms: [gramatr.com/terms](https://gramatr.com/terms/)
100
+ - Support: [support@gramatr.com](mailto:support@gramatr.com)
101
+
102
+ ## License
103
+
104
+ See [LICENSE](LICENSE) in this package.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gramatr/opencode-plugin",
3
- "version": "0.20.83",
3
+ "version": "0.20.84",
4
4
  "description": "grāmatr lifecycle plugin for OpenCode — maps OpenCode plugin events to grāmatr hooks via the connected MCP client (route_request injection, session continuity, git-gate).",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "publishConfig": {