@jetrabbits/agentic 0.1.0 → 0.3.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.
@@ -104,11 +104,11 @@ Every copied or generated file carries an internal marker. Markdown uses YAML fr
104
104
 
105
105
  ## MemPalace install and validation logs
106
106
 
107
- When MemPalace MCP is enabled during interactive install, `agentic` now reports setup progress in explicit steps so users can see what succeeded or failed:
107
+ When MemPalace MCP is enabled during interactive install, TUI install, or through `AGENTIC_ENABLE_MEMPALACE=y`, `agentic` now reports setup progress in explicit steps so users can see what succeeded or failed:
108
108
 
109
109
  1. Python availability check
110
110
  2. pip availability check
111
111
  3. `pip install mempalace`
112
- 4. Project initialization (`mempalace init` and `mempalace mine`)
112
+ 4. Explicit skip log for automatic project initialization, plus optional manual `mempalace init`/`mempalace mine` instructions
113
113
 
114
- After setup, runtime validation uses `mempalace-mcp --help` (the MCP entrypoint) instead of validating only the Python module import path. This avoids false warnings where the package is installed successfully but a pre-install runtime probe ran too early.
114
+ If auto-install or runtime checks fail, `agentic` prints manual setup instructions and continues. After setup, install checks that `mempalace-mcp` is present and leaves runtime startup/tool validation to the post-install doctor smoke check. Generated MCP configs invoke `mempalace-mcp` without arguments for all supported agent targets.
@@ -0,0 +1,33 @@
1
+ # Agentic Stabilization v0.3.0
2
+
3
+ ## User-Facing Behavior
4
+
5
+ - Post-install doctor checks run independently for `codex`, `opencode`, `claude`, and `gemini`.
6
+ - `AGENTIC_DOCTOR_TIMEOUT_SECONDS` defaults to `10`; a timeout is reported as a doctor failure and install continues.
7
+ - Codex doctor runs non-interactively with `--ephemeral` and `--sandbox workspace-write`.
8
+ - OpenCode uses `agent-model-mapper` instead of the removed `model-checker` artifacts.
9
+ - `agent-model-mapper` writes `.opencode/opencode.json` during interactive install only after confirmation.
10
+ - `agent-model-mapper` uses `fzf` for install-time model dropdowns when available and OpenCode startup skips once all roles are mapped.
11
+ - The runtime OpenCode plugin never opens `fzf`, asks questions, or writes project files.
12
+ - Context7 no longer asks for an API key; it uses `CONTEXT7_API_KEY` when set and otherwise prints config-path guidance for adding one later.
13
+ - OpenCode MemPalace setup writes `mempalace-mcp` config without running `mempalace init` automatically.
14
+ - Telegram notification credentials are read only from `OPENCODE_TELEGRAM_BOT_TOKEN` and `OPENCODE_TELEGRAM_CHAT_ID`.
15
+ - MemPalace-enabled installs create a managed `.mempalaceignore` unless the target project already has one.
16
+ - Real Codex, OpenCode, and Telegram blackbox scenarios are part of `make test`.
17
+ - `make test-coverage` traces `agentic` through e2e runs and fails below 90% line coverage.
18
+
19
+ ## Acceptance Criteria
20
+
21
+ - Hung agent doctor commands time out and do not stop remaining selected agents from running.
22
+ - Doctor output includes timeout duration, exit status, and per-agent elapsed time.
23
+ - `extensions/opencode/plugins/model-checker.ts` and `model-checker.json` are absent.
24
+ - `extensions/opencode/opencode.json` lists `agent-model-mapper`.
25
+ - Runtime model mapper execution does not prompt or modify project files.
26
+ - Telegram plugin tests prove environment-only credentials and no secret output.
27
+ - Real blackbox tests print created files, instruction evidence, MCP usage prompts, and MemPalace fact prompts without printing Telegram secrets.
28
+
29
+ ## Operational Constraints
30
+
31
+ - `make test` now requires real `codex` and `opencode` binaries, working model auth, network access, Context7/MemPalace access, and Telegram credentials.
32
+ - Telegram credentials must never be committed or written to Agentic config.
33
+ - Coverage is line-based Bash trace coverage for the `agentic` script, not branch coverage.
@@ -54,7 +54,7 @@ OPENCODE_TELEGRAM_CHAT_ID
54
54
  - `.kilocode/mcp.json` for `kilocode`
55
55
  - `~/.gemini/antigravity/mcp_config.json` for `antigravity` (global user config)
56
56
 
57
- Interactive installs ask whether to enable Context7. If enabled, the Context7 API key is optional. Empty keys keep the install usable with default Context7 limits or rule-only fallback behavior. Non-interactive installs enable Context7 only when `CONTEXT7_API_KEY` is already set. Generated guidance requires agents to use Context7 for framework, SDK, library, and API documentation before relying on model memory when the project config is present.
57
+ Interactive installs ask whether to enable Context7. If enabled, Context7 is configured without a key unless `CONTEXT7_API_KEY` is already set; the install output prints the config path(s) and an example key placement. Non-interactive installs enable Context7 when either `AGENTIC_ENABLE_CONTEXT7=y` or `CONTEXT7_API_KEY` is set. Generated guidance requires agents to use Context7 for framework, SDK, library, and API documentation before relying on model memory when the project config is present.
58
58
 
59
59
  Directory copies are processed in batches so large specialization installs avoid spawning a separate marker/manifest process for every copied file. Manifest protection still applies: existing unmanaged files are skipped on rerun, user-modified managed files are skipped, and new generated files can be added by newer `agentic` versions.
60
60
 
@@ -30,6 +30,23 @@ Default behavior:
30
30
  - In non-interactive mode (CI/pipe): prints usage and exits with code `1`
31
31
  - For CI one-off execution, prefer `npx @jetrabbits/agentic@latest <command>`
32
32
 
33
+ ## Requirements
34
+
35
+ `agentic install` and `agentic tui` fail fast when required local tools are missing:
36
+
37
+ - Bash 3.2+.
38
+ - Python 3 as `python3`.
39
+ - pip as `pip3`, `pip`, or `python3 -m pip`.
40
+ - `shasum` or `sha256sum` for managed-file hashes.
41
+ - Git when installed mode needs to bootstrap or upgrade `~/.local/share/agentic/repo`.
42
+
43
+ Optional tools:
44
+
45
+ - `fzf` for interactive picker UI; index-based menus are used when it is unavailable.
46
+ - Node.js/npm only for the `npx @jetrabbits/agentic@latest` entrypoint.
47
+ - `curl` only for the bootstrap installer.
48
+ - Real agent binaries only for selected target recommendations and doctor checks.
49
+
33
50
  Install the standalone binary:
34
51
 
35
52
  ```bash
@@ -75,6 +92,26 @@ agentic install \
75
92
 
76
93
  After install, `agentic` writes `.agentic.json` in the target project. It records copied/generated files and their hashes. A later install rerun updates only manifest-managed files and skips files changed by the user. Generated guidance is written to root `AGENTS.md` for most agents and to `.opencode/AGENTS.md` when OpenCode is selected; multi-target installs that include OpenCode and another agent write both files.
77
94
 
95
+ After the project files are generated, `agentic` starts timestamped operational logging and mirrors install output to a temporary log file such as:
96
+
97
+ ```text
98
+ /tmp/agentic-20260512-114203.ABC123
99
+ ```
100
+
101
+ The final install line prints the exact path:
102
+
103
+ ```text
104
+ Agentic log file: /tmp/agentic-20260512-114203.ABC123
105
+ ```
106
+
107
+ `agentic` also runs a final doctor smoke check for selected real agent targets (`codex`, `opencode`, `claude`, `gemini`). The doctor runs in a temporary copy of the project and prints one status row per selected agent. OpenCode uses a lightweight pure smoke prompt instead of the full `develop-feature` command, so install-time doctor checks do not start a long SDLC workflow. Each agent has an independent timeout controlled by `AGENTIC_DOCTOR_TIMEOUT_SECONDS` and defaults to `10` seconds. Doctor failures and timeouts are reported but do not roll back or fail the install. Disable doctor for cheap checks with:
108
+
109
+ ```bash
110
+ AGENTIC_DOCTOR=0 agentic install ...
111
+ # or
112
+ agentic install ... --no-doctor
113
+ ```
114
+
78
115
  List available options:
79
116
 
80
117
  ```bash
