Skip to content

feat: add Mistral Vibe external agent plugin#4

Draft
alishakawaguchi wants to merge 9 commits intomainfrom
mistral-plugin
Draft

feat: add Mistral Vibe external agent plugin#4
alishakawaguchi wants to merge 9 commits intomainfrom
mistral-plugin

Conversation

@alishakawaguchi
Copy link
Copy Markdown
Contributor

@alishakawaguchi alishakawaguchi commented Mar 25, 2026

Summary

Add Mistral Vibe as an external agent plugin for the Entire CLI, implementing the full agent binary protocol.

  • Research one-pager and verification script for Vibe's hook lifecycle, transcript format, and session storage
  • Implementation spec for lifecycle hooks mapping (Vibe native → Entire protocol)
  • Agent binary (entire-agent-mistral-vibe) with all protocol subcommands: info, detect, get-session-id, get-session-dir, resolve-session-file, read-session, write-session, read-transcript, chunk-transcript, reassemble-transcript, format-resume-command, parse-hook, install-hooks, uninstall-hooks, are-hooks-installed, get-transcript-position, extract-modified-files, extract-prompts, extract-summary
  • Hook installation writes TOML config to .vibe/config.toml and trusts the repo directory via ~/.vibe/trusted_folders.toml
  • Transcript analysis (JSONL): position tracking, file extraction from tool calls, prompt extraction, summary extraction
  • Session persistence: placeholder transcript fallback when Vibe native logs are absent (mirrors Kiro's createPlaceholderTranscript pattern)
  • E2E test harness with transcript builder fixtures, hook payload helpers, and full binary-level coverage
  • Unit tests for all agent methods, hook parsing, transcript analysis, and placeholder creation
  • Fix lifecycle RewindAfterCommit test timing: condition-based polling for condensation instead of single check

Test plan

  • Unit tests: go test ./... — 40/40 pass
  • E2E module vets cleanly: go vet -tags=e2e ./...
  • E2E lifecycle tests: SessionPersistence, RewindAfterCommit (requires full Entire CLI + Vibe binary)
  • Manual: entire enable --agent mistral-vibe in a repo with .vibe/

🤖 Generated with Claude Code

alishakawaguchi and others added 4 commits March 24, 2026 09:46
… script

Analyze Mistral Vibe (v2.6.2) for external agent protocol compatibility.
Key findings: no native hook system, but rich session management via
~/.vibe/logs/session/ with meta.json + messages.jsonl (structured JSONL).
Capabilities: transcript_analyzer=true, token_calculator=true, hooks=false.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Entire-Checkpoint: 21de3e7235f8
Comprehensive reference for adding lifecycle hooks to Mistral Vibe's
open source codebase. Covers hook config format, payload schemas,
integration points in the agent loop, and how it maps to the Entire
CLI external agent protocol. Designed to be used as a standalone
reference by an implementing agent.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Entire-Checkpoint: 8b8486ede423
Implement the entire-agent-mistral-vibe binary with full protocol
subcommand support (info, detect, sessions, transcripts, hooks,
transcript analysis). Add 30 E2E tests covering all subcommands
and register Mistral Vibe as an agent for shared lifecycle tests.

Updated AGENT.md to reflect verified lifecycle hooks (session_start,
user_prompt_submit, pre_tool_use, post_tool_use, turn_end) with
captured payloads from real Vibe sessions.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Entire-Checkpoint: 5cdc3adc6a68
- InstallHooks now adds the repo to ~/.vibe/trusted_folders.toml so
  Vibe reads project-level .vibe/config.toml (required for hooks to fire)
- ParseHook turn-end now globs ~/.vibe/logs/session/ to find the actual
  session directory matching the session ID prefix
- Add comprehensive unit tests for agent, hooks, and transcript analysis
  using golden JSONL data from real Vibe session captures

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Entire-Checkpoint: e108d2f670de
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 3 potential issues.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Comment @cursor review or bugbot run to trigger another review on this PR

}

return os.WriteFile(configPath, []byte(strings.Join(filteredLines, "\n")), 0o600)
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UninstallHooks leaves orphan TOML table headers in config

High Severity

UninstallHooks only filters lines containing hookMarker ("entire hooks mistral-vibe"), but the TOML section headers like [[hooks.session_start]] don't contain that marker. After filtering, orphan [[hooks.session_start]], [[hooks.user_prompt_submit]], etc. lines remain. The remaining check only handles empty or "[hooks]", so these orphan headers cause the file to be rewritten with invalid leftover TOML instead of being deleted. This leaves .vibe/config.toml in a broken state after uninstall.

Fix in Cursor Fix in Web

content := strings.Join(tomlLines, "\n")
if err := os.WriteFile(configPath, []byte(content), 0o600); err != nil {
return 0, fmt.Errorf("failed to write config.toml: %w", err)
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

InstallHooks overwrites existing project config file entirely

High Severity

InstallHooks builds hook TOML lines from scratch and writes them via os.WriteFile, which truncates .vibe/config.toml. Any existing Vibe project-level configuration (model settings, custom tools, other TOML sections) in that file is silently destroyed. The Kiro agent avoids this by writing hooks to separate dedicated files rather than the main config.

Fix in Cursor Fix in Web

return a
}
return b
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused min function is dead code

Low Severity

The min function in hooks.go is defined but never called anywhere in the codebase. On Go 1.21+ (this project uses Go 1.26), min is a builtin, so this custom definition is dead code that also shadows the builtin.

Fix in Cursor Fix in Web

alishakawaguchi and others added 5 commits March 25, 2026 15:08
…ead min

Extract duplicated session ID fallback above the switch in ParseHook,
simplify redundant sessionRef guard in ReadSession, and remove unused
min helper (builtin in Go 1.21+).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Entire-Checkpoint: caf6d3c50a6a
SessionPersistence: ParseHook(turn-end) returned empty SessionRef when
Vibe's native logs were absent (e.g. test envs), so the entire CLI
skipped session writing. Add ensurePlaceholderTranscript() fallback that
creates a {} file at .entire/tmp/{id}.json, matching Kiro's pattern.

RewindAfterCommit: WaitForCheckpoint only waited for checkpoint branch
advancement, but condensation runs async. Replace the single rewind-list
check with condition-based polling (30s) for the shadow point to become
logs-only.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Entire-Checkpoint: 99e4793da14a
The entire CLI does not call write-session during hook processing.
For Kiro, captureTranscriptForStop copies the transcript into
.entire/tmp/ as a side effect of parse-hook, so a session file exists.

Vibe was returning the native log path (~/.vibe/logs/session/...)
directly as SessionRef — nothing was written to .entire/tmp/.

Add cacheTranscriptForTurnEnd which copies the native Vibe transcript
into .entire/tmp/{sessionID}.json and returns the local path. Falls
back to a {} placeholder when native logs are absent.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Entire-Checkpoint: cd955dffa249
Replace magic numbers (1, 2, 3) for event types with named constants
EventTypeSessionStart, EventTypeTurnStart, EventTypeTurnEnd.

Remove unused NativeToProtocolHook map and its test — the mapping was
only tested, never used in production code. Remove unused
VibeSessionMeta and VibeSessionStats types (placeholder definitions
with no consumers).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Entire-Checkpoint: d140fbb39172
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant