feat(tui): /study slash command to prime the agent on the current project

New built-in /study command that runs a single canned prompt:
"Read and understand everything in the current directory." The
first thing most sessions need is project context, and typing
the full sentence every time is friction; /study turns that
into one keystroke-saving shortcut.

Dispatched through the same queue-or-start path as a typed
prompt, so it behaves identically:

  - idle  -> startTurn(studyPrompt)
  - busy  -> queued behind the running turn, delivered next

Also added to the README slash-commands table so /help output
and the top-level docs stay in sync with slashCatalog.
This commit is contained in:
patriceckhart 2026-04-21 08:59:53 +02:00
parent 51fd11fce6
commit ce806272e0
3 changed files with 18 additions and 0 deletions

View file

@ -187,6 +187,7 @@ Type `/` in the TUI to open the autocomplete popup. Available commands:
| `/btw` | Side chat with full context that doesn't add to the main thread. |
| `/skills` | List discovered skills (SKILL.md files) and preview their bodies. |
| `/compact` | Summarize the transcript into one message to free up context. |
| `/study` | Run the canned prompt "Read and understand everything in the current directory." so the agent has full project context before you start asking targeted questions. |
| `/jail` | Confine tools to the current directory. |
| `/unjail` | Allow tools to touch paths outside again. |
| `/reload-ext` | Hot-reload all extensions (re-read manifests, respawn subprocesses, rebuild tool registry). |

View file

@ -1452,6 +1452,22 @@ func (i *Interactive) runSlash(ctx context.Context, cmd string) (done bool) {
i.openSkillsDialog()
case "/compact":
i.runCompact(ctx, false)
case "/study":
// Canned prompt that tells the agent to read every file
// in the current directory so its later turns have the
// whole project in context. Dispatched through the normal
// queue-or-start path so it behaves identically to
// typing the prompt by hand.
const studyPrompt = "Read and understand everything in the current directory."
i.mu.Lock()
if i.busy {
i.queued = append(i.queued, studyPrompt)
i.mu.Unlock()
i.invalidate()
break
}
i.mu.Unlock()
i.startTurn(ctx, studyPrompt)
case "/jail":
if i.cfg.Sandbox == nil {
i.mu.Lock()

View file

@ -40,6 +40,7 @@ var slashCatalog = []slashCommand{
{Name: "/session", Desc: "export the current session to a .zotsession file, or import one"},
{Name: "/jump", Desc: "scroll the chat to a previous turn (or /jump <text>)"},
{Name: "/compact", Desc: "summarize and replace the transcript to free up context"},
{Name: "/study", Desc: "read every file in the current directory so the agent has full project context"},
{Name: "/btw", Desc: "side-chat that doesn't add to the main thread (saves tokens)"},
{Name: "/jail", Desc: "confine tools to the current directory"},
{Name: "/skills", Desc: "list discovered skills (SKILL.md files)"},