@dv.nghiem/flowdeck 0.4.11 → 0.5.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/README.md +0 -2
- package/dist/agents/orchestrator.d.ts.map +1 -1
- package/dist/config/index.d.ts +1 -1
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/schema.d.ts +27 -1
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/dashboard/lib/state-reader.d.ts +2 -1
- package/dist/dashboard/lib/state-reader.d.ts.map +1 -1
- package/dist/dashboard/server.mjs +128 -13
- package/dist/dashboard/types.d.ts +12 -0
- package/dist/dashboard/types.d.ts.map +1 -1
- package/dist/hooks/approval-hook.d.ts +16 -2
- package/dist/hooks/approval-hook.d.ts.map +1 -1
- package/dist/hooks/compaction-hook.d.ts +1 -1
- package/dist/hooks/compaction-hook.d.ts.map +1 -1
- package/dist/hooks/context-window-monitor.d.ts +7 -1
- package/dist/hooks/context-window-monitor.d.ts.map +1 -1
- package/dist/hooks/decision-trace-hook.d.ts +3 -0
- package/dist/hooks/decision-trace-hook.d.ts.map +1 -1
- package/dist/hooks/event-log-hook.d.ts +19 -3
- package/dist/hooks/event-log-hook.d.ts.map +1 -1
- package/dist/hooks/guard-rails.d.ts +16 -5
- package/dist/hooks/guard-rails.d.ts.map +1 -1
- package/dist/hooks/orchestrator-guard-hook.d.ts +8 -5
- package/dist/hooks/orchestrator-guard-hook.d.ts.map +1 -1
- package/dist/hooks/shell-env-hook.d.ts.map +1 -1
- package/dist/hooks/tool-guard.d.ts +19 -3
- package/dist/hooks/tool-guard.d.ts.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8401 -4863
- package/dist/services/agent-contract-registry.d.ts.map +1 -1
- package/dist/services/agent-trace-graph.d.ts +4 -0
- package/dist/services/agent-trace-graph.d.ts.map +1 -1
- package/dist/services/agent-validator.d.ts +2 -1
- package/dist/services/agent-validator.d.ts.map +1 -1
- package/dist/services/approval-manager.d.ts +14 -1
- package/dist/services/approval-manager.d.ts.map +1 -1
- package/dist/services/audit-log.d.ts +23 -0
- package/dist/services/audit-log.d.ts.map +1 -0
- package/dist/services/context-ingress.d.ts +75 -0
- package/dist/services/context-ingress.d.ts.map +1 -0
- package/dist/services/deadlock-detector.d.ts.map +1 -1
- package/dist/services/delegation-budget.d.ts +55 -0
- package/dist/services/delegation-budget.d.ts.map +1 -0
- package/dist/services/event-logger.d.ts +3 -1
- package/dist/services/event-logger.d.ts.map +1 -1
- package/dist/services/execution-substrate.d.ts +35 -0
- package/dist/services/execution-substrate.d.ts.map +1 -0
- package/dist/services/harness-controller.d.ts +58 -0
- package/dist/services/harness-controller.d.ts.map +1 -0
- package/dist/services/harness-policy.d.ts +24 -0
- package/dist/services/harness-policy.d.ts.map +1 -0
- package/dist/services/harness-types.d.ts +178 -0
- package/dist/services/harness-types.d.ts.map +1 -0
- package/dist/services/lazy-rule-loader.d.ts +2 -0
- package/dist/services/lazy-rule-loader.d.ts.map +1 -1
- package/dist/services/loop-detector.d.ts.map +1 -1
- package/dist/services/prompt-cache.d.ts +25 -0
- package/dist/services/prompt-cache.d.ts.map +1 -0
- package/dist/services/recovery-layer.d.ts +26 -0
- package/dist/services/recovery-layer.d.ts.map +1 -0
- package/dist/services/run-trace.d.ts +17 -0
- package/dist/services/run-trace.d.ts.map +1 -1
- package/dist/services/state-persistence.d.ts +22 -0
- package/dist/services/state-persistence.d.ts.map +1 -0
- package/dist/services/supervisor-binding.d.ts +9 -0
- package/dist/services/supervisor-binding.d.ts.map +1 -1
- package/dist/services/token-metrics.d.ts +39 -0
- package/dist/services/token-metrics.d.ts.map +1 -0
- package/dist/services/verification-layer.d.ts +24 -0
- package/dist/services/verification-layer.d.ts.map +1 -0
- package/dist/services/workflow-scorecard.d.ts +5 -0
- package/dist/services/workflow-scorecard.d.ts.map +1 -1
- package/dist/tools/decision-trace.d.ts +4 -0
- package/dist/tools/decision-trace.d.ts.map +1 -1
- package/dist/tools/delegate.d.ts +16 -0
- package/dist/tools/delegate.d.ts.map +1 -0
- package/dist/tools/failure-replay.d.ts +8 -0
- package/dist/tools/failure-replay.d.ts.map +1 -1
- package/dist/tools/policy-engine.d.ts +1 -0
- package/dist/tools/policy-engine.d.ts.map +1 -1
- package/docs/concepts/HARNESS_ARCHITECTURE.md +241 -0
- package/docs/concepts/HARNESS_LAYERS.md +378 -0
- package/docs/concepts/HARNESS_WIRING.md +404 -0
- package/docs/getting-started/installation.md +0 -18
- package/docs/index.md +0 -1
- package/docs/reference/hooks.md +1 -16
- package/package.json +6 -6
- package/src/commands/fd-guarded-edit.md +69 -0
- package/src/rules/common/agent-defense.md +66 -0
- package/src/rules/common/agent-orchestration.md +35 -1
- package/src/skills/context-budget/SKILL.md +266 -0
- package/src/skills/context-guard/SKILL.md +172 -0
- package/src/skills/context-steward/SKILL.md +297 -0
- package/src/skills/decision-trace/SKILL.md +137 -0
- package/src/skills/research-first/SKILL.md +344 -0
- package/src/skills/session-persistence/SKILL.md +320 -0
- package/src/skills/telemetry-steward/SKILL.md +191 -0
- package/dist/services/rtk-manager.d.ts +0 -80
- package/dist/services/rtk-manager.d.ts.map +0 -1
- package/dist/services/rtk-policy.d.ts +0 -26
- package/dist/services/rtk-policy.d.ts.map +0 -1
- package/dist/tools/rtk-setup.d.ts +0 -22
- package/dist/tools/rtk-setup.d.ts.map +0 -1
- package/docs/reference/rtk.md +0 -162
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: telemetry-steward
|
|
3
|
+
description: Lightweight append-only telemetry layer for tracking session health, agent performance, and decision quality across FlowDeck operations.
|
|
4
|
+
origin: FlowDeck
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Telemetry Steward
|
|
8
|
+
|
|
9
|
+
FlowDeck generates a steady stream of operational signals — context compactions, agent handoffs, recorded decisions, readiness scores. Telemetry Steward captures these as structured, append-only events so operators can observe patterns, diagnose drift, and validate improvement over time.
|
|
10
|
+
|
|
11
|
+
## Purpose
|
|
12
|
+
|
|
13
|
+
Telemetry answers three questions:
|
|
14
|
+
|
|
15
|
+
1. **Context health** — Are we pruning, compacting, or checkpointing effectively? Are token savings trending up or down?
|
|
16
|
+
2. **Agent performance** — Which agents are fastest? Which fail most often? Where does routing latency spike?
|
|
17
|
+
3. **Decision quality** — Are decisions backed by evidence? Is confidence calibrated to actual risk?
|
|
18
|
+
|
|
19
|
+
It is not a control plane. It does not trigger actions. It exists purely for observability, retrospection, and baseline-setting.
|
|
20
|
+
|
|
21
|
+
## Storage
|
|
22
|
+
|
|
23
|
+
All events are written to `.codebase/TELEMETRY.jsonl`.
|
|
24
|
+
|
|
25
|
+
- One JSON object per line. No outer array.
|
|
26
|
+
- Append only. Never rewrite the file in place.
|
|
27
|
+
- Each line is self-contained and independently parseable.
|
|
28
|
+
- Invalid lines are skipped during read, not repaired.
|
|
29
|
+
|
|
30
|
+
## Event Schema
|
|
31
|
+
|
|
32
|
+
Every event has a top-level `type` field. All other fields are type-specific.
|
|
33
|
+
|
|
34
|
+
### `context_action`
|
|
35
|
+
|
|
36
|
+
Recorded when the context steward prunes, compacts, or checkpoints.
|
|
37
|
+
|
|
38
|
+
```json
|
|
39
|
+
{
|
|
40
|
+
"type": "context_action",
|
|
41
|
+
"action": "prune",
|
|
42
|
+
"tokens_before": 12400,
|
|
43
|
+
"tokens_after": 8200,
|
|
44
|
+
"timestamp": "2026-06-11T09:23:17.000Z"
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
| Field | Type | Description |
|
|
49
|
+
|-------|------|-------------|
|
|
50
|
+
| `action` | string | `"prune"`, `"compact"`, or `"checkpoint"` |
|
|
51
|
+
| `tokens_before` | integer | Context size in tokens before the action |
|
|
52
|
+
| `tokens_after` | integer | Context size in tokens after the action |
|
|
53
|
+
| `timestamp` | ISO 8601 | When the action occurred |
|
|
54
|
+
|
|
55
|
+
### `agent_routing`
|
|
56
|
+
|
|
57
|
+
Recorded when the orchestrator dispatches work to an agent.
|
|
58
|
+
|
|
59
|
+
```json
|
|
60
|
+
{
|
|
61
|
+
"type": "agent_routing",
|
|
62
|
+
"agent": "backend-coder",
|
|
63
|
+
"category": "implementation",
|
|
64
|
+
"task_type": "bugfix",
|
|
65
|
+
"duration_ms": 14520,
|
|
66
|
+
"success": true,
|
|
67
|
+
"timestamp": "2026-06-11T09:45:02.000Z"
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
| Field | Type | Description |
|
|
72
|
+
|-------|------|-------------|
|
|
73
|
+
| `agent` | string | Agent that executed the task |
|
|
74
|
+
| `category` | string | High-level bucket: `"implementation"`, `"research"`, `"review"`, `"debug"`, `"docs"` |
|
|
75
|
+
| `task_type` | string | Specific task class: `"feature"`, `"bugfix"`, `"refactor"`, `"plan"`, `"audit"` |
|
|
76
|
+
| `duration_ms` | integer | Wall-clock time from dispatch to completion |
|
|
77
|
+
| `success` | boolean | Did the agent report success? |
|
|
78
|
+
| `timestamp` | ISO 8601 | When routing completed |
|
|
79
|
+
|
|
80
|
+
### `decision_recorded`
|
|
81
|
+
|
|
82
|
+
Recorded when a decision is persisted via `decision-trace`.
|
|
83
|
+
|
|
84
|
+
```json
|
|
85
|
+
{
|
|
86
|
+
"type": "decision_recorded",
|
|
87
|
+
"decision_id": "auth-refactor-2026-06-11",
|
|
88
|
+
"risk_level": "medium",
|
|
89
|
+
"confidence": 0.85,
|
|
90
|
+
"has_evidence": true,
|
|
91
|
+
"timestamp": "2026-06-11T10:12:44.000Z"
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
| Field | Type | Description |
|
|
96
|
+
|-------|------|-------------|
|
|
97
|
+
| `decision_id` | string | Identifier from `decision-trace` |
|
|
98
|
+
| `risk_level` | string | `"low"`, `"medium"`, or `"high"` |
|
|
99
|
+
| `confidence` | number | 0.0 to 1.0, if available |
|
|
100
|
+
| `has_evidence` | boolean | Were evidence entries provided? |
|
|
101
|
+
| `timestamp` | ISO 8601 | When the decision was recorded |
|
|
102
|
+
|
|
103
|
+
### `readiness_check`
|
|
104
|
+
|
|
105
|
+
Recorded after a deploy-check or pre-flight verification run.
|
|
106
|
+
|
|
107
|
+
```json
|
|
108
|
+
{
|
|
109
|
+
"type": "readiness_check",
|
|
110
|
+
"status": "pass",
|
|
111
|
+
"score": 0.94,
|
|
112
|
+
"failing_checks": ["dependency-audit"],
|
|
113
|
+
"timestamp": "2026-06-11T11:00:00.000Z"
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
| Field | Type | Description |
|
|
118
|
+
|-------|------|-------------|
|
|
119
|
+
| `status` | string | `"pass"`, `"warn"`, or `"fail"` |
|
|
120
|
+
| `score` | number | 0.0 to 1.0 aggregate readiness score |
|
|
121
|
+
| `failing_checks` | string[] | List of check names that did not pass |
|
|
122
|
+
| `timestamp` | ISO 8601 | When the check completed |
|
|
123
|
+
|
|
124
|
+
## Retention Policy
|
|
125
|
+
|
|
126
|
+
- **Active window**: 90 days of events remain in `.codebase/TELEMETRY.jsonl`.
|
|
127
|
+
- **Monthly rotation**: At the start of each month, rename the current file to `.codebase/TELEMETRY-YYYY-MM.jsonl` and start a fresh `TELEMETRY.jsonl`.
|
|
128
|
+
- **No automatic deletion**: Archived monthly files are never deleted without explicit operator action. If disk space is a concern, the operator moves old archives to cold storage.
|
|
129
|
+
- **Rationale**: Aggressive rotation destroys the long-term pattern signal. Three months of continuous data is the minimum for detecting trends like "agent routing latency creeps up on Fridays" or "context savings degrade after 20+ message sessions."
|
|
130
|
+
|
|
131
|
+
## Consumption Patterns
|
|
132
|
+
|
|
133
|
+
### Dashboard
|
|
134
|
+
|
|
135
|
+
A dashboard agent or external tool reads `.codebase/TELEMETRY.jsonl` directly and renders:
|
|
136
|
+
|
|
137
|
+
- Daily context savings (tokens_before - tokens_after)
|
|
138
|
+
- Agent success rate by category
|
|
139
|
+
- Decision confidence distribution
|
|
140
|
+
- Readiness score trend over the last 30 days
|
|
141
|
+
|
|
142
|
+
### Failure Replay Engine
|
|
143
|
+
|
|
144
|
+
Before recording a new failure, the failure-replay engine queries telemetry for correlated signals:
|
|
145
|
+
|
|
146
|
+
- Did `agent_routing` success rate drop before this failure?
|
|
147
|
+
- Were there recent `decision_recorded` entries with low confidence and no evidence?
|
|
148
|
+
- Did `readiness_check` scores degrade in the days leading up to the incident?
|
|
149
|
+
|
|
150
|
+
### Agent Performance Baselines
|
|
151
|
+
|
|
152
|
+
Agents query their own historical telemetry to set expectations:
|
|
153
|
+
|
|
154
|
+
- "My median `backend-coder` bugfix duration is 8 minutes. This task is taking 25 minutes — something is wrong."
|
|
155
|
+
- "Context actions in this repo typically save 35% of tokens. Today's savings are 12% — the compaction strategy may need tuning."
|
|
156
|
+
|
|
157
|
+
## Aggregation Recipe
|
|
158
|
+
|
|
159
|
+
**Weekly context savings**
|
|
160
|
+
|
|
161
|
+
To compute tokens reclaimed by pruning in the last 7 days:
|
|
162
|
+
|
|
163
|
+
1. Filter lines where `type == "context_action"` and `action == "prune"`.
|
|
164
|
+
2. For each matching line, compute `tokens_before - tokens_after`.
|
|
165
|
+
3. Sum the differences.
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
jq -c 'select(.type == "context_action" and .action == "prune") | (.tokens_before - .tokens_after)' .codebase/TELEMETRY.jsonl | awk '{s+=$1} END {print s}'
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
## Anti-Patterns
|
|
172
|
+
|
|
173
|
+
- **Do not store secrets or PII in telemetry.** Event payloads must never contain API keys, tokens, user emails, or conversation content. If you need to correlate with a sensitive ID, hash it first.
|
|
174
|
+
- **Do not use telemetry for real-time control.** Telemetry is observability, not a trigger. Do not write events and then read them in the same session to decide what to do next. Use state files or direct signals for control logic.
|
|
175
|
+
- **Do not rotate too aggressively.** Rotating or truncating `TELEMETRY.jsonl` more often than monthly makes it impossible to detect multi-week patterns like gradual agent slowdown or declining decision quality.
|
|
176
|
+
|
|
177
|
+
## Cross-References
|
|
178
|
+
|
|
179
|
+
| Component | Relationship |
|
|
180
|
+
|-----------|-------------|
|
|
181
|
+
| `context-steward` | Emits `context_action` events during prune/compact/checkpoint cycles |
|
|
182
|
+
| `decision-trace` | Emits `decision_recorded` events for every recorded decision |
|
|
183
|
+
| `failure-replay-engine` | Queries telemetry for pre-failure signal correlation |
|
|
184
|
+
| dashboard | Reads `TELEMETRY.jsonl` to render operational charts |
|
|
185
|
+
|
|
186
|
+
## Guidance
|
|
187
|
+
|
|
188
|
+
- Write events synchronously at the point of action. Do not buffer or batch — a single line append is cheap and eliminates flush complexity.
|
|
189
|
+
- If `TELEMETRY.jsonl` is missing on first write, create it. Do not fail the operation because telemetry is unavailable.
|
|
190
|
+
- Validate event structure before appending. A malformed line corrupts nothing (readers skip it), but it wastes space and loses signal.
|
|
191
|
+
- Prefer explicit `null` over omitting a field. A missing `confidence` is ambiguous (not recorded vs. not applicable); `confidence: null` is clear.
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* rtk-manager — runtime integration for https://github.com/rtk-ai/rtk
|
|
3
|
-
*
|
|
4
|
-
* rtk is a CLI proxy that compresses noisy terminal output (git, npm, test
|
|
5
|
-
* runners, linters, docker, etc.) by 60-90% before it reaches the model
|
|
6
|
-
* context. It works by prefixing supported commands: `rtk git status`.
|
|
7
|
-
*
|
|
8
|
-
* This manager provides:
|
|
9
|
-
* - Detection of an installed rtk binary
|
|
10
|
-
* - Optional agent-triggered initialization (rtk init -g)
|
|
11
|
-
* - Status reporting for diagnostics
|
|
12
|
-
* - wrapCommandArgs() for explicit wrapping in FlowDeck's own spawnSync calls
|
|
13
|
-
*
|
|
14
|
-
* DESIGN NOTES:
|
|
15
|
-
* - No auto-install: downloading + executing a remote shell script is a
|
|
16
|
-
* supply-chain risk. Users install rtk manually; this plugin detects it.
|
|
17
|
-
* - No startup mutation: init is agent-triggered via rtk-setup tool only.
|
|
18
|
-
* - Live detection: no state cache that goes stale across machines/reinstalls.
|
|
19
|
-
* - Bash hook caveat: `rtk init -g` writes to Claude Code / Copilot global
|
|
20
|
-
* config. Whether that hook fires in OpenCode's non-interactive bash sessions
|
|
21
|
-
* depends on the runtime. Explicit wrapping via wrapCommandArgs() is the
|
|
22
|
-
* reliable alternative.
|
|
23
|
-
*/
|
|
24
|
-
export interface RtkDetection {
|
|
25
|
-
installed: boolean;
|
|
26
|
-
binPath?: string;
|
|
27
|
-
version?: string;
|
|
28
|
-
error?: string;
|
|
29
|
-
}
|
|
30
|
-
export interface RtkInitResult {
|
|
31
|
-
success: boolean;
|
|
32
|
-
log: string;
|
|
33
|
-
telemetryDisabled: boolean;
|
|
34
|
-
error?: string;
|
|
35
|
-
}
|
|
36
|
-
export interface RtkStatus {
|
|
37
|
-
installed: boolean;
|
|
38
|
-
binPath?: string;
|
|
39
|
-
version?: string;
|
|
40
|
-
initAttempted: boolean;
|
|
41
|
-
initSuccess: boolean;
|
|
42
|
-
telemetryDisabled: boolean;
|
|
43
|
-
installInstructions?: string;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Locate and verify the rtk binary. Checks PATH first, then known install
|
|
47
|
-
* locations. Returns the first working binary found.
|
|
48
|
-
*/
|
|
49
|
-
export declare function detectRtk(): RtkDetection;
|
|
50
|
-
/**
|
|
51
|
-
* Run `rtk init -g` to install the bash hook for Claude Code / Copilot,
|
|
52
|
-
* then immediately run `rtk telemetry disable` to explicitly opt out.
|
|
53
|
-
*
|
|
54
|
-
* Telemetry is disabled by default per rtk docs, but we make it explicit
|
|
55
|
-
* and persistent so consent is never accidentally given in future versions.
|
|
56
|
-
* The `RTK_TELEMETRY_DISABLED=1` env var injected by shell-env-hook provides
|
|
57
|
-
* an additional belt-and-suspenders block at the session level.
|
|
58
|
-
*
|
|
59
|
-
* Note on bash hook: `rtk init -g` writes to Claude Code / Copilot global
|
|
60
|
-
* config. Whether that hook fires in OpenCode's non-interactive bash sessions
|
|
61
|
-
* depends on the runtime configuration. Use `$RTK_BIN <cmd>` explicitly as
|
|
62
|
-
* a reliable alternative when RTK_INSTALLED=true in the environment.
|
|
63
|
-
*/
|
|
64
|
-
export declare function initRtk(binPath: string): RtkInitResult;
|
|
65
|
-
/**
|
|
66
|
-
* Return current rtk status. Always performs a live detection check.
|
|
67
|
-
*/
|
|
68
|
-
export declare function getRtkStatus(opts?: {
|
|
69
|
-
runInit?: boolean;
|
|
70
|
-
}): RtkStatus;
|
|
71
|
-
/**
|
|
72
|
-
* Wrap a command with rtk if the binary is available and policy allows it.
|
|
73
|
-
* Returns `[cmd, ...args]` unchanged when rtk is unavailable or policy says no.
|
|
74
|
-
*
|
|
75
|
-
* Usage:
|
|
76
|
-
* const [c, ...a] = wrapCommandArgs("git", ["status"], "/home/user/.local/bin/rtk")
|
|
77
|
-
* spawnSync(c, a, { ... })
|
|
78
|
-
*/
|
|
79
|
-
export declare function wrapCommandArgs(cmd: string, args: string[], binPath: string | undefined): [string, ...string[]];
|
|
80
|
-
//# sourceMappingURL=rtk-manager.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rtk-manager.d.ts","sourceRoot":"","sources":["../../src/services/rtk-manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAQH,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,OAAO,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,OAAO,CAAA;IAChB,GAAG,EAAE,MAAM,CAAA;IACX,iBAAiB,EAAE,OAAO,CAAA;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,SAAS;IACxB,SAAS,EAAE,OAAO,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,aAAa,EAAE,OAAO,CAAA;IACtB,WAAW,EAAE,OAAO,CAAA;IACpB,iBAAiB,EAAE,OAAO,CAAA;IAC1B,mBAAmB,CAAC,EAAE,MAAM,CAAA;CAC7B;AAYD;;;GAGG;AACH,wBAAgB,SAAS,IAAI,YAAY,CAsBxC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,aAAa,CAsCtD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,IAAI,CAAC,EAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,SAAS,CA+BpE;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC,CAI/G"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* rtk-policy — command wrapping policy for rtk integration.
|
|
3
|
-
*
|
|
4
|
-
* Determines which commands benefit from rtk output compression and which
|
|
5
|
-
* should be passed through unchanged. The policy is intentionally conservative:
|
|
6
|
-
* when in doubt, don't wrap.
|
|
7
|
-
*
|
|
8
|
-
* Wrapping benefits:
|
|
9
|
-
* - Commands with large, repetitive, or progress-heavy output
|
|
10
|
-
* - Commands where compressed output preserves the signal
|
|
11
|
-
*
|
|
12
|
-
* Do NOT wrap:
|
|
13
|
-
* - Commands where raw output is required for correctness
|
|
14
|
-
* - Commands with already-compact output (git rev-parse, git diff --name-only)
|
|
15
|
-
* - Commands used for installing rtk itself (curl, sh)
|
|
16
|
-
* - Structured/programmatic output (codegraph, jq, etc.)
|
|
17
|
-
* - OS notification tools (notify-send, osascript, powershell)
|
|
18
|
-
*/
|
|
19
|
-
/**
|
|
20
|
-
* Determine whether a command should be wrapped with rtk.
|
|
21
|
-
* Returns true only when compression is expected to improve signal quality.
|
|
22
|
-
*/
|
|
23
|
-
export declare function shouldWrapWithRtk(cmd: string, args: string[]): boolean;
|
|
24
|
-
/** Returns the full list of supported commands for diagnostics/documentation. */
|
|
25
|
-
export declare function getSupportedCommands(): string[];
|
|
26
|
-
//# sourceMappingURL=rtk-policy.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rtk-policy.d.ts","sourceRoot":"","sources":["../../src/services/rtk-policy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AA4DH;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAatE;AAED,iFAAiF;AACjF,wBAAgB,oBAAoB,IAAI,MAAM,EAAE,CAE/C"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { type ToolDefinition } from "@opencode-ai/plugin";
|
|
2
|
-
/**
|
|
3
|
-
* rtk-setup tool — agent-callable tool for rtk lifecycle management.
|
|
4
|
-
*
|
|
5
|
-
* Provides:
|
|
6
|
-
* - Detection: is rtk installed and where?
|
|
7
|
-
* - Optional init: run `rtk init -g` to install the bash hook
|
|
8
|
-
* - Status report: for diagnostics in the current workflow
|
|
9
|
-
* - Supported commands list: which commands benefit from rtk wrapping
|
|
10
|
-
*
|
|
11
|
-
* Agents should call this tool when:
|
|
12
|
-
* - They want to verify rtk is available before running commands
|
|
13
|
-
* - The workflow involves heavy CLI usage (git, tests, linting, docker)
|
|
14
|
-
* - After a user has installed rtk and wants to activate it
|
|
15
|
-
*
|
|
16
|
-
* Note on bash hook: `rtk init -g` writes to Claude Code / Copilot global
|
|
17
|
-
* config. In OpenCode's non-interactive bash sessions the hook may not fire
|
|
18
|
-
* automatically. Use `$RTK_BIN <cmd>` explicitly as a reliable alternative
|
|
19
|
-
* when RTK_INSTALLED=true in the environment.
|
|
20
|
-
*/
|
|
21
|
-
export declare const rtkSetupTool: ToolDefinition;
|
|
22
|
-
//# sourceMappingURL=rtk-setup.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rtk-setup.d.ts","sourceRoot":"","sources":["../../src/tools/rtk-setup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAI/D;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,YAAY,EAAE,cA0EzB,CAAA"}
|
package/docs/reference/rtk.md
DELETED
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
# rtk Integration
|
|
2
|
-
|
|
3
|
-
FlowDeck integrates [rtk](https://github.com/rtk-ai/rtk) — a Rust CLI proxy that compresses noisy terminal output (git, npm, test runners, linters, Docker, and more) by 60–90% before it reaches the model context.
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## What rtk does
|
|
8
|
-
|
|
9
|
-
rtk acts as a transparent proxy in front of supported CLI commands:
|
|
10
|
-
|
|
11
|
-
```bash
|
|
12
|
-
rtk git status # same as git status, but output compressed 60-90%
|
|
13
|
-
rtk npm test # same as npm test, but noise filtered out
|
|
14
|
-
rtk tsc --noEmit # TypeScript compiler errors, signal-only
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
This reduces the number of tokens consumed by verbose CLI output — lowering cost and improving signal quality for agents that read shell output.
|
|
18
|
-
|
|
19
|
-
---
|
|
20
|
-
|
|
21
|
-
## Detection
|
|
22
|
-
|
|
23
|
-
FlowDeck detects rtk automatically at session startup. No configuration is required.
|
|
24
|
-
|
|
25
|
-
Detection checks in order:
|
|
26
|
-
1. `rtk --version` via `PATH`
|
|
27
|
-
2. `~/.local/bin/rtk` (default install location on Linux/macOS)
|
|
28
|
-
3. `/usr/local/bin/rtk`
|
|
29
|
-
|
|
30
|
-
Detection is performed once per session and cached (zero overhead per bash call).
|
|
31
|
-
|
|
32
|
-
---
|
|
33
|
-
|
|
34
|
-
## Environment Variables Injected
|
|
35
|
-
|
|
36
|
-
When rtk is detected, FlowDeck injects the following into **every bash tool execution** via the `shell.env` hook:
|
|
37
|
-
|
|
38
|
-
| Variable | Value | Description |
|
|
39
|
-
|----------|-------|-------------|
|
|
40
|
-
| `RTK_INSTALLED` | `"true"` / `"false"` | Whether rtk was found at session start |
|
|
41
|
-
| `RTK_BIN` | e.g. `/home/user/.local/bin/rtk` | Full path to the rtk binary (only when installed) |
|
|
42
|
-
| `RTK_TELEMETRY_DISABLED` | `"1"` | Always set when rtk is installed — blocks telemetry |
|
|
43
|
-
|
|
44
|
-
Agents can use these vars directly in bash commands:
|
|
45
|
-
|
|
46
|
-
```bash
|
|
47
|
-
if [ "$RTK_INSTALLED" = "true" ]; then
|
|
48
|
-
$RTK_BIN git log --oneline -20
|
|
49
|
-
else
|
|
50
|
-
git log --oneline -20
|
|
51
|
-
fi
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
---
|
|
55
|
-
|
|
56
|
-
## Telemetry
|
|
57
|
-
|
|
58
|
-
FlowDeck **always disables rtk telemetry**. Two layers of protection:
|
|
59
|
-
|
|
60
|
-
1. **`rtk telemetry disable`** — run automatically after every `rtk-setup init`. Stores an explicit opt-out in rtk's local config (`~/.local/share/rtk/`).
|
|
61
|
-
2. **`RTK_TELEMETRY_DISABLED=1`** — injected into every bash session by FlowDeck's `shell.env` hook. Blocks telemetry at the env-var level regardless of stored consent state.
|
|
62
|
-
|
|
63
|
-
Both mechanisms are active independently. The env var alone is sufficient to suppress all telemetry pings even if the config opt-out is somehow lost.
|
|
64
|
-
|
|
65
|
-
See [rtk TELEMETRY.md](https://github.com/rtk-ai/rtk/blob/develop/docs/TELEMETRY.md) for what rtk would collect if telemetry were enabled.
|
|
66
|
-
|
|
67
|
-
---
|
|
68
|
-
|
|
69
|
-
## Supported Commands
|
|
70
|
-
|
|
71
|
-
The following commands benefit from rtk compression. FlowDeck's wrapping policy (`rtk-policy.ts`) uses this list:
|
|
72
|
-
|
|
73
|
-
| Command | What gets compressed |
|
|
74
|
-
|---------|----------------------|
|
|
75
|
-
| `git status` | Staged / unstaged file listing |
|
|
76
|
-
| `git log` | Commit history |
|
|
77
|
-
| `git diff` | Full diff output |
|
|
78
|
-
| `git show` | Commit show output |
|
|
79
|
-
| `npm test` / `bun test` | Test runner output and summaries |
|
|
80
|
-
| `tsc` | TypeScript compiler diagnostics |
|
|
81
|
-
| `eslint` / `biome` / `oxlint` | Lint output |
|
|
82
|
-
| `jest` / `vitest` / `pytest` | Test output |
|
|
83
|
-
| `cargo` | Rust build / test output |
|
|
84
|
-
| `docker` | Container and image listings |
|
|
85
|
-
| `kubectl` | Kubernetes resource listings |
|
|
86
|
-
| `gh` | GitHub CLI output |
|
|
87
|
-
| `pnpm` / `yarn` / `npx` | Package manager output |
|
|
88
|
-
|
|
89
|
-
**Commands that are never wrapped** (raw output required or already compact):
|
|
90
|
-
|
|
91
|
-
| Command | Reason |
|
|
92
|
-
|---------|--------|
|
|
93
|
-
| `git rev-parse` | Returns a single hash — already minimal |
|
|
94
|
-
| `git diff --name-only` / `--name-status` / `--stat` | Already compact listing |
|
|
95
|
-
| `git ls-files`, `git config`, `git symbolic-ref` | Compact structured output |
|
|
96
|
-
| `codegraph` | Programmatic structured output — must not be modified |
|
|
97
|
-
| `curl` | Used for downloads — raw output required |
|
|
98
|
-
| `sh`, `bash`, `node`, `python` | Shell interpreters — must not be intercepted |
|
|
99
|
-
|
|
100
|
-
---
|
|
101
|
-
|
|
102
|
-
## Setup Tool
|
|
103
|
-
|
|
104
|
-
Agents can check rtk status or trigger initialization via the `rtk-setup` tool:
|
|
105
|
-
|
|
106
|
-
### Check status
|
|
107
|
-
|
|
108
|
-
```
|
|
109
|
-
rtk-setup (action: "status")
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
Returns current detection result, binary path, version, and instructions if rtk is not installed.
|
|
113
|
-
|
|
114
|
-
### Initialize bash hook
|
|
115
|
-
|
|
116
|
-
```
|
|
117
|
-
rtk-setup (action: "init")
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
Runs `rtk init -g` to install the bash rewriting hook, then immediately runs `rtk telemetry disable`. Reports both outcomes.
|
|
121
|
-
|
|
122
|
-
**Bash hook caveat:** `rtk init -g` writes to Claude Code / Copilot global config. Whether the hook fires automatically in OpenCode's non-interactive bash sessions depends on the runtime. Using `$RTK_BIN <cmd>` explicitly is always reliable.
|
|
123
|
-
|
|
124
|
-
---
|
|
125
|
-
|
|
126
|
-
## Installing rtk
|
|
127
|
-
|
|
128
|
-
FlowDeck does **not** auto-install rtk. Auto-executing a remote shell script is a supply-chain risk. Install manually:
|
|
129
|
-
|
|
130
|
-
```bash
|
|
131
|
-
# Linux / macOS
|
|
132
|
-
curl -fsSL https://raw.githubusercontent.com/rtk-ai/rtk/refs/heads/master/install.sh | sh
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
After installation, add `~/.local/bin` to your PATH if not already present, then verify:
|
|
136
|
-
|
|
137
|
-
```bash
|
|
138
|
-
rtk --version
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
FlowDeck will detect the binary automatically on the next session start.
|
|
142
|
-
|
|
143
|
-
---
|
|
144
|
-
|
|
145
|
-
## No rtk? No problem.
|
|
146
|
-
|
|
147
|
-
rtk is entirely optional. If rtk is not installed:
|
|
148
|
-
- `RTK_INSTALLED=false` is injected (no `RTK_BIN` or `RTK_TELEMETRY_DISABLED`)
|
|
149
|
-
- All commands run as normal — no change to behavior
|
|
150
|
-
- The `rtk-setup` tool returns install instructions instead of status
|
|
151
|
-
- All FlowDeck workflows remain fully functional
|
|
152
|
-
|
|
153
|
-
---
|
|
154
|
-
|
|
155
|
-
## Files
|
|
156
|
-
|
|
157
|
-
| File | Purpose |
|
|
158
|
-
|------|---------|
|
|
159
|
-
| `src/services/rtk-manager.ts` | Detection (`detectRtk`), init (`initRtk`), status (`getRtkStatus`), wrapping (`wrapCommandArgs`) |
|
|
160
|
-
| `src/services/rtk-policy.ts` | Command wrapping policy — supported list, compact-git exclusions, `shouldWrapWithRtk()` |
|
|
161
|
-
| `src/tools/rtk-setup.ts` | Agent-callable `rtk-setup` tool |
|
|
162
|
-
| `src/hooks/shell-env-hook.ts` | Injects `RTK_INSTALLED`, `RTK_BIN`, `RTK_TELEMETRY_DISABLED` into bash sessions |
|