Turn Opencode into a Persistent Research Assistant with Simple Agent Setup
This guide shows how to extend the open‑source Opencode LLM coding tool with a custom agent and folder structure so it can store topic summaries, retain memory across sessions, and serve as a powerful terminal‑based research assistant.
Background
Opencode is an open‑source LLM coding assistant that can be repurposed as a research assistant by adding a custom agent and a lightweight folder layout.
Problems
The built‑in agents focus on coding or planning and do not support exploratory research conversations.
Opencode does not retain conversation history by default, making it difficult to revisit earlier discussions.
A Simple Solution
By creating a dedicated research folder, adding a custom agent definition, and maintaining an index file, you can give Opencode persistent memory and a way to store markdown summaries of each topic.
Create a new folder to hold all future research‑related Opencode projects.
Inside the folder, add an .opencode/agents directory and place an agent file whose instruction is to act as a useful research assistant, writing a markdown summary for each discussion and updating Agent.md.
In the root of the folder, add an Agent.md file that links to a knowledge.md index, serving as a central table of contents.
Example Agent Files
research_assistant.md
---
description: Conversational knowledge base agent that creates and maintains topic files with notes, decisions, and context
mode: primary
tools:
websearch: true
---
You are a conversational workspace agent. This workspace is not a traditional codebase — it serves as a persistent knowledge base built through conversation.
## Your Role
- When discussing a specific topic, solution, or project, create a dedicated `.md` file in the workspace root with detailed notes, decisions, and context.
- Keep each topic file well‑structured with clear headings, summaries, and actionable details.
- Update existing topic files as conversations evolve, preserving history and adding new insights.
- Maintain the `Agent.md` file as a central index. Whenever you create or significantly update a topic file, update the projects/topics table in `Agent.md` with a link and short summary.
## Web Research
- When a topic requires up‑to‑date information, use the `websearch` tool and incorporate findings into the topic file, citing sources.
- Use `webfetch` to retrieve full content from URLs discovered through search.
## Guidelines
- Write in clear, concise language.
- Structure notes for future reference across sessions.
- Append to existing files instead of creating duplicates.
- Read an existing topic file first to maintain continuity.
- Use the projects/topics table in `Agent.md` as the single source of truth.
Agent.md
# Agent Workspace
This directory is a workspace for interacting with OpenCode as a conversational agent. It is not a traditional codebase — it serves as a persistent knowledge base built through conversation.
## How It Works
- When we discuss a specific topic, solution, or project, I create a dedicated `.md` file with detailed notes, decisions, and context.
- Each file is linked in the table below with a short summary.
- Files are created and updated as conversations evolve, keeping context accessible across sessions.
## Projects / Topics
| File | Summary |
|------|---------|
| [shadcn-ui-evaluation.md](shadcn-ui-evaluation.md) | Evaluation of shadcn/ui: fit with Tailwind projects, copy‑paste model trade‑offs, and licensing details with sources. |
| [ai-agent-platform-research.md](ai-agent-platform-research.md) | Research for building a Claude Cowork alternative: name conflicts ("OpenWork" is taken), tech stack options (Python ✅), agent frameworks (LangGraph vs CrewAI), and recommended architecture. |Result
With this configuration Opencode not only excels at code generation but also acts as a persistent research assistant, enabling efficient information gathering and knowledge management directly from the terminal.
Code Mala Tang
Read source code together, write articles together, and enjoy spicy hot pot together.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
