Cookbook

This section contains practical recipes showing how to combine Lectic’s primitives to build useful workflows. Each recipe is self-contained and can be adapted to your needs.

The recipes assume you have Lectic installed and have worked through Getting Started. Familiarity with tools and hooks will help with the more advanced recipes, but the simpler ones explain everything as they go.

Getting Started

If you’re new to Lectic, start with these:

  • Coding Assistant — Give your LLM shell access, type checking, and linting. Includes a confirmation dialog so you approve tool calls before they run.

  • Git Commit Messages — A lectic commit subcommand that generates conventional commit messages from your staged changes. A good example of building small, focused tools.

Multi-Agent Workflows

  • Research with Multiple Perspectives — Define multiple interlocutors with different personalities (researcher, critic, synthesizer) and use :ask and :aside to get different viewpoints on a problem.

State and Memory

  • Conversation Memory — Two approaches to persistence: automatically recording everything to SQLite, or giving the LLM an explicit “remember” tool. An advanced recipe that shows the power of hooks.

  • Context Compaction — Automatically summarize and reset context when token usage gets high. Useful for long-running conversations that would otherwise hit context limits.

Security and Isolation

  • Custom Sandboxing — Isolate tool execution using wrapper scripts. Covers logging, Bubblewrap isolation, and stateful “shadow workspaces.” Essential reading if you’re giving LLMs write access to your system.

Advanced Techniques

  • Control Flow with Macros — Implement loops, conditionals, and map operations using recursive macros. This is power-user territory—most workflows don’t need this, but it shows what’s possible.

  • Agent Skills Support — Build a subcommand that exposes the Agent Skills format, letting your LLM load capabilities on demand through progressive disclosure.

  • Structured Outputs — Constrain the assistant to a JSON schema so results are reliably machine-readable. Includes a fun “quest cards” example you can pipe through jq.