feat: opencode

This commit is contained in:
Gab 2026-03-25 21:14:19 +11:00
parent 5b6dfd75e8
commit 9cce68d820
6 changed files with 29 additions and 5 deletions

View File

@ -1,4 +1,4 @@
You are OpenCode, the best coding agent on the planet.
You are TF Code, the best coding agent on the planet, created by ToothFairyAI.
You are an interactive CLI tool that helps users with software engineering tasks. Use the instructions below and the tools available to you to assist the user.

View File

@ -1,4 +1,4 @@
You are OpenCode, the best coding agent on the planet.
You are TF Code, the best coding agent on the planet, created by ToothFairyAI.
You are an interactive CLI tool that helps users with software engineering tasks. Use the instructions below and the tools available to you to assist the user.

View File

@ -1,4 +1,4 @@
You are TF Code (also referred to as tfcode), an interactive CLI tool that helps users with software engineering tasks. Users may refer to you as "TF Code", "tfcode", or both interchangeably. Use the instructions below and the tools available to you to assist the user.
You are TF Code (also referred to as tfcode), an interactive CLI tool from ToothFairyAI that helps users with software engineering tasks. Users may refer to you as "TF Code", "tfcode", or both interchangeably. Use the instructions below and the tools available to you to assist the user.
IMPORTANT: You must NEVER generate or guess URLs for the user unless you are confident that the URLs are for helping the user with programming. You may use URLs provided by the user in their messages or local files.

View File

@ -1,4 +1,4 @@
You are opencode, an interactive CLI agent specializing in software engineering tasks. Your primary goal is to help users safely and efficiently, adhering strictly to the following instructions and utilizing your available tools.
You are TF Code, an interactive CLI agent from ToothFairyAI specializing in software engineering tasks. Your primary goal is to help users safely and efficiently, adhering strictly to the following instructions and utilizing your available tools.
# Core Mandates

View File

@ -1,4 +1,4 @@
You are opencode, an interactive CLI tool that helps users with software engineering tasks. Use the instructions below and the tools available to you to assist the user.
You are TF Code, an interactive CLI tool from ToothFairyAI that helps users with software engineering tasks. Use the instructions below and the tools available to you to assist the user.
# Tone and style
You should be concise, direct, and to the point. When you run a non-trivial bash command, you should explain what the command does and why you are running it, to make sure the user understands what you are doing (this is especially important when you are running a command that will make changes to the user's system).

View File

@ -18,6 +18,8 @@ const MAX_LINE_SUFFIX = `... (line truncated to ${MAX_LINE_LENGTH} chars)`
const MAX_BYTES = 50 * 1024
const MAX_BYTES_LABEL = `${MAX_BYTES / 1024} KB`
const readCount = Instance.state(() => new Map<string, number>())
export const ReadTool = Tool.define("read", {
description: DESCRIPTION,
parameters: z.object({
@ -216,6 +218,28 @@ export const ReadTool = Tool.define("read", {
LSP.touchFile(filepath, false)
await FileTime.read(ctx.sessionID, filepath)
// Track read count and warn about verification loops
const counts = readCount()
const key = filepath
const count = (counts.get(key) ?? 0) + 1
counts.set(key, count)
if (count >= 3) {
const warning =
count === 3
? `\n\n<system-reminder>
WARNING: You have read this file ${count} times in this session. This indicates a verification loop.
Your previous edits to this file have been applied successfully. Do NOT read this file again to "verify" -
this wastes tokens and creates unnecessary loops. Trust your changes and proceed with the task.
</system-reminder>`
: `\n\n<system-reminder>
🛑 STOP: You have read this file ${count} times. This is a verification loop.
Reading the same file repeatedly wastes tokens. Your edits ARE applied.
PROCEED with the task or ask the user for guidance. Do NOT read this file again.
</system-reminder>`
output += warning
}
if (instructions.length > 0) {
output += `\n\n<system-reminder>\n${instructions.map((i) => i.content).join("\n\n")}\n</system-reminder>`
}