> For the complete documentation index, see [llms.txt](https://kiwi-8.gitbook.io/kiwi-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kiwi-8.gitbook.io/kiwi-docs/kiwi-ask-en-scripts.md).

# kiwi ask en scripts

`kiwi ask` ejecuta un turno y escribe la respuesta en stdout. Está pensado para componer con otras herramientas.

```sh
kiwi ask "¿qué hace este repo?"
git diff | kiwi ask
git diff | kiwi ask "revisa este parche" -
```

El prompt sale de los argumentos, de stdin, o de los dos. Stdin se lee cuando no hay argumentos, o cuando uno de ellos es `-`, que marca dónde encaja lo que llega por la tubería.

## stdout y stderr están separados

La **respuesta** va a stdout; el **progreso** de las llamadas a herramientas va a stderr. Eso significa que redirigir stdout te da solo la respuesta, limpia:

```sh
kiwi ask "resume los cambios de hoy" > resumen.md
```

Y si el progreso te molesta incluso en pantalla:

```sh
kiwi ask -q "..."
```

## Permisos

Por defecto **solo lectura** (`plan`), porque nadie está delante para aprobar nada:

```sh
kiwi ask --mode work "añade tests a internal/parser"   # puede editar ficheros
kiwi ask --mode work --yolo "..."                       # además ejecuta comandos
```

Piensa en `--yolo` como lo que es: le quitas el freno a un proceso que nadie está mirando. Tiene sentido en un contenedor desechable o en CI; menos en tu portátil con el repo de producción abierto.

## Ejemplos que se usan de verdad

Revisar un parche antes de subirlo:

```sh
git diff --cached | kiwi ask "¿algún fallo en este parche?" -
```

Explicar un error de CI:

```sh
gh run view --log-failed | kiwi ask "¿por qué falla esto?" -
```

Generar el mensaje de commit:

```sh
git diff --cached | kiwi ask "escribe un mensaje de commit para esto" - | git commit -F -
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://kiwi-8.gitbook.io/kiwi-docs/kiwi-ask-en-scripts.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
