mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-03-30 05:43:55 +00:00
feat: opencode
This commit is contained in:
parent
5b6dfd75e8
commit
9cce68d820
@ -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.
|
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.
|
||||||
|
|
||||||
|
|||||||
@ -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.
|
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.
|
||||||
|
|
||||||
|
|||||||
@ -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.
|
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.
|
||||||
|
|
||||||
|
|||||||
@ -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
|
# Core Mandates
|
||||||
|
|
||||||
|
|||||||
@ -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
|
# 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).
|
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).
|
||||||
|
|||||||
@ -18,6 +18,8 @@ const MAX_LINE_SUFFIX = `... (line truncated to ${MAX_LINE_LENGTH} chars)`
|
|||||||
const MAX_BYTES = 50 * 1024
|
const MAX_BYTES = 50 * 1024
|
||||||
const MAX_BYTES_LABEL = `${MAX_BYTES / 1024} KB`
|
const MAX_BYTES_LABEL = `${MAX_BYTES / 1024} KB`
|
||||||
|
|
||||||
|
const readCount = Instance.state(() => new Map<string, number>())
|
||||||
|
|
||||||
export const ReadTool = Tool.define("read", {
|
export const ReadTool = Tool.define("read", {
|
||||||
description: DESCRIPTION,
|
description: DESCRIPTION,
|
||||||
parameters: z.object({
|
parameters: z.object({
|
||||||
@ -216,6 +218,28 @@ export const ReadTool = Tool.define("read", {
|
|||||||
LSP.touchFile(filepath, false)
|
LSP.touchFile(filepath, false)
|
||||||
await FileTime.read(ctx.sessionID, filepath)
|
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) {
|
if (instructions.length > 0) {
|
||||||
output += `\n\n<system-reminder>\n${instructions.map((i) => i.content).join("\n\n")}\n</system-reminder>`
|
output += `\n\n<system-reminder>\n${instructions.map((i) => i.content).join("\n\n")}\n</system-reminder>`
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user