mirror of
https://github.com/Tencent/teamai-cli.git
synced 2026-10-02 03:14:40 +08:00
fix(recall): stop teamai-recall subagent from recursing in cursor (#553)
The recall rule body instructs the AI to "invoke the teamai-recall subagent". In tools like Cursor that leak always-apply rules into subagent sessions, the teamai-recall subagent itself reads this and spawns another teamai-recall subagent, looping until it hangs. Add a bilingual self-exemption block at the top of both the rule body (builtin-rules.ts) and the CLAUDE.md-injected block (pull.ts): if you ARE the teamai-recall subagent, the rule does not apply — proceed directly to the search instead of invoking recall again. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
d05b9d6b8f
commit
0280b91c21
@@ -122,6 +122,10 @@ export async function deployBuiltinRules(
|
||||
|
||||
const TEAMAI_RECALL_RULE_CONTENT = `# Team Knowledge Recall (teamai)
|
||||
|
||||
> **Self-exemption (must read first):** If you ARE the \`teamai-recall\` subagent yourself, this rule does NOT apply to you — do not invoke \`teamai-recall\` (or any recall) again. Proceed directly to performing the knowledge search that is your task. This prevents infinite subagent recursion in tools (e.g. Cursor) whose always-apply rules leak into subagent sessions.
|
||||
>
|
||||
> **自豁免(务必先读):** 如果你自己就是 \`teamai-recall\` subagent,本规则对你不适用——不要再调用 \`teamai-recall\`(或任何 recall),直接执行你本职的知识检索任务。此举防止在(如 Cursor 等)会把 always-apply 规则泄漏进 subagent 会话的工具中发生无限递归。
|
||||
|
||||
## 规则:任务开始前检索团队知识库(推荐)
|
||||
|
||||
**Before** starting a task that involves code changes, debugging,
|
||||
|
||||
@@ -1332,6 +1332,10 @@ export function compileRecallRulesBlock(): string {
|
||||
'',
|
||||
'## Team Knowledge Recall (teamai)',
|
||||
'',
|
||||
'> **Self-exemption (must read first):** If you ARE the `teamai-recall` subagent yourself, this rule does NOT apply to you — do not invoke `teamai-recall` (or any recall) again. Proceed directly to performing the knowledge search that is your task. This prevents infinite subagent recursion in tools (e.g. Cursor) whose always-apply rules leak into subagent sessions.',
|
||||
'>',
|
||||
'> **自豁免(务必先读):** 如果你自己就是 `teamai-recall` subagent,本规则对你不适用——不要再调用 `teamai-recall`(或任何 recall),直接执行你本职的知识检索任务。此举防止在(如 Cursor 等)会把 always-apply 规则泄漏进 subagent 会话的工具中发生无限递归。',
|
||||
'',
|
||||
'**Before** starting a task that involves code changes, debugging,',
|
||||
'or design decisions, you **SHOULD** invoke the `teamai-recall`',
|
||||
'subagent via the Agent tool with a concise natural-language',
|
||||
|
||||
Reference in New Issue
Block a user