@@ -126,31 +163,35 @@ scoop install fzf
126
163
 
127
164
  ## OpenCode optional plugins
128
165
 
129
- When `opencode` is selected, interactive installs ask whether to enable Telegram notifications and the model checker. The answer is stored globally in:
166
+ When `opencode` is selected, interactive installs ask whether to enable Telegram notifications and `agent-model-mapper`. The answer is stored globally in:
130
167
 
131
168
  ```text
132
169
  ~/.config/agentic/opencode-plugins.json
133
170
  ```
134
171
 
135
- Non-interactive installs create a disabled config when no config exists. Telegram can also read `OPENCODE_TELEGRAM_BOT_TOKEN` and `OPENCODE_TELEGRAM_CHAT_ID`.
172
+ Non-interactive installs create a disabled config when no config exists. Telegram reads `OPENCODE_TELEGRAM_BOT_TOKEN` and `OPENCODE_TELEGRAM_CHAT_ID` from the environment only; tokens are not written to `~/.config/agentic/opencode-plugins.json`. When enabled, `agent-model-mapper` runs during interactive `agentic install`/`agentic tui`, uses `fzf` as a dropdown picker when available, and writes `.opencode/opencode.json` only after confirmation. OpenCode startup never prompts for model mapping; the runtime plugin only reports whether install-time mapping is already complete.
136
173
 
137
174
  ## Context7
138
175
 
139
- For `opencode`, `codex`, `claude`, `cursor`, `gemini`, `kilocode`, and `antigravity`, interactive installs ask whether to add Context7 MCP configuration. If enabled, the Context7 API key prompt is optional; leave it empty to configure Context7 without a key. Most targets use project-level files, while `antigravity` is written to the global user path `~/.gemini/antigravity/mcp_config.json`.
176
+ For `opencode`, `codex`, `claude`, `cursor`, `gemini`, `kilocode`, and `antigravity`, interactive installs ask whether to add Context7 MCP configuration. If enabled, Context7 is configured without a key unless `CONTEXT7_API_KEY` is already set in the environment. The install output prints the generated config path(s) and an example showing where to add the key later. Most targets use project-level files, while `antigravity` is written to the global user path `~/.gemini/antigravity/mcp_config.json`.
140
177
 
141
- Non-interactive installs skip Context7 unless `CONTEXT7_API_KEY` is set in the environment. Agents are instructed to use Context7 for framework, library, SDK, API, and setup documentation when the project config is present.
178
+ Non-interactive installs enable Context7 when either `AGENTIC_ENABLE_CONTEXT7=y` or `CONTEXT7_API_KEY` is set. Agents are instructed to use Context7 for framework, library, SDK, API, and setup documentation when the project config is present.
142
179
 
143
180
  ## MemPalace
144
181
 
145
- For `opencode`, `codex`, `claude`, `cursor`, `gemini`, and `antigravity`, MemPalace MCP is configured as a local Python module instead of a hosted MCP URL. Install it first:
182
+ For `opencode`, `codex`, `claude`, `cursor`, `gemini`, `kilocode`, and `antigravity`, MemPalace MCP is configured as a local Python module instead of a hosted MCP URL. When MemPalace is enabled, `agentic` attempts to install it automatically with `pip install mempalace`.
146
183
 
147
- ```bash
148
- pip install mempalace
149
- ```
184
+ Generated configs run `mempalace-mcp` without arguments for all supported agent targets. Runtime startup and MCP tool errors are checked by the post-install doctor stage.
185
+
186
+ During install, if MemPalace is enabled, `agentic` writes a managed `.mempalaceignore` when the target project does not already have one. OpenCode installs do not run `mempalace init` automatically; project indexing is optional and printed as a manual follow-up. If auto-install or runtime checks fail, install continues, manual setup instructions are printed, and agents fall back to standard context discovery.
150
187
 
151
- Generated configs run `mempalace-mcp --palace .mempalace` (or equivalent `command`/`args` format per IDE) so each project uses its local `.mempalace` directory.
188
+ ## Real agent blackbox E2E
152
189
 
153
- During install, if MemPalace is enabled, `agentic` also runs a runtime check using `python3 -m mempalace --help`. For OpenCode installs, `agentic` creates `<project>/.mempalace` and runs `mempalace init "<project>/.mempalace" --yes --auto-mine`. If checks fail (for example, package not installed yet), install continues and agents fall back to standard context discovery.
190
+ `make test` includes real Codex, OpenCode, and Telegram blackbox scenarios. The local environment must provide working `codex`, `opencode`, Context7/MemPalace access, network access, valid auth, and Telegram credentials in `OPENCODE_TELEGRAM_BOT_TOKEN` and `OPENCODE_TELEGRAM_CHAT_ID`. Secrets are redacted from test output.
191
+
192
+ ```bash
193
+ make test-real-blackbox
194
+ ```
154
195
 
155
196
  ## Deprecated wrapper
156
197
 
@@ -33,9 +33,9 @@ When `agentic` installs the OpenCode extension, it configures optional plugins i
33
33
  ~/.config/agentic/opencode-plugins.json
34
34
  ```
35
35
 
36
- Telegram notifications and model checking are opt-in. If the config is absent or a plugin is disabled, the plugin returns no hooks and OpenCode continues without that behavior.
36
+ Telegram notifications and agent model mapping are opt-in. If the config is absent or a plugin is disabled, the plugin returns no hooks and OpenCode continues without that behavior.
37
37
 
38
- Telegram notifications use either the stored config values or these environment variables:
38
+ Telegram notifications read credentials from environment variables only:
39
39
 
40
40
  ```text
41
41
  OPENCODE_TELEGRAM_BOT_TOKEN
@@ -44,5 +44,7 @@ OPENCODE_TELEGRAM_CHAT_ID
44
44
 
45
45
  Non-interactive `agentic install` defaults optional plugins to disabled when no config exists.
46
46
 
47
+ `agent-model-mapper` reads roles from target `.opencode/agents/*.md` and discovers model names from `~/.config/opencode/opencode.json`, falling back to a built-in list only when that file has no model names. When enabled, interactive `agentic install`/`agentic tui` prompts for a main and fallback model per role, using `fzf` as a dropdown picker when available, and writes `.opencode/opencode.json` only after confirmation. OpenCode startup never opens `fzf` or waits for model input; the runtime plugin only reports whether install-time mapping is complete.
48
+
47
49
  For OpenCode targets, `agentic` writes generated operating guidance to `.opencode/AGENTS.md`. If OpenCode is installed
48
50
  alongside another agent target, root `AGENTS.md` is generated as well for the non-OpenCode target.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://opencode.ai/config.json",
3
3
  "plugin": [
4
- "model-checker",
4
+ "agent-model-mapper",
5
5
  "sound-notification",
6
6
  "telegram-notification"
7
7
  ],
@@ -0,0 +1,106 @@
1
+ import type { Plugin } from "@opencode-ai/plugin"
2
+ import { existsSync, readFileSync } from "node:fs"
3
+ import { readdir, readFile } from "node:fs/promises"
4
+ import { basename, join } from "node:path"
5
+
6
+ type AgenticPluginConfig = {
7
+ agentModelMapper?: {
8
+ enabled?: boolean
9
+ }
10
+ }
11
+
12
+ type Role = {
13
+ name: string
14
+ description: string
15
+ mode: string
16
+ }
17
+
18
+ function readAgenticConfig(): AgenticPluginConfig {
19
+ const configHome = process.env.XDG_CONFIG_HOME || join(process.env.HOME || "", ".config")
20
+ const configPath = join(configHome, "agentic", "opencode-plugins.json")
21
+
22
+ try {
23
+ return JSON.parse(readFileSync(configPath, "utf-8")) as AgenticPluginConfig
24
+ } catch {
25
+ return {}
26
+ }
27
+ }
28
+
29
+ function parseFrontmatter(text: string): Record<string, string> {
30
+ if (!text.startsWith("---\n")) return {}
31
+ const end = text.indexOf("\n---", 4)
32
+ if (end === -1) return {}
33
+
34
+ const result: Record<string, string> = {}
35
+ for (const line of text.slice(4, end).split("\n")) {
36
+ const index = line.indexOf(":")
37
+ if (index === -1) continue
38
+ result[line.slice(0, index).trim()] = line.slice(index + 1).trim().replace(/^['"]|['"]$/g, "")
39
+ }
40
+ return result
41
+ }
42
+
43
+ async function readRoles(directory: string): Promise<Role[]> {
44
+ const agentsDir = join(directory, ".opencode", "agents")
45
+ let entries: string[]
46
+ try {
47
+ entries = await readdir(agentsDir)
48
+ } catch {
49
+ return []
50
+ }
51
+
52
+ const roles: Role[] = []
53
+ for (const entry of entries.sort()) {
54
+ if (!entry.endsWith(".md")) continue
55
+ const path = join(agentsDir, entry)
56
+ const text = await readFile(path, "utf-8")
57
+ const frontmatter = parseFrontmatter(text)
58
+ roles.push({
59
+ name: basename(entry, ".md"),
60
+ description: frontmatter.description || "OpenCode agent",
61
+ mode: frontmatter.mode || "subagent",
62
+ })
63
+ }
64
+ return roles
65
+ }
66
+
67
+ function readJsonIfExists(path: string): unknown {
68
+ if (!existsSync(path)) return undefined
69
+ try {
70
+ return JSON.parse(readFileSync(path, "utf-8"))
71
+ } catch {
72
+ return undefined
73
+ }
74
+ }
75
+
76
+ function hasCompleteAgentModelMapping(directory: string, roles: Role[]): boolean {
77
+ const state = readJsonIfExists(join(directory, ".opencode", "agent-model-mapper.state.json")) as Record<string, any> | undefined
78
+ if (!state?.configured) return false
79
+
80
+ const config = readJsonIfExists(join(directory, ".opencode", "opencode.json")) as Record<string, any> | undefined
81
+ const agents = config?.agent
82
+ if (!agents || typeof agents !== "object") return false
83
+ return roles.every((role) => {
84
+ const agent = agents[role.name]
85
+ return agent && typeof agent === "object" && typeof agent.model === "string" && agent.model.trim().length > 0
86
+ })
87
+ }
88
+
89
+ export const AgentModelMapperPlugin: Plugin = async ({ directory }) => {
90
+ const config = readAgenticConfig()
91
+ if (!config.agentModelMapper?.enabled) return {}
92
+
93
+ const roles = await readRoles(directory)
94
+ if (!roles.length) {
95
+ console.log("agent-model-mapper: skipped because .opencode/agents/*.md was not found")
96
+ return {}
97
+ }
98
+
99
+ if (hasCompleteAgentModelMapping(directory, roles)) {
100
+ console.log("agent-model-mapper: skipped because all Agentic roles already have model mappings")
101
+ return {}
102
+ }
103
+
104
+ console.log("agent-model-mapper: install-time model mapping is required; run agentic install or agentic tui")
105
+ return {}
106
+ }
@@ -5,11 +5,24 @@ import { join } from "node:path"
5
5
  type AgenticPluginConfig = {
6
6
  telegram?: {
7
7
  enabled?: boolean
8
- botToken?: string
9
- chatId?: string
10
8
  }
11
9
  }
12
10
 
11
+ function telegramApiBaseUrl(): string {
12
+ return process.env.OPENCODE_TELEGRAM_API_BASE_URL || "https://api.telegram.org"
13
+ }
14
+
15
+ function telegramUrl(botToken: string, method: string): string {
16
+ return `${telegramApiBaseUrl()}/bot${botToken}/${method}`
17
+ }
18
+
19
+ function redactSecret(value: unknown): string {
20
+ const text = String(value)
21
+ const token = process.env.OPENCODE_TELEGRAM_BOT_TOKEN
22
+ const chatId = process.env.OPENCODE_TELEGRAM_CHAT_ID
23
+ return [token, chatId].filter(Boolean).reduce((output, secret) => output.split(secret as string).join("[redacted]"), text)
24
+ }
25
+
13
26
  function readAgenticConfig(): AgenticPluginConfig {
14
27
  const configHome = process.env.XDG_CONFIG_HOME || join(process.env.HOME || "", ".config")
15
28
  const configPath = join(configHome, "agentic", "opencode-plugins.json")
@@ -24,16 +37,13 @@ function readAgenticConfig(): AgenticPluginConfig {
24
37
  export const TelegramNotificationPlugin: Plugin = async ({ $, client, directory }) => {
25
38
  const config = readAgenticConfig()
26
39
  const telegram = config.telegram
27
- const botToken = process.env.OPENCODE_TELEGRAM_BOT_TOKEN || telegram?.botToken
28
- const chatId = process.env.OPENCODE_TELEGRAM_CHAT_ID || telegram?.chatId
40
+ const botToken = process.env.OPENCODE_TELEGRAM_BOT_TOKEN
41
+ const chatId = process.env.OPENCODE_TELEGRAM_CHAT_ID
29
42
 
30
43
  if (!telegram?.enabled || !botToken || !chatId) {
31
44
  return {}
32
45
  }
33
46
 
34
- process.env.OPENCODE_TELEGRAM_BOT_TOKEN = botToken
35
- process.env.OPENCODE_TELEGRAM_CHAT_ID = chatId
36
-
37
47
  return {
38
48
  event: async ({ event }) => {
39
49
  if (event.type === "session.idle") {
@@ -60,7 +70,7 @@ export const TelegramNotificationPlugin: Plugin = async ({ $, client, directory
60
70
  }
61
71
  }
62
72
  } catch (e) {
63
- await $`echo "Error: ${e}" >> ${directory}/.opencode/telegram-debug.log`
73
+ await $`echo "Error: ${redactSecret(e)}" >> ${directory}/.opencode/telegram-debug.log`
64
74
  }
65
75
 
66
76
  try {
@@ -74,13 +84,13 @@ export const TelegramNotificationPlugin: Plugin = async ({ $, client, directory
74
84
  )
75
85
 
76
86
  await fetch(
77
- `https://api.telegram.org/bot${botToken}/sendDocument`,
87
+ telegramUrl(botToken, "sendDocument"),
78
88
  { method: "POST", body: formData }
79
89
  )
80
90
 
81
91
  const shortText = fullText.slice(0, 3000)
82
92
  await fetch(
83
- `https://api.telegram.org/bot${botToken}/sendMessage`,
93
+ telegramUrl(botToken, "sendMessage"),
84
94
  {
85
95
  method: "POST",
86
96
  headers: { "Content-Type": "application/json" },
@@ -96,7 +106,7 @@ export const TelegramNotificationPlugin: Plugin = async ({ $, client, directory
96
106
  : messageText
97
107
 
98
108
  await fetch(
99
- `https://api.telegram.org/bot${botToken}/sendMessage`,
109
+ telegramUrl(botToken, "sendMessage"),
100
110
  {
101
111
  method: "POST",
102
112
  headers: { "Content-Type": "application/json" },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetrabbits/agentic",
3
- "version": "0.1.0",
3
+ "version": "0.3.0",
4
4
  "description": "Agent Intelligence Configuration CLI",
5
5
  "bin": {
6
6
  "agentic": "bin/agentic.js"
@@ -11,6 +11,8 @@
11
11
  },
12
12
  "files": [
13
13
  "AGENTS.md",
14
+ "MEMORY.md",
15
+ "CHANGELOG.md",
14
16
  "UPGRADE.md",
15
17
  "LICENSE",
16
18
  "Makefile",
@@ -1,13 +0,0 @@
1
- {
2
- "models": [
3
- "openai/gpt-5.5",
4
- "opencode/big-pickle",
5
- "opencode/minimax-m2.5-free",
6
- "google/antigravity-claude-opus-4-6-thinking",
7
- "google/antigravity-claude-sonnet-4-6",
8
- "google/antigravity-gemini-3-flash",
9
- "google/antigravity-gemini-3.1-pro"
10
- ],
11
- "timeoutMs": 2000,
12
- "concurrency": 10
13
- }