triss-coworker 0.15.2 → 0.16.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/CHANGELOG.md CHANGED
@@ -7,6 +7,66 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.16.0] — 2026-05-08
11
+
12
+ ### Added
13
+
14
+ - New `triss agent-help` command prints the full delegation cookbook
15
+ (CLI examples, model presets, dynamically-rendered integration
16
+ sections) on demand. The nano `CLAUDE.md` / `AGENTS.md` block points
17
+ here so the long reference is loaded only when an agent actually
18
+ needs it.
19
+ - Shared `src/agent-rules.js` module owns template rendering for both
20
+ `triss init` (nano variant) and `triss agent-help` (full variant).
21
+ The `{{INTEGRATIONS}}` placeholder and the MCP-hint blockquote now
22
+ apply only to the full variant.
23
+ - New full-cookbook templates: `templates/claude-full.md` and
24
+ `templates/codex-full.md` (the long form previously in
25
+ `templates/claude.md` / `codex.md`).
26
+
27
+ ### Changed
28
+
29
+ - **`triss init` now writes a ~17-line nano block** instead of the
30
+ ~150-220 line full cookbook. The block names the Triss MCP tools,
31
+ states when to delegate vs not, and points at `triss agent-help`.
32
+ Net effect: ~6-8× fewer always-loaded tokens per session for every
33
+ project that has run `triss init`. Existing users: re-run
34
+ `triss init` (with the same `--target` / `--global` flags as
35
+ before) to shrink the block in place — the marker-based
36
+ `replaceBlock` swap preserves all surrounding content.
37
+ - The Codex nano block points at `triss agent-help --target codex`
38
+ so Codex agents receive AGENTS.md-flavored output instead of the
39
+ Claude-flavored default.
40
+
41
+ ### Fixed
42
+
43
+ - `agent-rules.js` now calls `loadEnvFiles()` before checking
44
+ `envReadiness()`. Previously `triss agent-help` only saw integrations
45
+ whose credentials were exported into `process.env` — credentials
46
+ stored in `~/.config/triss/.env` (the wizard's default destination)
47
+ or `./.triss.env` were silently ignored, so agents never saw their
48
+ Jira/Linear/GitHub sections in the cookbook. `loadEnvFiles` is now
49
+ exported from `src/config.js` for direct reuse.
50
+ - `test/e2e-integration.test.js`'s "config set TRISS_WORKER_API_KEY
51
+ then getConfig returns it" test now `chdir`s to a fresh tmp project
52
+ dir, matching its sibling tests in the same file. Previously it ran
53
+ from the repo cwd, so a contributor's local `.triss.env` would
54
+ shadow the value the test wrote to the global file. CI happened to
55
+ pass because the gitignored file was absent there; on developer
56
+ machines it could fail spuriously.
57
+
58
+ ### Internal
59
+
60
+ - Added `.mcp.json` to `.gitignore`. The file is produced by
61
+ `triss mcp install --local` and bakes the developer's absolute
62
+ project path into a JSON `env.TRISS_PROJECT_ROOT` field — must not
63
+ be committed.
64
+ - New regression tests in `test/agent-help.test.js`:
65
+ full-cookbook rendering, target switching, integration injection,
66
+ MCP-hint detection, and the env-file readiness path (the last one
67
+ spawns the CLI in a subprocess so module-level `homedir()`
68
+ constants in `src/secrets.js` resolve relative to the temp HOME).
69
+
10
70
  ## [0.15.2] — 2026-05-08
11
71
 
12
72
  ### Changed
package/README.md CHANGED
@@ -185,6 +185,13 @@ Agent reads the rules and invokes Triss via the shell. No special
185
185
  setup. Best when you also want the same commands available outside the
186
186
  agent (in your own scripts, CI, etc).
187
187
 
188
+ The block is intentionally tiny (~15 lines): it names the MCP tools,
189
+ states when to delegate vs not, and points at `triss agent-help` for the
190
+ full cookbook. The cookbook is rendered on demand — the agent reads it
191
+ once when it actually needs the long reference, instead of loading 200
192
+ lines of instructions into every session. This keeps the always-on
193
+ context cost negligible compared to the savings Triss provides.
194
+
188
195
  ### Option 2 — MCP server (deeper integration)
189
196
 
190
197
  ```bash
@@ -230,7 +237,10 @@ Full reference: [docs/mcp.md](docs/mcp.md).
230
237
 
231
238
  The root `CLAUDE.md` and `AGENTS.md` in this repository are contributor
232
239
  instructions for working on Triss itself. The files under `templates/` are
233
- what `triss init` renders into other projects.
240
+ what `triss init` and `triss agent-help` render into other projects:
241
+ `claude.md` / `codex.md` are the nano variants written by `init`, and
242
+ `claude-full.md` / `codex-full.md` are the long cookbook served by
243
+ `agent-help`.
234
244
 
235
245
  ## What it does
236
246
 
@@ -247,7 +257,8 @@ and writing**.
247
257
  | `triss review` | Code review on current branch or a PR (diff + linked ticket) | The agent reading the whole diff |
248
258
  | `triss commit-msg` | Generates a commit message from staged diff | Hand-writing or copy-pasting from web LLMs |
249
259
  | `triss usage` | Cumulative cost / token usage with per-project breakdown | Squinting at stderr after each call |
250
- | `triss init` | Drops a delegation block into `CLAUDE.md` / `AGENTS.md` | Hand-writing routing rules |
260
+ | `triss init` | Drops a tiny (~15 line) delegation block into `CLAUDE.md` / `AGENTS.md` | Hand-writing routing rules |
261
+ | `triss agent-help` | Prints the full delegation cookbook on demand (the nano block points here) | A 200-line CLAUDE.md that always loads |
251
262
  | `triss status` | Shows current model + key + .env sources | — |
252
263
  | `triss config` | Interactive credential management | Manual `.env` editing |
253
264
  | `triss mcp` | Register Triss as MCP server in Claude Code | Editing `~/.claude.json` by hand |
@@ -420,11 +431,14 @@ Two design rules:
420
431
  `triss status` shows each integration's env-var readiness so you know what
421
432
  still needs configuring.
422
433
 
423
- `triss init` injects per-integration delegation rules into your
424
- `CLAUDE.md` / `AGENTS.md` **only for integrations whose credentials are
425
- present**. Add a Linear key later? Run `triss config wizard linear` then
426
- `triss init` again — the new section appears automatically. Users who
427
- never use Jira never see Jira instructions in their agent's prompt.
434
+ `triss agent-help` inlines per-integration delegation rules into the full
435
+ cookbook **only for integrations whose credentials are present**. Add a
436
+ Linear key later? Run `triss config wizard linear`, then the next time the
437
+ agent runs `triss agent-help` the Linear section appears automatically.
438
+ Users who never use Jira never see Jira instructions in the cookbook.
439
+
440
+ (The nano `triss init` block stays the same regardless — integration
441
+ hints live in the on-demand cookbook, not in the always-loaded block.)
428
442
 
429
443
  ### Adding your own integration
430
444
 
@@ -439,7 +453,7 @@ integration in ~80 lines is documented end-to-end in
439
453
  `IntegrationError`).
440
454
  4. Drop tests in `test/<name>-*.test.js` (mock `globalThis.fetch`).
441
455
  5. Run `triss --help` — your subcommand appears automatically. The
442
- wizard, `triss status`, and `triss init` (CLAUDE.md / AGENTS.md generation) all
456
+ wizard, `triss status`, and `triss agent-help` (full cookbook) all
443
457
  pick up the new manifest with no further wiring.
444
458
 
445
459
  ## Models
package/bin/triss.js CHANGED
@@ -26,6 +26,7 @@ import {
26
26
  } from '../src/commands/mcp.js';
27
27
  import { runCommitMsg } from '../src/commands/commit-msg.js';
28
28
  import { runInit } from '../src/commands/init.js';
29
+ import { runAgentHelp } from '../src/commands/agent-help.js';
29
30
  import { runStatus } from '../src/commands/status.js';
30
31
  import { runCompletion } from '../src/commands/completion.js';
31
32
  import {
@@ -146,6 +147,12 @@ program
146
147
  .option('--reset', 'clear the usage log (cannot be undone)')
147
148
  .action(wrap(runUsage));
148
149
 
150
+ program
151
+ .command('agent-help')
152
+ .description('Print the full Triss delegation cookbook (the nano block in CLAUDE.md / AGENTS.md points here)')
153
+ .option('-t, --target <agent>', 'agent flavour for headings (claude | codex)', 'claude')
154
+ .action(wrap(runAgentHelp));
155
+
149
156
  program
150
157
  .command('status')
151
158
  .description('Show current configuration: API key, models, .env sources')
package/docs/extending.md CHANGED
@@ -43,13 +43,14 @@ export default {
43
43
  ],
44
44
 
45
45
  // Optional: markdown the agent should see when this integration is
46
- // configured. Triss splices these snippets into CLAUDE.md / AGENTS.md
47
- // at `triss init` time, but ONLY if all required envVars are present —
48
- // so users who don't use your provider never see it in their agent's
49
- // instructions. Snippets are also re-rendered on every `triss init`,
50
- // so when the user later enables your integration via
51
- // `triss config wizard yourthing`, they just re-run `triss init` to
52
- // pick up the new section.
46
+ // configured. Triss splices these snippets into the FULL cookbook
47
+ // served by `triss agent-help`, but ONLY if all required envVars are
48
+ // present — so users who don't use your provider never see it in
49
+ // their agent's instructions. The nano block written by `triss init`
50
+ // stays unchanged; integration hints live only in the on-demand
51
+ // cookbook. When the user later enables your integration via
52
+ // `triss config wizard yourthing`, the next `triss agent-help` call
53
+ // picks up the new section automatically.
53
54
  agentInstructions: {
54
55
  claude: '### `triss yourthing` …\n```bash\ntriss yourthing search "..."\n```\n',
55
56
  codex: '### `triss yourthing` …\n…',
@@ -77,8 +78,11 @@ prints them as a red `✗` line — your action handlers should just throw.
77
78
 
78
79
  ### Wiring into the agent's instructions
79
80
 
80
- The default templates (`templates/claude.md`, `templates/codex.md`) contain
81
- a `{{INTEGRATIONS}}` placeholder. At `triss init` time Triss:
81
+ `triss init` writes a tiny nano block (~15 lines, no integration content)
82
+ into `CLAUDE.md` / `AGENTS.md`. The full cookbook lives in
83
+ `templates/claude-full.md` / `templates/codex-full.md`, which contain the
84
+ `{{INTEGRATIONS}}` placeholder and are rendered on demand by
85
+ `triss agent-help`. At render time Triss:
82
86
 
83
87
  1. Loads every integration manifest.
84
88
  2. Filters to the ones whose required `envVars` are all set.
@@ -86,9 +90,10 @@ a `{{INTEGRATIONS}}` placeholder. At `triss init` time Triss:
86
90
  substitutes the result into the placeholder.
87
91
 
88
92
  Result: agents get a focused, project-specific delegation guide — no
89
- mentions of providers the user hasn't configured. If a user later runs
90
- `triss config wizard yourthing` and adds their token, a follow-up
91
- `triss init` automatically adds your section to their CLAUDE.md.
93
+ mentions of providers the user hasn't configured — but only when they
94
+ actually need it, so the always-loaded `CLAUDE.md` block stays small.
95
+ If a user later runs `triss config wizard yourthing` and adds their
96
+ token, the next `triss agent-help` call picks up the new section.
92
97
 
93
98
  ## What `_contract.js` gives you
94
99
 
@@ -191,7 +196,7 @@ triss github comment owner/repo 42 --body "..."
191
196
 
192
197
  Save the file, run `triss --help`, and `github` shows up. After
193
198
  `triss config wizard github` (which prompts for `GITHUB_TOKEN`), the next
194
- `triss init` adds your section to the user's CLAUDE.md or AGENTS.md
199
+ `triss agent-help` adds your section to the on-demand cookbook
195
200
  automatically, depending on the selected target.
196
201
 
197
202
  ## Conventions
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "triss-coworker",
3
- "version": "0.15.2",
3
+ "version": "0.16.0",
4
4
  "description": "Give your AI coding agent a cheap DeepSeek coworker. Delegate bulk reads, boilerplate, and doc updates to save 60-70% of your token budget.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -0,0 +1,97 @@
1
+ // Shared agent-rules rendering. Used by `triss init` (writes the nano block
2
+ // into CLAUDE.md / AGENTS.md) and by `triss agent-help` (prints the full
3
+ // cookbook on demand). The split keeps the always-loaded block tiny while
4
+ // still letting agents pull the long reference once they need it.
5
+
6
+ import { existsSync, readFileSync } from 'node:fs';
7
+ import { dirname, join, resolve } from 'node:path';
8
+ import { fileURLToPath } from 'node:url';
9
+ import { loadEnvFiles } from './config.js';
10
+ import { loadIntegrations, envReadiness } from './integrations/_registry.js';
11
+ import { showStatus as mcpStatus } from './mcp/install.js';
12
+
13
+ const HERE = dirname(fileURLToPath(import.meta.url));
14
+ const TEMPLATE_DIR = resolve(HERE, '..', 'templates');
15
+
16
+ export const START_MARKER = '<!-- triss:start -->';
17
+ export const END_MARKER = '<!-- triss:end -->';
18
+
19
+ export const TARGETS = {
20
+ claude: {
21
+ template: 'claude.md',
22
+ fullTemplate: 'claude-full.md',
23
+ filename: 'CLAUDE.md',
24
+ globalDir: '.claude',
25
+ },
26
+ codex: {
27
+ template: 'codex.md',
28
+ fullTemplate: 'codex-full.md',
29
+ filename: 'AGENTS.md',
30
+ globalDir: '.codex',
31
+ },
32
+ };
33
+
34
+ export const SUPPORTED_TARGETS = Object.keys(TARGETS);
35
+
36
+ export async function renderRules(target, { variant = 'nano' } = {}) {
37
+ const meta = TARGETS[target];
38
+ if (!meta) throw new Error(`Unknown target: ${target}`);
39
+ const file = variant === 'full' ? meta.fullTemplate : meta.template;
40
+ const path = join(TEMPLATE_DIR, file);
41
+ if (!existsSync(path)) {
42
+ throw new Error(`Template not found for target "${target}" (${variant}) at ${path}`);
43
+ }
44
+ const raw = readFileSync(path, 'utf8');
45
+ return renderTemplate(raw, target);
46
+ }
47
+
48
+ // Render the {{INTEGRATIONS}} placeholder. Two layers:
49
+ // 1. If the MCP server is registered, prepend a hint that the same
50
+ // operations are also available as native MCP tools so the agent
51
+ // prefers those over the CLI block.
52
+ // 2. Splice in agentInstructions snippets from each integration whose
53
+ // required env vars are all set (so users who don't use Linear never
54
+ // see Linear instructions).
55
+ //
56
+ // The nano templates intentionally do NOT include {{INTEGRATIONS}} —
57
+ // rendering on them is a no-op and returns the raw text.
58
+ async function renderTemplate(raw, target) {
59
+ if (!raw.includes('{{INTEGRATIONS}}')) return raw;
60
+ // envReadiness() only inspects process.env. Load Triss env files first so
61
+ // integrations whose credentials live in ~/.config/triss/.env or
62
+ // ./.triss.env (i.e. the wizard-installed default) are detected as ready.
63
+ loadEnvFiles();
64
+ const integrations = await loadIntegrations();
65
+ const active = integrations.filter(
66
+ (m) => envReadiness(m).ready && m.agentInstructions?.[target],
67
+ );
68
+
69
+ let mcpHint = '';
70
+ try {
71
+ const { present } = mcpStatus('global', { target });
72
+ if (present) {
73
+ const sessionLabel = target === 'codex' ? 'Codex' : 'Claude Code';
74
+ mcpHint =
75
+ `\n> 💡 **Triss is also available as MCP tools in this ${sessionLabel} session.**\n` +
76
+ '> Native tools — `triss_ask`, `triss_chat`, `triss_review`, `triss_jira_*`,\n' +
77
+ '> `triss_linear_*` etc. — are usually faster and have per-tool permissions.\n' +
78
+ '> Prefer them over the Bash invocations described below; the CLI block stays\n' +
79
+ '> as a fallback if MCP is not loaded.\n\n';
80
+ }
81
+ } catch {
82
+ /* config unreadable — silently fall back to CLI-only block */
83
+ }
84
+
85
+ let block;
86
+ if (!active.length && !mcpHint) {
87
+ block = '';
88
+ } else {
89
+ const integrationsBody = active.length
90
+ ? '\n## Integrations enabled for this project\n\n' +
91
+ active.map((m) => m.agentInstructions[target].trim()).join('\n\n') +
92
+ '\n\n'
93
+ : '';
94
+ block = mcpHint + integrationsBody;
95
+ }
96
+ return raw.replace(/\{\{INTEGRATIONS\}\}\n?/g, block);
97
+ }
@@ -0,0 +1,18 @@
1
+ // Print the full Triss delegation cookbook to stdout. The nano block in
2
+ // CLAUDE.md / AGENTS.md points here so the agent loads the long reference
3
+ // only when it actually needs to look something up — saving the per-session
4
+ // token cost of always-loaded full instructions.
5
+
6
+ import { renderRules, SUPPORTED_TARGETS } from '../agent-rules.js';
7
+
8
+ export async function runAgentHelp(opts = {}) {
9
+ const target = (opts.target || 'claude').toLowerCase();
10
+ if (!SUPPORTED_TARGETS.includes(target)) {
11
+ throw new Error(
12
+ `Unknown --target "${target}". Supported: ${SUPPORTED_TARGETS.join(', ')}`,
13
+ );
14
+ }
15
+ const rendered = await renderRules(target, { variant: 'full' });
16
+ process.stdout.write(rendered);
17
+ if (!rendered.endsWith('\n')) process.stdout.write('\n');
18
+ }
@@ -1,26 +1,20 @@
1
1
  import { existsSync, readFileSync, writeFileSync, mkdirSync } from 'node:fs';
2
2
  import { homedir } from 'node:os';
3
- import { dirname, join, resolve } from 'node:path';
4
- import { fileURLToPath } from 'node:url';
3
+ import { dirname, join } from 'node:path';
5
4
  import pc from 'picocolors';
6
5
  import { getConfig } from '../config.js';
7
6
  import { loadIntegrations, envReadiness } from '../integrations/_registry.js';
8
7
  import { runWizard } from './config.js';
9
- import { showStatus as mcpStatus } from '../mcp/install.js';
10
8
  import { promptChoice } from '../secrets.js';
9
+ import {
10
+ TARGETS,
11
+ SUPPORTED_TARGETS,
12
+ START_MARKER,
13
+ END_MARKER,
14
+ renderRules,
15
+ } from '../agent-rules.js';
11
16
 
12
- const HERE = dirname(fileURLToPath(import.meta.url));
13
- const TEMPLATE_DIR = resolve(HERE, '..', '..', 'templates');
14
-
15
- const START_MARKER = '<!-- triss:start -->';
16
- const END_MARKER = '<!-- triss:end -->';
17
-
18
- const TARGETS = {
19
- claude: { template: 'claude.md', filename: 'CLAUDE.md', globalDir: '.claude' },
20
- codex: { template: 'codex.md', filename: 'AGENTS.md', globalDir: '.codex' },
21
- };
22
-
23
- const SUPPORTED = [...Object.keys(TARGETS), 'both'];
17
+ const SUPPORTED = [...SUPPORTED_TARGETS, 'both'];
24
18
 
25
19
  export async function runInit(opts) {
26
20
  let raw = opts.target ? String(opts.target).toLowerCase() : '';
@@ -29,7 +23,7 @@ export async function runInit(opts) {
29
23
  throw new Error(`Unknown --target "${raw}". Supported: ${SUPPORTED.join(', ')}`);
30
24
  }
31
25
 
32
- const targets = raw === 'both' ? ['claude', 'codex'] : [raw];
26
+ const targets = raw === 'both' ? [...SUPPORTED_TARGETS] : [raw];
33
27
  for (const t of targets) {
34
28
  await writeAgentRules(t, opts);
35
29
  }
@@ -53,12 +47,9 @@ async function chooseTarget() {
53
47
 
54
48
  async function writeAgentRules(target, opts) {
55
49
  const meta = TARGETS[target];
56
- const templatePath = join(TEMPLATE_DIR, meta.template);
57
- if (!existsSync(templatePath)) {
58
- throw new Error(`Template not found for target "${target}" at ${templatePath}`);
59
- }
60
- const rawTemplate = readFileSync(templatePath, 'utf8');
61
- const block = (await renderTemplate(rawTemplate, target)).trim();
50
+ // `init` writes the nano variant — the always-loaded block stays small.
51
+ // Full reference is on demand via `triss agent-help`.
52
+ const block = (await renderRules(target, { variant: 'nano' })).trim();
62
53
  const wrapped = `${START_MARKER}\n${block}\n${END_MARKER}\n`;
63
54
 
64
55
  const destPath = opts.global
@@ -140,48 +131,6 @@ async function postInit(opts) {
140
131
  // Re-export the helper for tests.
141
132
  export { postInit as _postInit };
142
133
 
143
- // Render the {{INTEGRATIONS}} placeholder. Two layers:
144
- // 1. If the MCP server is registered in Claude Code config, prepend a hint
145
- // that the same operations are also available as native MCP tools so
146
- // the agent prefers those.
147
- // 2. Splice in agentInstructions snippets from each integration whose
148
- // required env vars are all set (so users who don't use Linear never
149
- // see Linear instructions).
150
- async function renderTemplate(raw, target) {
151
- if (!raw.includes('{{INTEGRATIONS}}')) return raw;
152
- const integrations = await loadIntegrations();
153
- const active = integrations.filter((m) => envReadiness(m).ready && m.agentInstructions?.[target]);
154
-
155
- let mcpHint = '';
156
- try {
157
- const { present } = mcpStatus('global', { target });
158
- if (present) {
159
- const sessionLabel = target === 'codex' ? 'Codex' : 'Claude Code';
160
- mcpHint =
161
- `\n> 💡 **Triss is also available as MCP tools in this ${sessionLabel} session.**\n` +
162
- '> Native tools — `triss_ask`, `triss_chat`, `triss_review`, `triss_jira_*`,\n' +
163
- '> `triss_linear_*` etc. — are usually faster and have per-tool permissions.\n' +
164
- '> Prefer them over the Bash invocations described below; the CLI block stays\n' +
165
- '> as a fallback if MCP is not loaded.\n\n';
166
- }
167
- } catch {
168
- /* config unreadable — silently fall back to CLI-only block */
169
- }
170
-
171
- let block;
172
- if (!active.length && !mcpHint) {
173
- block = '';
174
- } else {
175
- const integrationsBody = active.length
176
- ? '\n## Integrations enabled for this project\n\n' +
177
- active.map((m) => m.agentInstructions[target].trim()).join('\n\n') +
178
- '\n\n'
179
- : '';
180
- block = mcpHint + integrationsBody;
181
- }
182
- return raw.replace(/\{\{INTEGRATIONS\}\}\n?/g, block);
183
- }
184
-
185
134
  function replaceBlock(text, replacement) {
186
135
  const start = text.indexOf(START_MARKER);
187
136
  const end = text.indexOf(END_MARKER, start);
package/src/config.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import dotenv from 'dotenv';
2
2
  import { activeEnvFiles } from './secrets.js';
3
3
 
4
- function loadEnvFiles() {
4
+ export function loadEnvFiles() {
5
5
  // Precedence: process.env > project .triss.env > global ~/.config/triss/.env.
6
6
  // dotenv with override:false only fills *missing* keys, so the first call
7
7
  // (project) wins over the second (global), and real process env wins over
@@ -0,0 +1,151 @@
1
+ ## Triss — Cheap DeepSeek Coworker (Token Saving)
2
+
3
+ You have a cheap DeepSeek-backed coworker available as the `triss` CLI on PATH.
4
+ Use it to delegate token-heavy I/O so this conversation stays focused on
5
+ reasoning, not on bulk reading, boilerplate, or tracker chatter.
6
+
7
+ ### `triss ask` — bulk reading
8
+ Use instead of reading files yourself when:
9
+ - a single file is >400 lines, or
10
+ - you would otherwise read 3+ files to answer one question.
11
+
12
+ ```bash
13
+ triss ask --paths <file1> <file2> ... --question "<specific question>"
14
+ # heavier analysis:
15
+ triss ask --paths src/**/*.ts --question "..." --model pro --max-tokens 16384
16
+ ```
17
+
18
+ The worker returns a structured bullet summary with file paths and line
19
+ numbers. Read the file yourself only when you need to make precise edits.
20
+
21
+ ### `triss write` — boilerplate generation
22
+ Use for tests, config files, docstrings, repetitive code, or doc scaffolds.
23
+
24
+ ```bash
25
+ triss write --spec "<what to write>" \
26
+ --context <existing-similar-file> \
27
+ --target <output-path>
28
+ ```
29
+
30
+ After it writes, review the file and edit only what needs fixing.
31
+
32
+ ### `triss extract` — chat transcript extraction
33
+ Pull a human-readable transcript out of Claude Code JSONL session logs.
34
+
35
+ ```bash
36
+ triss extract ~/.claude/projects/<project>/<session>.jsonl -o /tmp/chat.txt
37
+ ```
38
+
39
+ ### `triss commit-msg` — generate a commit message from staged diff
40
+ ```bash
41
+ git add <paths>
42
+ triss commit-msg # prints Conventional Commits message
43
+ triss commit-msg --apply # prints + runs `git commit -m`
44
+ ```
45
+
46
+ Use this whenever the user asks you to commit work — much cheaper than
47
+ the primary model writing the message itself, and the format is
48
+ consistent.
49
+
50
+ ### `triss chat <prompt>` — bare worker prompt
51
+ For one-shot lookups / transformations where there is **no corpus** —
52
+ no files to read, no URLs to fetch, no diff to review. Just a question.
53
+
54
+ ```bash
55
+ triss chat "что такое JWT в одном абзаце"
56
+ triss chat "design a rate limiter for the auth endpoint" --model pro
57
+ echo "long prompt..." | triss chat --stdin
58
+ triss chat --system "ты Postgres эксперт" "explain MVCC"
59
+ ```
60
+
61
+ Use it for trivial offload (definitions, rephrasings, ideation) so the
62
+ primary model's tokens stay on actual code work. Do NOT use for code
63
+ review (`triss review`), file analysis (`triss ask`), or anything that
64
+ needs your reasoning.
65
+
66
+ ### `triss ask --stdin` — pipe any command into Triss
67
+ **Universal escape hatch.** Anything that prints to stdout can be triaged
68
+ via Triss without writing to a file first:
69
+
70
+ ```bash
71
+ git diff main..HEAD | triss ask --stdin --question "что критично изменилось?"
72
+ git log --since=1.week | triss ask --stdin --question "что я сделал на этой неделе?"
73
+ kubectl logs my-pod | triss ask --stdin --question "найди аномалии в логах"
74
+ docker logs container 2>&1 | triss ask --stdin --question "errors and their causes"
75
+ ```
76
+
77
+ Prefer this over reading the same output yourself when it's >2K tokens.
78
+
79
+ ### `triss review [PR]` — code review via DeepSeek
80
+ For reviewing a branch or PR. Stitches together: the diff (git or `gh pr
81
+ diff`), PR metadata (title + body if PR# given), and a linked Jira/Linear
82
+ issue (auto-detected from `PROJ-NNN` keys in branch name or PR title).
83
+ Defaults to the `pro` preset because review needs reasoning.
84
+
85
+ ```bash
86
+ triss review # current branch vs auto-detected base
87
+ triss review 123 # PR #123 in the current GitHub repo
88
+ triss review --base develop # HEAD vs develop
89
+ triss review --skip-issue # don't try to look up linked Jira/Linear ticket
90
+ ```
91
+
92
+ **Use over reading diffs yourself** — token savings on diffs are usually
93
+ 10-20× since DeepSeek does the inspection and returns concrete bullets
94
+ with file:line citations. If you still need to look at a specific file
95
+ after the review, do so via Read.
96
+
97
+ ### `triss fetch` / `triss ask --urls` — web pages
98
+ **Default to Triss for any web read. Use the built-in WebFetch tool only
99
+ for the narrow case where you genuinely need raw markup** — e.g. extracting
100
+ an exact regex/CSS-selector hit, copying a precise JSON shape, or you've
101
+ already loaded the same URL in this session.
102
+
103
+ You cannot tell whether a page is "short" until you've fetched it. Treat
104
+ that as a non-decision: the rule is *who pays for the bytes*.
105
+
106
+ | You want… | Use | Why |
107
+ | ---------------------------------------- | -------------- | -------------------------------------------- |
108
+ | Answer to a question about the page | `triss fetch --question "…"` | DeepSeek pays for the body; you get ~300 tokens back |
109
+ | Compare a page against local files | `triss ask --urls … --paths …` | One round-trip, mixed corpus |
110
+ | Clean markdown on disk | `triss fetch <url> > /tmp/x.md` | No LLM at all |
111
+ | Exact raw HTML / unprocessed text | WebFetch | Triss strips noise; you'd lose what you need |
112
+ | Page already cached in this session | WebFetch | Re-fetching is wasted latency |
113
+
114
+ ```bash
115
+ # Default path — answer about the page
116
+ triss fetch https://blog.example.com/post --question "what's the takeaway?"
117
+
118
+ # Multi-URL corpus, mixed with local files
119
+ triss ask --urls https://spec.example.com/v2 \
120
+ --paths README.md \
121
+ --question "what's missing from README that's in the spec?"
122
+
123
+ # Just markdown, no LLM
124
+ triss fetch https://api-docs.example.com/changelog
125
+ ```
126
+
127
+ ### Documentation workflow (preferred)
128
+ **Do not write documentation from scratch in-context. Delegate the read.**
129
+
130
+ 1. `triss extract <latest-session.jsonl> -o /tmp/chat.txt`
131
+ 2. `triss ask --paths /tmp/chat.txt <doc-files> --question "read chat, give exact changes for docs"`
132
+ 3. Apply the worker's suggested edits via the Edit tool.
133
+
134
+ ### Models
135
+ - `--model flash` (default) — cheap, fast, good for bulk reads.
136
+ - `--model pro` — pricier, smarter, use for harder analysis or generation.
137
+ - `--model <full-name>` — pin to any model id (e.g. `deepseek-v4-flash`).
138
+
139
+ Override the preset names if needed via `TRISS_WORKER_FLASH_MODEL` and
140
+ `TRISS_WORKER_PRO_MODEL` env vars (no code changes required).
141
+
142
+ {{INTEGRATIONS}}
143
+ ### When NOT to delegate
144
+ - Tasks under ~2000 tokens of work — delegation overhead costs more than it saves.
145
+ - Architectural decisions, hard debugging, safety-critical code.
146
+ - Anything requiring careful step-by-step reasoning you must own.
147
+ - When you need exact line numbers to make a precise Edit — read the file yourself.
148
+
149
+ Run `triss status` to verify the worker and any integrations are configured.
150
+ Missing credentials? Suggest `triss config wizard` (or `triss config wizard <target>`
151
+ for a single provider; `--local` saves to `./.triss.env` for project-only keys).
@@ -1,151 +1,17 @@
1
- ## Triss — Cheap DeepSeek Coworker (Token Saving)
1
+ ## Triss — cheap delegation worker
2
2
 
3
- You have a cheap DeepSeek-backed coworker available as the `triss` CLI on PATH.
4
- Use it to delegate token-heavy I/O so this conversation stays focused on
5
- reasoning, not on bulk reading, boilerplate, or tracker chatter.
3
+ You have a cheap DeepSeek-backed worker exposed as MCP tools (`triss_ask`,
4
+ `triss_review`, `triss_fetch`, `triss_chat`, `triss_write`,
5
+ `triss_commit_msg`, `triss_status`) — or the `triss` CLI as a fallback if
6
+ MCP is not loaded.
6
7
 
7
- ### `triss ask` — bulk reading
8
- Use instead of reading files yourself when:
9
- - a single file is >400 lines, or
10
- - you would otherwise read 3+ files to answer one question.
8
+ **Delegate when:** a single file is >400 lines, you would otherwise read 3+
9
+ files for one question, you need a code review of a diff, or you want the
10
+ content of a web page (not raw HTML).
11
11
 
12
- ```bash
13
- triss ask --paths <file1> <file2> ... --question "<specific question>"
14
- # heavier analysis:
15
- triss ask --paths src/**/*.ts --question "..." --model pro --max-tokens 16384
16
- ```
12
+ **Don't delegate when:** the task is <2k tokens, you need exact line numbers
13
+ for an Edit, or it is an architectural / safety-critical decision you must
14
+ reason through yourself.
17
15
 
18
- The worker returns a structured bullet summary with file paths and line
19
- numbers. Read the file yourself only when you need to make precise edits.
20
-
21
- ### `triss write` — boilerplate generation
22
- Use for tests, config files, docstrings, repetitive code, or doc scaffolds.
23
-
24
- ```bash
25
- triss write --spec "<what to write>" \
26
- --context <existing-similar-file> \
27
- --target <output-path>
28
- ```
29
-
30
- After it writes, review the file and edit only what needs fixing.
31
-
32
- ### `triss extract` — chat transcript extraction
33
- Pull a human-readable transcript out of Claude Code JSONL session logs.
34
-
35
- ```bash
36
- triss extract ~/.claude/projects/<project>/<session>.jsonl -o /tmp/chat.txt
37
- ```
38
-
39
- ### `triss commit-msg` — generate a commit message from staged diff
40
- ```bash
41
- git add <paths>
42
- triss commit-msg # prints Conventional Commits message
43
- triss commit-msg --apply # prints + runs `git commit -m`
44
- ```
45
-
46
- Use this whenever the user asks you to commit work — much cheaper than
47
- the primary model writing the message itself, and the format is
48
- consistent.
49
-
50
- ### `triss chat <prompt>` — bare worker prompt
51
- For one-shot lookups / transformations where there is **no corpus** —
52
- no files to read, no URLs to fetch, no diff to review. Just a question.
53
-
54
- ```bash
55
- triss chat "что такое JWT в одном абзаце"
56
- triss chat "design a rate limiter for the auth endpoint" --model pro
57
- echo "long prompt..." | triss chat --stdin
58
- triss chat --system "ты Postgres эксперт" "explain MVCC"
59
- ```
60
-
61
- Use it for trivial offload (definitions, rephrasings, ideation) so the
62
- primary model's tokens stay on actual code work. Do NOT use for code
63
- review (`triss review`), file analysis (`triss ask`), or anything that
64
- needs your reasoning.
65
-
66
- ### `triss ask --stdin` — pipe any command into Triss
67
- **Universal escape hatch.** Anything that prints to stdout can be triaged
68
- via Triss without writing to a file first:
69
-
70
- ```bash
71
- git diff main..HEAD | triss ask --stdin --question "что критично изменилось?"
72
- git log --since=1.week | triss ask --stdin --question "что я сделал на этой неделе?"
73
- kubectl logs my-pod | triss ask --stdin --question "найди аномалии в логах"
74
- docker logs container 2>&1 | triss ask --stdin --question "errors and their causes"
75
- ```
76
-
77
- Prefer this over reading the same output yourself when it's >2K tokens.
78
-
79
- ### `triss review [PR]` — code review via DeepSeek
80
- For reviewing a branch or PR. Stitches together: the diff (git or `gh pr
81
- diff`), PR metadata (title + body if PR# given), and a linked Jira/Linear
82
- issue (auto-detected from `PROJ-NNN` keys in branch name or PR title).
83
- Defaults to the `pro` preset because review needs reasoning.
84
-
85
- ```bash
86
- triss review # current branch vs auto-detected base
87
- triss review 123 # PR #123 in the current GitHub repo
88
- triss review --base develop # HEAD vs develop
89
- triss review --skip-issue # don't try to look up linked Jira/Linear ticket
90
- ```
91
-
92
- **Use over reading diffs yourself** — token savings on diffs are usually
93
- 10-20× since DeepSeek does the inspection and returns concrete bullets
94
- with file:line citations. If you still need to look at a specific file
95
- after the review, do so via Read.
96
-
97
- ### `triss fetch` / `triss ask --urls` — web pages
98
- **Default to Triss for any web read. Use the built-in WebFetch tool only
99
- for the narrow case where you genuinely need raw markup** — e.g. extracting
100
- an exact regex/CSS-selector hit, copying a precise JSON shape, or you've
101
- already loaded the same URL in this session.
102
-
103
- You cannot tell whether a page is "short" until you've fetched it. Treat
104
- that as a non-decision: the rule is *who pays for the bytes*.
105
-
106
- | You want… | Use | Why |
107
- | ---------------------------------------- | -------------- | -------------------------------------------- |
108
- | Answer to a question about the page | `triss fetch --question "…"` | DeepSeek pays for the body; you get ~300 tokens back |
109
- | Compare a page against local files | `triss ask --urls … --paths …` | One round-trip, mixed corpus |
110
- | Clean markdown on disk | `triss fetch <url> > /tmp/x.md` | No LLM at all |
111
- | Exact raw HTML / unprocessed text | WebFetch | Triss strips noise; you'd lose what you need |
112
- | Page already cached in this session | WebFetch | Re-fetching is wasted latency |
113
-
114
- ```bash
115
- # Default path — answer about the page
116
- triss fetch https://blog.example.com/post --question "what's the takeaway?"
117
-
118
- # Multi-URL corpus, mixed with local files
119
- triss ask --urls https://spec.example.com/v2 \
120
- --paths README.md \
121
- --question "what's missing from README that's in the spec?"
122
-
123
- # Just markdown, no LLM
124
- triss fetch https://api-docs.example.com/changelog
125
- ```
126
-
127
- ### Documentation workflow (preferred)
128
- **Do not write documentation from scratch in-context. Delegate the read.**
129
-
130
- 1. `triss extract <latest-session.jsonl> -o /tmp/chat.txt`
131
- 2. `triss ask --paths /tmp/chat.txt <doc-files> --question "read chat, give exact changes for docs"`
132
- 3. Apply the worker's suggested edits via the Edit tool.
133
-
134
- ### Models
135
- - `--model flash` (default) — cheap, fast, good for bulk reads.
136
- - `--model pro` — pricier, smarter, use for harder analysis or generation.
137
- - `--model <full-name>` — pin to any model id (e.g. `deepseek-v4-flash`).
138
-
139
- Override the preset names if needed via `TRISS_WORKER_FLASH_MODEL` and
140
- `TRISS_WORKER_PRO_MODEL` env vars (no code changes required).
141
-
142
- {{INTEGRATIONS}}
143
- ### When NOT to delegate
144
- - Tasks under ~2000 tokens of work — delegation overhead costs more than it saves.
145
- - Architectural decisions, hard debugging, safety-critical code.
146
- - Anything requiring careful step-by-step reasoning you must own.
147
- - When you need exact line numbers to make a precise Edit — read the file yourself.
148
-
149
- Run `triss status` to verify the worker and any integrations are configured.
150
- Missing credentials? Suggest `triss config wizard` (or `triss config wizard <target>`
151
- for a single provider; `--local` saves to `./.triss.env` for project-only keys).
16
+ For the full reference (examples, model presets, tracker integrations like
17
+ Jira / Linear / GitHub) run `triss agent-help` once when you need it.
@@ -0,0 +1,51 @@
1
+ # Triss — Cheap DeepSeek Coworker (Token Saving)
2
+
3
+ You have a DeepSeek-backed worker available as the `triss` CLI on PATH.
4
+ Delegate token-heavy I/O to it — the primary model's tokens stay on
5
+ reasoning and edits.
6
+
7
+ ## Commands
8
+
9
+ | Command | Use for |
10
+ | --- | --- |
11
+ | `triss ask --paths <files> --question "<q>"` | bulk read of files; structured summary back |
12
+ | `triss ask --urls <url> --question "<q>"` | same for web pages (HTML→markdown internally) |
13
+ | `triss ask --stdin --question "<q>"` | pipe any command's stdout (`git diff \| triss ask --stdin -q "..."`) |
14
+ | `triss chat "<prompt>"` | bare worker prompt, no corpus — definitions, transformations |
15
+ | `triss write --spec "<spec>" --context <ref> --target <out>` | boilerplate generation against a style reference |
16
+ | `triss extract <session.jsonl> -o <out>` | extract human-readable transcript from Claude Code logs |
17
+ | `triss fetch <url> [--question "<q>"]` | fetch URL → markdown (with `--question`, summary) |
18
+ | `triss review [<pr>]` | code review on current branch or a GitHub PR (auto-detects linked Jira/Linear ticket) |
19
+ | `triss commit-msg [--apply]` | Conventional Commits message from staged diff |
20
+ | `triss usage [--since 7d \| --month] [--by-project]` | cumulative cost / token report |
21
+ | `triss status` | model + integration readiness |
22
+
23
+ ## When to delegate
24
+
25
+ Delegate any read >400 lines or 3+ files for one question, any web fetch,
26
+ any code review on a real diff. Delegate boilerplate generation against a
27
+ reference. Do **not** delegate:
28
+
29
+ - architectural decisions or hard debugging,
30
+ - edits that need exact line numbers (use direct read/edit instead),
31
+ - tasks under ~2000 tokens (delegation overhead costs more).
32
+
33
+ ## Models
34
+
35
+ Default preset is `flash` (cheap). Use `--model pro` for harder analysis
36
+ or code review. Override preset names via `TRISS_WORKER_FLASH_MODEL` /
37
+ `TRISS_WORKER_PRO_MODEL`. Pick a default with `TRISS_DEFAULT_MODEL=flash|pro`.
38
+
39
+ ## Tracker integrations
40
+
41
+ `triss jira / linear / github / gitlab / confluence` expose `search`,
42
+ `issue`/`page`, `create`, `update`, `comment`. Each subcommand accepts
43
+ `--question "<q>"` to summarise via DeepSeek instead of dumping raw API
44
+ output. Configure with `triss config wizard <name>`.
45
+
46
+ {{INTEGRATIONS}}
47
+
48
+ Run `triss status` to verify. Missing credentials? Run
49
+ `triss config wizard` for an interactive setup, or
50
+ `triss config wizard <target>` for one provider. Add `--local` to scope
51
+ to `./.triss.env` instead of the global file.
@@ -1,51 +1,18 @@
1
- # Triss — Cheap DeepSeek Coworker (Token Saving)
1
+ # Triss — cheap delegation worker
2
2
 
3
- You have a DeepSeek-backed worker available as the `triss` CLI on PATH.
4
- Delegate token-heavy I/O to it — the primary model's tokens stay on
5
- reasoning and edits.
3
+ You have a cheap DeepSeek-backed worker exposed as MCP tools (`triss_ask`,
4
+ `triss_review`, `triss_fetch`, `triss_chat`, `triss_write`,
5
+ `triss_commit_msg`, `triss_status`) — or the `triss` CLI as a fallback if
6
+ MCP is not loaded.
6
7
 
7
- ## Commands
8
+ **Delegate when:** a single file is >400 lines, you would otherwise read 3+
9
+ files for one question, you need a code review of a diff, or you want the
10
+ content of a web page (not raw HTML).
8
11
 
9
- | Command | Use for |
10
- | --- | --- |
11
- | `triss ask --paths <files> --question "<q>"` | bulk read of files; structured summary back |
12
- | `triss ask --urls <url> --question "<q>"` | same for web pages (HTML→markdown internally) |
13
- | `triss ask --stdin --question "<q>"` | pipe any command's stdout (`git diff \| triss ask --stdin -q "..."`) |
14
- | `triss chat "<prompt>"` | bare worker prompt, no corpus — definitions, transformations |
15
- | `triss write --spec "<spec>" --context <ref> --target <out>` | boilerplate generation against a style reference |
16
- | `triss extract <session.jsonl> -o <out>` | extract human-readable transcript from Claude Code logs |
17
- | `triss fetch <url> [--question "<q>"]` | fetch URL → markdown (with `--question`, summary) |
18
- | `triss review [<pr>]` | code review on current branch or a GitHub PR (auto-detects linked Jira/Linear ticket) |
19
- | `triss commit-msg [--apply]` | Conventional Commits message from staged diff |
20
- | `triss usage [--since 7d \| --month] [--by-project]` | cumulative cost / token report |
21
- | `triss status` | model + integration readiness |
12
+ **Don't delegate when:** the task is <2k tokens, you need exact line numbers
13
+ for an Edit, or it is an architectural / safety-critical decision you must
14
+ reason through yourself.
22
15
 
23
- ## When to delegate
24
-
25
- Delegate any read >400 lines or 3+ files for one question, any web fetch,
26
- any code review on a real diff. Delegate boilerplate generation against a
27
- reference. Do **not** delegate:
28
-
29
- - architectural decisions or hard debugging,
30
- - edits that need exact line numbers (use direct read/edit instead),
31
- - tasks under ~2000 tokens (delegation overhead costs more).
32
-
33
- ## Models
34
-
35
- Default preset is `flash` (cheap). Use `--model pro` for harder analysis
36
- or code review. Override preset names via `TRISS_WORKER_FLASH_MODEL` /
37
- `TRISS_WORKER_PRO_MODEL`. Pick a default with `TRISS_DEFAULT_MODEL=flash|pro`.
38
-
39
- ## Tracker integrations
40
-
41
- `triss jira / linear / github / gitlab / confluence` expose `search`,
42
- `issue`/`page`, `create`, `update`, `comment`. Each subcommand accepts
43
- `--question "<q>"` to summarise via DeepSeek instead of dumping raw API
44
- output. Configure with `triss config wizard <name>`.
45
-
46
- {{INTEGRATIONS}}
47
-
48
- Run `triss status` to verify. Missing credentials? Run
49
- `triss config wizard` for an interactive setup, or
50
- `triss config wizard <target>` for one provider. Add `--local` to scope
51
- to `./.triss.env` instead of the global file.
16
+ For the full reference (examples, model presets, tracker integrations like
17
+ Jira / Linear / GitHub) run `triss agent-help --target codex` once when you
18
+ need it.