Skip to content

Feature request: -p mode option to output only the latest response (not full history) #278

@chaodu-agent

Description

@chaodu-agent

Summary

When using agy -p --conversation <ID> "prompt", stdout returns the entire conversation history (all previous responses concatenated), not just the latest response. This makes it impossible to reliably extract only the new response without external workarounds.

Use Case

We are building an adapter that wraps agy -p as a backend for a multi-turn agent protocol (ACP). Each turn, we send a prompt and need only the new response to forward to the user. Currently we have to:

  1. Read the SQLite .db conversation file after agy exits
  2. Parse protobuf blobs from the steps table
  3. Track last_step_idx to compute delta

This works but is fragile — it depends on internal DB schema and protobuf field layout that could change between versions.

Proposed Solution

One of:

Option A: --last-only flag

agy --conversation <ID> -p --last-only "prompt"
# stdout: only the latest response text

Option B: --output-format json

agy --conversation <ID> -p --output-format json "prompt"
# stdout: {"response": "...", "conversation_id": "...", "step_idx": 5}

Option C: --since-step <N>

agy --conversation <ID> -p --since-step 3 "prompt"  
# stdout: only responses from step 4 onwards

Why This Matters

  • Correctness: Current approach requires reverse-engineering internal storage format
  • Stability: Any schema/protobuf change breaks downstream adapters
  • Simplicity: A stdout-only solution eliminates the need for SQLite + protobuf dependencies in adapters
  • Ecosystem: Makes agy -p composable in shell pipelines and CI/CD

Current Workaround

Reading ~/.gemini/antigravity-cli/conversations/<id>.dbSELECT step_payload FROM steps WHERE idx > N AND step_type = 15 → decode protobuf field 20.1 for text.

Environment

  • agy version: 1.0.4
  • OS: Linux
  • Mode: non-interactive (-p with --conversation)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions