Skip to content

feat: add Letta Code CLI provider#1900

Open
janburzinski wants to merge 3 commits intogeneralaction:mainfrom
janburzinski:jan/eng-829-feat-letta-code-cli
Open

feat: add Letta Code CLI provider#1900
janburzinski wants to merge 3 commits intogeneralaction:mainfrom
janburzinski:jan/eng-829-feat-letta-code-cli

Conversation

@janburzinski
Copy link
Copy Markdown
Collaborator

summary

add letta as a new cli provider

…a-code-cli

# Conflicts:
#	agents/integrations/providers.md
#	src/main/core/conversations/impl/agent-command.ts
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 6, 2026

Greptile Summary

This PR adds Letta Code as the 25th CLI provider in the emdash multi-agent harness. It wires in the icon, agent metadata, a classifier for output classification, and a new newConversationFlag mechanism (used when a provider defaults to resuming its last session rather than starting fresh).

  • New newConversationFlag field added to AgentProviderDefinition and handled in buildAgentCommand: when starting a non-resuming session for a provider with this flag, --new is appended so bare letta doesn't silently auto-resume the previous conversation.
  • Classifier (src/main/core/agent-hooks/classifiers/letta.ts) is structurally a near-copy of the Kiro classifier, extended with Letta-specific idle prompt patterns (letta >, Press Tab, slash commands) and a broader auth_success regex.
  • The provider registry entry is well-structured and follows established conventions (useKeystrokeInjection, autoApproveFlag, terminalOnly); defaults are correctly picked up via providerConfigDefaults in schema.ts.

Confidence Score: 4/5

Safe to merge — the new provider follows established conventions and the command-building logic is correct for both new and resuming sessions.

The newConversationFlag mechanism is sound and the Letta entry integrates cleanly with the existing settings/defaults pipeline. The only notable concern is the overly broad 'Connected to' alternative in the auth_success regex, which could cause spurious notifications during normal sessions but won't break functionality.

src/main/core/agent-hooks/classifiers/letta.ts — the auth_success regex pattern warrants a quick tightening before merge.

Important Files Changed

Filename Overview
src/shared/agent-provider-registry.ts Adds letta to AGENT_PROVIDER_IDS and a well-formed provider definition; also introduces the newConversationFlag field to the AgentProviderDefinition type.
src/main/core/conversations/impl/agent-command.ts Adds a third branch to the session-flag logic that emits newConversationFlag from the provider definition when starting a fresh (non-resuming) session; reads correctly from providerDef, not user overrides.
src/main/core/agent-hooks/classifiers/letta.ts New classifier adapted from Kiro's; idle-prompt detection is Letta-specific, but the auth_success regex adds a broad 'Connected to' alternative that risks false positives on ordinary terminal output.
src/renderer/utils/agentConfig.ts Adds Letta entry with isSvg: true and invertInDark: true; consistent with other SVG providers like openai.
src/main/core/agent-hooks/classifiers/index.ts Registers the new Letta classifier factory in the correct alphabetical position alongside other providers.
src/renderer/lib/providers/meta.ts Imports and maps the Letta SVG icon using the ?raw query, consistent with other SVG providers in the map.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[buildAgentCommand called] --> B{isResuming AND providerConfig.resumeFlag?}
    B -- Yes --> C[Push resumeFlag args + sessionId if sessionIdFlag]
    B -- No --> D{providerConfig.sessionIdFlag?}
    D -- Yes --> E[Push sessionIdFlag + sessionId]
    D -- No --> F{NOT isResuming AND providerDef.newConversationFlag?}
    F -- Yes --> G[Push newConversationFlag e.g. letta --new]
    F -- No --> H[No session flag appended e.g. bare letta = auto-resume]
    C --> Z[Continue building command]
    E --> Z
    G --> Z
    H --> Z
    Z --> I{autoApprove AND providerConfig.autoApproveFlag?}
    I -- Yes --> J[Push autoApproveFlag e.g. --yolo]
    I -- No --> K[Skip]
    J --> L{NOT isResuming AND initialPrompt AND NOT useKeystrokeInjection?}
    K --> L
    L -- Yes --> M[Push initialPromptFlag + prompt]
    L -- No --> N[Skip / deliver via keystroke injection]
Loading
Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 1
src/main/core/agent-hooks/classifiers/letta.ts:30-31
The `auth_success` check includes `"Connected to"` as an alternative, which is far broader than the other patterns in the block. Any Letta output that contains the phrase "Connected to" (e.g., "Connected to workspace", "Connected to remote agent", ordinary status lines) will fire an `auth_success` notification even during a normal session. The other patterns — `"Successfully authenticated"` and `"Login successful"` — are specific enough; `"Connected to"` should be made more precise or removed.

```suggestion
    // Auth success (e.g. /connect flow)
    if (/Successfully authenticated|Successfully connected|Login successful/i.test(text)) {
```

Reviews (1): Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." | Re-trigger Greptile

Comment on lines +30 to +31
// Auth success (e.g. /connect flow)
if (/Successfully authenticated|Connected to|Login successful/i.test(text)) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 The auth_success check includes "Connected to" as an alternative, which is far broader than the other patterns in the block. Any Letta output that contains the phrase "Connected to" (e.g., "Connected to workspace", "Connected to remote agent", ordinary status lines) will fire an auth_success notification even during a normal session. The other patterns — "Successfully authenticated" and "Login successful" — are specific enough; "Connected to" should be made more precise or removed.

Suggested change
// Auth success (e.g. /connect flow)
if (/Successfully authenticated|Connected to|Login successful/i.test(text)) {
// Auth success (e.g. /connect flow)
if (/Successfully authenticated|Successfully connected|Login successful/i.test(text)) {
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/main/core/agent-hooks/classifiers/letta.ts
Line: 30-31

Comment:
The `auth_success` check includes `"Connected to"` as an alternative, which is far broader than the other patterns in the block. Any Letta output that contains the phrase "Connected to" (e.g., "Connected to workspace", "Connected to remote agent", ordinary status lines) will fire an `auth_success` notification even during a normal session. The other patterns — `"Successfully authenticated"` and `"Login successful"` — are specific enough; `"Connected to"` should be made more precise or removed.

```suggestion
    // Auth success (e.g. /connect flow)
    if (/Successfully authenticated|Successfully connected|Login successful/i.test(text)) {
```

How can I resolve this? If you propose a fix, please make it concise.

@rabanspiegel
Copy link
Copy Markdown
Contributor

closes #1701

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants