rlhf-feedback-loop 0.6.10 → 0.6.12
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 +10 -0
- package/README.md +120 -74
- package/adapters/README.md +3 -3
- package/adapters/amp/skills/rlhf-feedback/SKILL.md +2 -0
- package/adapters/chatgpt/INSTALL.md +6 -3
- package/adapters/chatgpt/openapi.yaml +5 -2
- package/adapters/claude/.mcp.json +3 -3
- package/adapters/codex/config.toml +3 -3
- package/adapters/gemini/function-declarations.json +2 -2
- package/adapters/mcp/server-stdio.js +19 -5
- package/bin/cli.js +295 -25
- package/openapi/openapi.yaml +5 -2
- package/package.json +25 -9
- package/scripts/a2ui-engine.js +73 -0
- package/scripts/adk-consolidator.js +267 -0
- package/scripts/billing.js +192 -681
- package/scripts/code-reasoning.js +26 -1
- package/scripts/context-engine.js +86 -4
- package/scripts/contextfs.js +130 -0
- package/scripts/disagreement-mining.js +315 -0
- package/scripts/export-kto-pairs.js +310 -0
- package/scripts/feedback-ingest-watcher.js +290 -0
- package/scripts/feedback-loop.js +153 -8
- package/scripts/feedback-quality.js +139 -0
- package/scripts/feedback-schema.js +31 -5
- package/scripts/feedback-to-memory.js +13 -1
- package/scripts/hook-auto-capture.sh +6 -0
- package/scripts/hook-stop-self-score.sh +51 -0
- package/scripts/install-mcp.js +168 -0
- package/scripts/intent-router.js +88 -0
- package/scripts/jsonl-watcher.js +151 -0
- package/scripts/local-model-profile.js +207 -0
- package/scripts/pr-manager.js +112 -0
- package/scripts/prove-adapters.js +137 -15
- package/scripts/prove-attribution.js +6 -6
- package/scripts/prove-automation.js +41 -8
- package/scripts/prove-data-quality.js +16 -8
- package/scripts/prove-intelligence.js +7 -4
- package/scripts/prove-lancedb.js +7 -7
- package/scripts/prove-local-intelligence.js +244 -0
- package/scripts/prove-loop-closure.js +16 -8
- package/scripts/prove-training-export.js +7 -4
- package/scripts/prove-workflow-contract.js +116 -0
- package/scripts/reminder-engine.js +132 -0
- package/scripts/risk-scorer.js +458 -0
- package/scripts/rlaif-self-audit.js +7 -1
- package/scripts/self-heal.js +24 -4
- package/scripts/status-dashboard.js +155 -0
- package/scripts/sync-version.js +159 -0
- package/scripts/test-coverage.js +76 -0
- package/scripts/validate-workflow-contract.js +287 -0
- package/scripts/vector-store.js +115 -17
- package/src/api/server.js +372 -25
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.6.11 - 2026-03-10
|
|
4
|
+
|
|
5
|
+
- Added Inverse Sink Weighting and Anchor-Memory management to prevent runaway negative memory accumulation and stabilize agent behavior over long sessions.
|
|
6
|
+
- Hardened MCP startup reliability: retry logic, process health checks, and graceful degradation on server init failures.
|
|
7
|
+
- North Star Phase 1: KTO export pipeline, MCP install workflow, and FDD (Feedback-Driven Development) rebrand replacing RLHF-loop branding.
|
|
8
|
+
- System hygiene: documented session directives in CLAUDE.md and fixed environment-dependent billing test failures causing flaky CI.
|
|
9
|
+
- A2UI model for dynamic agent-to-user interaction: agents can now emit structured UI events that surface inline prompts, confirmation dialogs, and progress updates.
|
|
10
|
+
- ADK memory consolidator with Gemini integration: deduplicates and ranks cross-session memories using Gemini embeddings for relevance scoring.
|
|
11
|
+
- OpenDev patterns: adaptive context compaction (auto-prune low-signal context items), event-driven reminder injection (surface forgotten constraints mid-session), and model role router (dispatch sub-tasks to appropriately-sized models based on complexity).
|
|
12
|
+
|
|
3
13
|
## 0.5.0 - 2026-03-03
|
|
4
14
|
|
|
5
15
|
- Added autonomous GitOps workflows: agent auto-merge, Dependabot auto-merge, self-healing monitor, and merge-branch fallback.
|
package/README.md
CHANGED
|
@@ -1,107 +1,153 @@
|
|
|
1
|
-
#
|
|
1
|
+
# MCP Memory Gateway
|
|
2
2
|
|
|
3
3
|
[](https://github.com/IgorGanapolsky/rlhf-feedback-loop/actions/workflows/ci.yml)
|
|
4
|
-
[](https://github.com/IgorGanapolsky/rlhf-feedback-loop/actions/workflows/self-healing-monitor.yml)
|
|
5
|
+
[](https://www.npmjs.com/package/rlhf-feedback-loop)
|
|
6
|
+
[](LICENSE)
|
|
7
|
+
[](package.json)
|
|
6
8
|
|
|
7
|
-
**
|
|
9
|
+
**Local-first memory and feedback pipeline for AI agents.** Captures thumbs-up/down signals, promotes reusable memories, generates prevention rules from repeated failures, and exports KTO/DPO pairs for fine-tuning.
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
Works with any MCP-compatible agent: Claude, Codex, Gemini, Amp, Cursor.
|
|
10
12
|
|
|
11
|
-
##
|
|
13
|
+
## What It Does
|
|
12
14
|
|
|
13
|
-
|
|
15
|
+
```
|
|
16
|
+
thumbs up/down → validate → promote to memory → vector index → prevention rules → DPO export
|
|
17
|
+
```
|
|
14
18
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
19
|
+
1. **Capture** — `capture_feedback` MCP tool accepts signals with context
|
|
20
|
+
2. **Validate** — Rubric engine gates promotion (vague feedback is rejected with clarification prompts)
|
|
21
|
+
3. **Remember** — Promoted memories stored in JSONL + LanceDB vectors
|
|
22
|
+
4. **Prevent** — Repeated failures auto-generate prevention rules
|
|
23
|
+
5. **Export** — KTO/DPO pairs for downstream fine-tuning
|
|
24
|
+
6. **Bridge** — JSONL file watcher auto-ingests signals from external sources (Amp plugins, hooks, scripts)
|
|
18
25
|
|
|
19
|
-
|
|
26
|
+
## Quick Start
|
|
20
27
|
|
|
21
|
-
|
|
28
|
+
```bash
|
|
29
|
+
# Add to any MCP-compatible agent
|
|
30
|
+
claude mcp add rlhf -- npx -y rlhf-feedback-loop serve
|
|
31
|
+
codex mcp add rlhf -- npx -y rlhf-feedback-loop serve
|
|
32
|
+
amp mcp add rlhf -- npx -y rlhf-feedback-loop serve
|
|
33
|
+
gemini mcp add rlhf "npx -y rlhf-feedback-loop serve"
|
|
34
|
+
|
|
35
|
+
# Or auto-detect all installed platforms
|
|
36
|
+
npx rlhf-feedback-loop init
|
|
37
|
+
```
|
|
22
38
|
|
|
23
|
-
|
|
24
|
-
|----------|---------|
|
|
25
|
-
| **Claude** | `claude mcp add rlhf -- npx -y rlhf-feedback-loop serve` |
|
|
26
|
-
| **Codex** | `codex mcp add rlhf -- npx -y rlhf-feedback-loop serve` |
|
|
27
|
-
| **Gemini** | `gemini mcp add rlhf "npx -y rlhf-feedback-loop serve"` |
|
|
28
|
-
| **Amp** | `amp mcp add rlhf -- npx -y rlhf-feedback-loop serve` |
|
|
29
|
-
| **Cursor** | `cursor mcp add rlhf -- npx -y rlhf-feedback-loop serve` |
|
|
39
|
+
## MCP Tools
|
|
30
40
|
|
|
31
|
-
|
|
41
|
+
| Tool | Description |
|
|
42
|
+
|------|-------------|
|
|
43
|
+
| `capture_feedback` | Accept up/down signal + context, validate, promote to memory |
|
|
44
|
+
| `recall` | Vector-search past feedback and prevention rules for current task |
|
|
45
|
+
| `feedback_stats` | Approval rate, per-skill/tag breakdown, trend analysis |
|
|
46
|
+
| `feedback_summary` | Human-readable recent feedback summary |
|
|
47
|
+
| `prevention_rules` | Generate prevention rules from repeated mistakes |
|
|
48
|
+
| `export_dpo_pairs` | Build DPO preference pairs from promoted memories |
|
|
49
|
+
| `construct_context_pack` | Bounded context pack from contextfs |
|
|
50
|
+
| `evaluate_context_pack` | Record context pack outcome (closes learning loop) |
|
|
51
|
+
| `list_intents` | Available action plan templates |
|
|
52
|
+
| `plan_intent` | Generate execution plan with policy checkpoints |
|
|
53
|
+
| `context_provenance` | Audit trail of context decisions |
|
|
54
|
+
|
|
55
|
+
## CLI
|
|
32
56
|
|
|
33
57
|
```bash
|
|
34
|
-
npx
|
|
58
|
+
npx rlhf-feedback-loop init # Scaffold .rlhf/ + configure MCP
|
|
59
|
+
npx rlhf-feedback-loop serve # Start MCP server (stdio) + watcher
|
|
60
|
+
npx rlhf-feedback-loop status # Learning curve dashboard
|
|
61
|
+
npx rlhf-feedback-loop watch # Watch .rlhf/ for external signals
|
|
62
|
+
npx rlhf-feedback-loop watch --once # Process pending signals and exit
|
|
63
|
+
npx rlhf-feedback-loop capture # Capture feedback via CLI
|
|
64
|
+
npx rlhf-feedback-loop stats # Analytics + Revenue-at-Risk
|
|
65
|
+
npx rlhf-feedback-loop rules # Generate prevention rules
|
|
66
|
+
npx rlhf-feedback-loop export-dpo # Export DPO training pairs
|
|
67
|
+
npx rlhf-feedback-loop risk # Train/query boosted risk scorer
|
|
68
|
+
npx rlhf-feedback-loop self-heal # Run self-healing diagnostics
|
|
35
69
|
```
|
|
36
70
|
|
|
37
|
-
|
|
38
|
-
- **Preference Data Engineering:** Capture high-density context (rubrics, guardrails, metadata) for DPO training.
|
|
39
|
-
- **Bayesian Scoring:** Use Thompson Sampling to handle evolving user preferences over time.
|
|
71
|
+
## JSONL File Watcher
|
|
40
72
|
|
|
41
|
-
|
|
73
|
+
The `serve` command automatically starts a background watcher that monitors `feedback-log.jsonl` for entries written by external sources (Amp plugins, shell hooks, CI scripts). These entries are routed through the full `captureFeedback()` pipeline — validation, memory promotion, vector indexing, and DPO eligibility.
|
|
42
74
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
75
|
+
```bash
|
|
76
|
+
# Standalone watcher
|
|
77
|
+
npx rlhf-feedback-loop watch --source amp-plugin-bridge
|
|
46
78
|
|
|
47
|
-
|
|
79
|
+
# Process pending entries once and exit
|
|
80
|
+
npx rlhf-feedback-loop watch --once
|
|
81
|
+
```
|
|
48
82
|
|
|
49
|
-
|
|
83
|
+
External sources write entries with a `source` field:
|
|
84
|
+
```json
|
|
85
|
+
{"signal":"positive","context":"Agent fixed bug on first try","source":"amp-plugin-bridge","tags":["amp-ui-bridge"]}
|
|
86
|
+
```
|
|
50
87
|
|
|
51
|
-
|
|
88
|
+
The watcher tracks its position via `.rlhf/.watcher-offset` for crash-safe, idempotent processing.
|
|
52
89
|
|
|
53
|
-
|
|
90
|
+
## Learning Curve Dashboard
|
|
54
91
|
|
|
55
|
-
|
|
92
|
+
```bash
|
|
93
|
+
npx rlhf-feedback-loop status
|
|
94
|
+
```
|
|
56
95
|
|
|
57
96
|
```
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
97
|
+
╔══════════════════════════════════════╗
|
|
98
|
+
║ RLHF Learning Curve Dashboard ║
|
|
99
|
+
╠══════════════════════════════════════╣
|
|
100
|
+
║ Total signals: 148 ║
|
|
101
|
+
║ Positive: 45 (30%) ║
|
|
102
|
+
║ Negative: 103 (70%) ║
|
|
103
|
+
║ Recent (last 20): 20% ║
|
|
104
|
+
║ Trend: 📉 declining ║
|
|
105
|
+
║ Memories: 17 ║
|
|
106
|
+
║ Prevention rules: 9 ║
|
|
107
|
+
╠══════════════════════════════════════╣
|
|
108
|
+
║ Top failure domains: ║
|
|
109
|
+
║ execution-gap 4 ║
|
|
110
|
+
║ asked-not-doing 2 ║
|
|
111
|
+
║ speed 2 ║
|
|
112
|
+
╠══════════════════════════════════════╣
|
|
113
|
+
║ Learning curve (approval % by window)║
|
|
114
|
+
║ [1-10] 10% ██ ║
|
|
115
|
+
║ [11-20] 20% ████ ║
|
|
116
|
+
║ [21-30] 35% ███████ ║
|
|
117
|
+
║ [31-40] 30% ██████ ║
|
|
118
|
+
╚══════════════════════════════════════╝
|
|
79
119
|
```
|
|
80
120
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
## Free vs. Cloud Pro
|
|
121
|
+
## Architecture
|
|
84
122
|
|
|
85
|
-
|
|
123
|
+
Five-phase pipeline: **Capture** → **Validate** → **Remember** → **Prevent** → **Export**
|
|
86
124
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
125
|
+
```
|
|
126
|
+
Agent (Claude/Codex/Amp/Gemini)
|
|
127
|
+
│
|
|
128
|
+
├── MCP tool call ──→ captureFeedback()
|
|
129
|
+
├── REST API ────────→ captureFeedback()
|
|
130
|
+
├── CLI ─────────────→ captureFeedback()
|
|
131
|
+
└── External write ──→ JSONL ──→ Watcher ──→ captureFeedback()
|
|
132
|
+
│
|
|
133
|
+
▼
|
|
134
|
+
┌─────────────────┐
|
|
135
|
+
│ Full Pipeline │
|
|
136
|
+
│ • Schema valid │
|
|
137
|
+
│ • Rubric gate │
|
|
138
|
+
│ • Memory promo │
|
|
139
|
+
│ • Vector index │
|
|
140
|
+
│ • Risk scoring │
|
|
141
|
+
│ • RLAIF audit │
|
|
142
|
+
│ • DPO eligible │
|
|
143
|
+
└─────────────────┘
|
|
144
|
+
```
|
|
98
145
|
|
|
99
|
-
##
|
|
146
|
+
## Agent Runner Contract
|
|
100
147
|
|
|
101
|
-
- [
|
|
102
|
-
- [
|
|
103
|
-
- [
|
|
104
|
-
- [Contributing](CONTRIBUTING.md)
|
|
148
|
+
- [WORKFLOW.md](WORKFLOW.md): scope, proof-of-work, hard stops, and done criteria for isolated agent runs
|
|
149
|
+
- [.github/ISSUE_TEMPLATE/ready-for-agent.yml](.github/ISSUE_TEMPLATE/ready-for-agent.yml): bounded intake template for "Ready for Agent" tickets
|
|
150
|
+
- [.github/pull_request_template.md](.github/pull_request_template.md): proof-first handoff format for PRs
|
|
105
151
|
|
|
106
152
|
## License
|
|
107
153
|
|
package/adapters/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
- `chatgpt/openapi.yaml`: import into GPT Actions.
|
|
4
4
|
- `gemini/function-declarations.json`: Gemini function-calling definitions.
|
|
5
|
-
- `mcp/server-stdio.js`: local MCP server
|
|
6
|
-
- `claude/.mcp.json`: example Claude Code MCP config.
|
|
7
|
-
- `codex/config.toml`: example Codex MCP profile section.
|
|
5
|
+
- `mcp/server-stdio.js`: underlying local MCP stdio server implementation.
|
|
6
|
+
- `claude/.mcp.json`: example Claude Code MCP config using `npx -y rlhf-feedback-loop@0.6.12 serve`.
|
|
7
|
+
- `codex/config.toml`: example Codex MCP profile section using the same version-pinned portable launcher.
|
|
8
8
|
- `amp/skills/rlhf-feedback/SKILL.md`: Amp skill template.
|
|
@@ -12,6 +12,8 @@ node .claude/scripts/feedback/capture-feedback.js --feedback=up --context="..."
|
|
|
12
12
|
node .claude/scripts/feedback/capture-feedback.js --feedback=down --context="..." --tags="..."
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
+
Do not claim promotion from a bare `thumbs up/down`. Ask for one sentence describing what worked or failed first.
|
|
16
|
+
|
|
15
17
|
Before major implementation:
|
|
16
18
|
|
|
17
19
|
```bash
|
|
@@ -52,17 +52,20 @@ Click **Test** on the `captureFeedback` action:
|
|
|
52
52
|
```json
|
|
53
53
|
{
|
|
54
54
|
"signal": "up",
|
|
55
|
-
"context": "GPT Actions install verified"
|
|
55
|
+
"context": "GPT Actions install verified with a successful test call",
|
|
56
|
+
"whatWorked": "The hosted action returned accepted=true and a promoted status"
|
|
56
57
|
}
|
|
57
58
|
```
|
|
58
59
|
|
|
59
|
-
Expected response: `200 OK` with `{ "
|
|
60
|
+
Expected response: `200 OK` with `{ "accepted": true, "status": "promoted" }`.
|
|
61
|
+
|
|
62
|
+
If you only send a bare `thumbs up/down` style payload, expect `422` with `status: "clarification_required"` and a follow-up `prompt`.
|
|
60
63
|
|
|
61
64
|
## Available Actions
|
|
62
65
|
|
|
63
66
|
| Action | Method | Path | Description |
|
|
64
67
|
|---|---|---|---|
|
|
65
|
-
| `captureFeedback` | POST | `/v1/feedback/capture` | Capture
|
|
68
|
+
| `captureFeedback` | POST | `/v1/feedback/capture` | Capture up/down signal plus one-line why |
|
|
66
69
|
| `getFeedbackStats` | GET | `/v1/feedback/stats` | Aggregated feedback statistics |
|
|
67
70
|
| `getFeedbackSummary` | GET | `/v1/feedback/summary` | Recent feedback summary |
|
|
68
71
|
| `generatePreventionRules` | POST | `/v1/feedback/rules` | Generate prevention rules |
|
|
@@ -5,6 +5,8 @@ info:
|
|
|
5
5
|
description: |
|
|
6
6
|
Production API for feedback capture, schema-validated memory promotion,
|
|
7
7
|
prevention rule generation, and DPO export.
|
|
8
|
+
Bare up/down signals are logged immediately, but the API returns
|
|
9
|
+
clarification_required until one sentence explains what worked or failed.
|
|
8
10
|
servers:
|
|
9
11
|
- url: https://rlhf-feedback-loop-710216278770.us-central1.run.app
|
|
10
12
|
security:
|
|
@@ -32,13 +34,14 @@ components:
|
|
|
32
34
|
type: string
|
|
33
35
|
CaptureFeedbackRequest:
|
|
34
36
|
type: object
|
|
35
|
-
required: [signal
|
|
37
|
+
required: [signal]
|
|
36
38
|
properties:
|
|
37
39
|
signal:
|
|
38
40
|
type: string
|
|
39
41
|
enum: [up, down, positive, negative]
|
|
40
42
|
context:
|
|
41
43
|
type: string
|
|
44
|
+
description: One-sentence reason describing what worked or failed
|
|
42
45
|
whatWentWrong:
|
|
43
46
|
type: string
|
|
44
47
|
whatToChange:
|
|
@@ -155,7 +158,7 @@ paths:
|
|
|
155
158
|
'200':
|
|
156
159
|
description: Feedback accepted and promoted to memory
|
|
157
160
|
'422':
|
|
158
|
-
description: Feedback
|
|
161
|
+
description: Feedback logged only; clarification required or promotion rejected
|
|
159
162
|
'401':
|
|
160
163
|
description: Unauthorized
|
|
161
164
|
/v1/feedback/stats:
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
# Codex MCP profile (copy into ~/.codex/config.toml or merge section)
|
|
2
|
-
[mcp_servers.
|
|
3
|
-
command = "
|
|
4
|
-
args = ["
|
|
2
|
+
[mcp_servers.rlhf]
|
|
3
|
+
command = "npx"
|
|
4
|
+
args = ["-y", "rlhf-feedback-loop@0.6.12", "serve"]
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"tools": [
|
|
3
3
|
{
|
|
4
4
|
"name": "capture_feedback",
|
|
5
|
-
"description": "Capture
|
|
5
|
+
"description": "Capture an up/down signal plus one line of why. Vague feedback is logged and returned with a clarification prompt instead of memory promotion.",
|
|
6
6
|
"parameters": {
|
|
7
7
|
"type": "object",
|
|
8
8
|
"properties": {
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
},
|
|
38
38
|
"skill": { "type": "string" }
|
|
39
39
|
},
|
|
40
|
-
"required": ["signal"
|
|
40
|
+
"required": ["signal"]
|
|
41
41
|
},
|
|
42
42
|
"http": {
|
|
43
43
|
"method": "POST",
|
|
@@ -58,13 +58,13 @@ function resolveSafePath(inputPath, { mustExist = false } = {}) {
|
|
|
58
58
|
const TOOLS = [
|
|
59
59
|
{
|
|
60
60
|
name: 'capture_feedback',
|
|
61
|
-
description: 'Capture
|
|
61
|
+
description: 'Capture an up/down signal plus one line of why. Vague feedback is logged, then returned with a clarification prompt instead of memory promotion.',
|
|
62
62
|
inputSchema: {
|
|
63
63
|
type: 'object',
|
|
64
|
-
required: ['signal'
|
|
64
|
+
required: ['signal'],
|
|
65
65
|
properties: {
|
|
66
66
|
signal: { type: 'string', enum: ['up', 'down'] },
|
|
67
|
-
context: { type: 'string' },
|
|
67
|
+
context: { type: 'string', description: 'One-sentence reason describing what worked or failed' },
|
|
68
68
|
whatWentWrong: { type: 'string' },
|
|
69
69
|
whatToChange: { type: 'string' },
|
|
70
70
|
whatWorked: { type: 'string' },
|
|
@@ -234,6 +234,15 @@ function toText(result) {
|
|
|
234
234
|
return JSON.stringify(result, null, 2);
|
|
235
235
|
}
|
|
236
236
|
|
|
237
|
+
function formatCaptureFeedbackResult(result) {
|
|
238
|
+
const message = result.accepted
|
|
239
|
+
? 'Feedback promoted to reusable memory.'
|
|
240
|
+
: result.needsClarification
|
|
241
|
+
? result.message
|
|
242
|
+
: 'Signal logged, but reusable memory was not created.';
|
|
243
|
+
return toText({ ...result, message });
|
|
244
|
+
}
|
|
245
|
+
|
|
237
246
|
function parseOptionalObject(input, name) {
|
|
238
247
|
if (input == null) return {};
|
|
239
248
|
if (typeof input === 'object' && !Array.isArray(input)) return input;
|
|
@@ -328,6 +337,11 @@ async function callTool(name, args = {}) {
|
|
|
328
337
|
tags: ['auto-capture', 'mcp'],
|
|
329
338
|
});
|
|
330
339
|
const ev = autoResult.feedbackEvent || {};
|
|
340
|
+
const promotionLine = autoResult.accepted
|
|
341
|
+
? `yes (Memory ID: ${(autoResult.memoryRecord || {}).id})`
|
|
342
|
+
: autoResult.needsClarification
|
|
343
|
+
? `no — clarification required: ${autoResult.prompt}`
|
|
344
|
+
: `no — ${autoResult.reason || ''}`;
|
|
331
345
|
const autoReport = [
|
|
332
346
|
'',
|
|
333
347
|
`## Auto-Captured Feedback [${autoSignal.toUpperCase()}]`,
|
|
@@ -335,7 +349,7 @@ async function callTool(name, args = {}) {
|
|
|
335
349
|
` Signal : ${ev.signal || autoSignal} (${ev.actionType || 'unknown'})`,
|
|
336
350
|
` Context : ${(ev.context || textToCheck).slice(0, 80)}`,
|
|
337
351
|
` Timestamp : ${ev.timestamp || new Date().toISOString()}`,
|
|
338
|
-
` Promoted : ${
|
|
352
|
+
` Promoted : ${promotionLine}`,
|
|
339
353
|
'',
|
|
340
354
|
formatStats(),
|
|
341
355
|
].join('\n');
|
|
@@ -433,7 +447,7 @@ async function callToolInner(name, args = {}) {
|
|
|
433
447
|
}
|
|
434
448
|
} catch (_) {}
|
|
435
449
|
|
|
436
|
-
return { content: [{ type: 'text', text:
|
|
450
|
+
return { content: [{ type: 'text', text: formatCaptureFeedbackResult(result) + recallText }] };
|
|
437
451
|
}
|
|
438
452
|
|
|
439
453
|
if (name === 'feedback_summary') {
|