octocode-cli 1.3.1 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +129 -28
- package/out/chunks/chunk-7476PETK.js +309 -0
- package/out/chunks/chunk-CVNNNSMQ.js +26 -0
- package/out/chunks/chunk-OQBJTZWK.js +60 -0
- package/out/chunks/chunk-UCZCF3BQ.js +9 -0
- package/out/chunks/command-help-specs-JZXVSLZ5.js +8 -0
- package/out/chunks/commands-XBFPLHSQ.js +8 -0
- package/out/chunks/help-P7TCOYAJ.js +10 -0
- package/out/chunks/main-help-ULF5PAQY.js +10 -0
- package/out/chunks/prompts-5E6VKRX5.js +8 -0
- package/out/chunks/spinner-URV2OX6O.js +8 -0
- package/out/chunks/tool-command-M6VA7P2F.js +8 -0
- package/out/octocode-cli.js +1 -1
- package/package.json +5 -3
- package/skills/README.md +13 -1
- package/skills/agentic-flow-best-practices/SKILL.md +280 -0
- package/skills/agentic-flow-best-practices/references/agent-collaboration-patterns.md +75 -0
- package/skills/agentic-flow-best-practices/references/pr-review-agent-example.md +47 -0
- package/skills/agentic-flow-best-practices/references/resources.md +112 -0
- package/skills/octocode-chrome-devtools/README.md +541 -0
- package/skills/octocode-chrome-devtools/SKILL.md +197 -0
- package/skills/octocode-chrome-devtools/agents/openai.yaml +7 -0
- package/skills/octocode-chrome-devtools/references/CDP_AGENT_REFERENCE.md +401 -0
- package/skills/octocode-chrome-devtools/references/CHROME_FLAGS.md +234 -0
- package/skills/octocode-chrome-devtools/references/INTENTS.md +108 -0
- package/skills/octocode-chrome-devtools/references/INTENTS_AUTH.md +179 -0
- package/skills/octocode-chrome-devtools/references/INTENTS_AUTOMATION.md +214 -0
- package/skills/octocode-chrome-devtools/references/INTENTS_DEBUG.md +329 -0
- package/skills/octocode-chrome-devtools/references/INTENTS_ENVIRONMENT.md +237 -0
- package/skills/octocode-chrome-devtools/references/INTENTS_INSPECT.md +263 -0
- package/skills/octocode-chrome-devtools/references/INTENTS_STORAGE_CONSENT.md +214 -0
- package/skills/octocode-chrome-devtools/references/RECOVERY.md +39 -0
- package/skills/octocode-chrome-devtools/references/SCRIPT_PATTERNS.md +43 -0
- package/skills/octocode-chrome-devtools/references/SCRIPT_PATTERNS_ASYNC_WORKERS.md +345 -0
- package/skills/octocode-chrome-devtools/references/SCRIPT_PATTERNS_BROWSER.md +403 -0
- package/skills/octocode-chrome-devtools/references/SCRIPT_PATTERNS_OBSERVE.md +275 -0
- package/skills/octocode-chrome-devtools/references/SCRIPT_PATTERNS_SPECIAL.md +18 -0
- package/skills/octocode-chrome-devtools/scripts/cdp-runner.mjs +503 -0
- package/skills/octocode-chrome-devtools/scripts/cdp-sandbox.mjs +123 -0
- package/skills/octocode-chrome-devtools/scripts/cdp-template.mjs +81 -0
- package/skills/octocode-chrome-devtools/scripts/octocode-chrome-devtools.vpn.example.json +8 -0
- package/skills/octocode-chrome-devtools/scripts/open-browser.mjs +362 -0
- package/skills/octocode-chrome-devtools/scripts/sourcemap-resolver.mjs +193 -0
- package/skills/octocode-chrome-devtools/scripts/undercover.mjs +226 -0
- package/skills/octocode-design/README.md +2 -2
- package/skills/octocode-documentation-writer/README.md +1 -1
- package/skills/octocode-engineer/README.md +1 -1
- package/skills/octocode-engineer/SKILL.md +4 -2
- package/skills/octocode-engineer/references/output-files.md +3 -3
- package/skills/octocode-engineer/scripts/run.js +136 -136
- package/skills/octocode-engineer/src/reporting/summary-md.test.ts +48 -0
- package/skills/octocode-engineer/src/reporting/summary-md.ts +43 -2
- package/skills/octocode-install/SKILL.md +1 -1
- package/skills/octocode-pull-request-reviewer/README.md +5 -5
- package/skills/octocode-pull-request-reviewer/SKILL.md +1 -1
- package/skills/octocode-research/AGENTS.md +1 -1
- package/skills/octocode-research/README.md +2 -2
- package/skills/octocode-research/docs/ARCHITECTURE.md +1 -1
- package/skills/octocode-research/scripts/server.js +191 -246
- package/skills/octocode-research/src/routes/github.ts +4 -21
- package/skills/octocode-research/src/routes/local.ts +4 -21
- package/skills/octocode-research/src/utils/fileContentTransform.ts +44 -0
- package/skills/octocode-search-skill/SKILL.md +245 -229
- package/skills/octocode-search-skill/references/agent-skills-guide.md +177 -0
- package/skills/octocode-search-skill/references/discovery-surfaces.md +162 -0
- package/skills/octocode-search-skill/references/fetch-and-create-locally.md +57 -0
- package/skills/octocode-search-skill/references/install-reference.md +130 -0
- package/skills/octocode-search-skill/references/references-template.md +27 -0
- package/skills/octocode-search-skill/references/references.md +62 -0
- package/skills/octocode-slides/README.md +307 -0
- package/skills/octocode-slides/SKILL.md +410 -0
- package/skills/octocode-slides/references/01-brief.md +156 -0
- package/skills/octocode-slides/references/02-research.md +149 -0
- package/skills/octocode-slides/references/03-outline.md +172 -0
- package/skills/octocode-slides/references/04-design.md +301 -0
- package/skills/octocode-slides/references/05-implementation.md +213 -0
- package/skills/octocode-slides/references/06-review.md +258 -0
- package/skills/octocode-slides/references/animation.md +281 -0
- package/skills/octocode-slides/references/design-system.md +316 -0
- package/skills/octocode-slides/references/html-templates.md +673 -0
- package/skills/octocode-slides/references/image-generation.md +448 -0
- package/skills/octocode-slides/references/resources.md +840 -0
- package/skills/octocode-slides/references/slide-rules.md +541 -0
- package/skills/octocode-slides/references/wireframes.md +727 -0
- package/skills/octocode-slides/scripts/animation.js +182 -0
- package/skills/octocode-slides/scripts/base.css +353 -0
- package/skills/octocode-slides/scripts/base.html +655 -0
- package/skills/octocode-slides/scripts/generate_image.py +221 -0
- package/skills/octocode-slides/scripts/navbridge.js +79 -0
- package/skills/octocode-slides/scripts/presenter.js +316 -0
- package/skills/octocode-slides/scripts/slide.html +248 -0
- package/skills/octocode-stats/SKILL.md +73 -0
- package/skills/octocode-stats/assets/template.html +1332 -0
- package/skills/octocode-stats/scripts/build_dashboard.mjs +407 -0
- package/out/chunks/chunk-QCY7Q7YW.js +0 -389
- package/out/chunks/command-help-specs-CQ3RBLP6.js +0 -8
- package/out/chunks/commands-OCTZP2TO.js +0 -51
- package/out/chunks/help-XPXP46ZT.js +0 -10
- package/out/chunks/main-help-35HX2UDQ.js +0 -10
- package/out/chunks/tool-command-HOSMVLNK.js +0 -8
- package/skills/octocode-search-skill/INSTALL_REFERENCE.md +0 -112
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __createRequire } from 'module';
|
|
3
|
+
import { fileURLToPath as __fileURLToPath } from 'url';
|
|
4
|
+
import { dirname as __dirname_fn } from 'path';
|
|
5
|
+
const require = __createRequire(import.meta.url);
|
|
6
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
7
|
+
const __dirname = __dirname_fn(__filename);
|
|
8
|
+
import{a as r}from"./chunk-V64AXUWB.js";var i=new Set;function e(){process.stdout.write("\x1B[?25h")}var o=!1;function l(){o||(o=!0,process.on("exit",e),process.on("SIGINT",()=>{e(),process.exit(0)}),process.on("SIGTERM",()=>{e(),process.exit(0)}),process.on("uncaughtException",n=>{e(),console.error("Uncaught exception:",n),process.exit(1)}))}var h=class{text;frames;i;timer;constructor(t=""){this.text=t,this.frames=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],this.i=0,this.timer=null}start(t,s=0){t&&(this.text=t),this.timer&&(clearInterval(this.timer),this.timer=null),l(),i.add(this),process.stdout.write("\x1B[?25l");let u=" ".repeat(s);return this.timer=setInterval(()=>{let c=this.frames[this.i++%this.frames.length];process.stdout.write(`\r${u}${r("cyan",c)} ${this.text}`)},80),this}clear(){return this.timer&&(clearInterval(this.timer),this.timer=null),i.delete(this),process.stdout.write("\r\x1B[2K"),process.stdout.write("\x1B[?25h"),this}stop(t="\u2713",s="green"){return this.timer&&(clearInterval(this.timer),this.timer=null),i.delete(this),process.stdout.write(`\r\x1B[2K${r(s,t)} ${this.text}
|
|
9
|
+
`),process.stdout.write("\x1B[?25h"),this}succeed(t){return t&&(this.text=t),this.stop("\u2713","green")}fail(t){return t&&(this.text=t),this.stop("\u2717","red")}info(t){return t&&(this.text=t),this.stop("\u2139","blue")}warn(t){return t&&(this.text=t),this.stop("\u26A0","yellow")}update(t){return this.text=t,this}};export{h as a};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __createRequire } from 'module';
|
|
3
|
+
import { fileURLToPath as __fileURLToPath } from 'url';
|
|
4
|
+
import { dirname as __dirname_fn } from 'path';
|
|
5
|
+
const require = __createRequire(import.meta.url);
|
|
6
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
7
|
+
const __dirname = __dirname_fn(__filename);
|
|
8
|
+
import{k as o}from"./chunk-OQBJTZWK.js";import"./chunk-UCZCF3BQ.js";import"./chunk-CVNNNSMQ.js";import"./chunk-7476PETK.js";import"./chunk-V64AXUWB.js";import"./chunk-YBBF4DTY.js";function C(n){let m=o(n);return m?e(m):void 0}function e(n){let{handler:m,...d}=n;return d}export{C as findStaticCommandHelp};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __createRequire } from 'module';
|
|
3
|
+
import { fileURLToPath as __fileURLToPath } from 'url';
|
|
4
|
+
import { dirname as __dirname_fn } from 'path';
|
|
5
|
+
const require = __createRequire(import.meta.url);
|
|
6
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
7
|
+
const __dirname = __dirname_fn(__filename);
|
|
8
|
+
import{a,b,c,d,e,f,g,h,i,j,k}from"./chunk-OQBJTZWK.js";import"./chunk-UCZCF3BQ.js";import"./chunk-CVNNNSMQ.js";import"./chunk-7476PETK.js";import"./chunk-V64AXUWB.js";import"./chunk-YBBF4DTY.js";export{e as authCommand,h as cacheCommand,k as findCommand,a as installCommand,c as loginCommand,d as logoutCommand,g as mcpCommand,f as skillsCommand,i as statusCommand,j as syncCommand,b as tokenCommand};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __createRequire } from 'module';
|
|
3
|
+
import { fileURLToPath as __fileURLToPath } from 'url';
|
|
4
|
+
import { dirname as __dirname_fn } from 'path';
|
|
5
|
+
const require = __createRequire(import.meta.url);
|
|
6
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
7
|
+
const __dirname = __dirname_fn(__filename);
|
|
8
|
+
import{a as n,b as e,c as p}from"./chunk-V64AXUWB.js";import"./chunk-YBBF4DTY.js";function r(t){let o=["",` ${n("magenta",e("\u{1F50D}\u{1F419} octocode "+t.name))}`,"",` ${t.description}`,""];if(t.usage&&(o.push(` ${e("USAGE")}`),o.push(` ${t.usage}`),o.push("")),t.options&&t.options.length>0){o.push(` ${e("OPTIONS")}`);for(let s of t.options){let i=s.short?`-${s.short}, `:" ",u=`--${s.name}`,a=s.hasValue?" <value>":"",l=s.default!==void 0?p(` (default: ${s.default})`):"";o.push(` ${n("cyan",i+u+a)}${l}`),o.push(` ${s.description}`)}o.push("")}process.stdout.write(`${o.join(`
|
|
9
|
+
`)}
|
|
10
|
+
`)}export{r as showCommandHelp};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __createRequire } from 'module';
|
|
3
|
+
import { fileURLToPath as __fileURLToPath } from 'url';
|
|
4
|
+
import { dirname as __dirname_fn } from 'path';
|
|
5
|
+
const require = __createRequire(import.meta.url);
|
|
6
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
7
|
+
const __dirname = __dirname_fn(__filename);
|
|
8
|
+
import{a as i,b as l,d as r}from"./chunk-7476PETK.js";import{a as o,b as e,c as t}from"./chunk-V64AXUWB.js";import"./chunk-YBBF4DTY.js";function $(){let n=[];for(let c of i){let a=l.filter(s=>r(s.name)===c);if(a.length!==0){n.push(` ${t(c)}`);for(let s of a)n.push(` ${o("cyan",s.name)}`)}}return n}function d(){let n=$(),c=l.length,a=["",` ${o("magenta",e("\u{1F50D}\u{1F419} Octocode CLI"))}`,"",` ${e("USAGE")}`,` ${o("magenta","octocode")} <command> [options] ${t("manage Octocode")}`,` ${o("magenta","octocode")} tools ${t("list all tools")}`,` ${o("magenta","octocode")} tools <name> ${t("show input schema")}`,` ${o("magenta","octocode")} tools <n1> <n2> ... ${t("batch input schemas")}`,` ${o("magenta","octocode")} tools <name> --queries '<json>' ${t("run a tool")}`,` ${o("magenta","octocode")} instructions ${t("MCP instructions + all schemas")}`,"",` ${e("COMMANDS")} ${t("(manage Octocode configuration)")}`,` ${o("magenta","install")} Configure octocode-mcp for an IDE`,` ${o("magenta","auth")} Manage GitHub authentication`,` ${o("magenta","login / logout")} Sign in or out of GitHub`,` ${o("magenta","status / token")} Show auth status or print token`,` ${o("magenta","skills")} Install/remove bundled Octocode skills`,` ${o("magenta","mcp")} Manage MCP marketplace`,` ${o("magenta","sync")} Sync MCP configs across IDEs`,` ${o("magenta","cache")} Inspect and clean Octocode cache`,"",` ${e("TOOLS")} ${t(`(${c} tools \u2014 run directly from terminal)`)}`,...n,"",` ${e("OPTIONS")}`,` ${o("cyan","--json")} Raw JSON output`,` ${o("cyan","-h, --help")} Show this help`,` ${o("cyan","-v, --version")} Show version`,"",` ${e("EXAMPLES")}`,` ${o("yellow","octocode tools")} ${t("# list")}`,` ${o("yellow","octocode tools localSearchCode")} ${t("# schema")}`,` ${o("yellow","octocode tools localSearchCode githubSearchCode")} ${t("# batch schemas")}`,` ${o("yellow",`octocode tools localSearchCode --queries '{"path":".","pattern":"fn"}'`)} ${t("# run")}`,` ${o("yellow","octocode instructions")} ${t("# full context")}`,"",` ${o("yellow","octocode install --ide cursor")}`,` ${o("yellow","octocode skills install --targets claude-code,cursor")}`,"",o("magenta",` \u2500\u2500\u2500 \u{1F50D}\u{1F419} ${e("https://octocode.ai")} \u2500\u2500\u2500`),""];process.stdout.write(`${a.join(`
|
|
9
|
+
`)}
|
|
10
|
+
`)}export{d as showHelp};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __createRequire } from 'module';
|
|
3
|
+
import { fileURLToPath as __fileURLToPath } from 'url';
|
|
4
|
+
import { dirname as __dirname_fn } from 'path';
|
|
5
|
+
const require = __createRequire(import.meta.url);
|
|
6
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
7
|
+
const __dirname = __dirname_fn(__filename);
|
|
8
|
+
import{a,b,c,d,e,f,g,h,i}from"./chunk-CVNNNSMQ.js";import"./chunk-YBBF4DTY.js";export{f as Separator,d as checkbox,b as confirm,c as input,h as isInquirerLoaded,g as loadInquirer,e as search,a as select,i as selectWithCancel};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __createRequire } from 'module';
|
|
3
|
+
import { fileURLToPath as __fileURLToPath } from 'url';
|
|
4
|
+
import { dirname as __dirname_fn } from 'path';
|
|
5
|
+
const require = __createRequire(import.meta.url);
|
|
6
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
7
|
+
const __dirname = __dirname_fn(__filename);
|
|
8
|
+
import{a}from"./chunk-UCZCF3BQ.js";import"./chunk-V64AXUWB.js";import"./chunk-YBBF4DTY.js";export{a as Spinner};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __createRequire } from 'module';
|
|
3
|
+
import { fileURLToPath as __fileURLToPath } from 'url';
|
|
4
|
+
import { dirname as __dirname_fn } from 'path';
|
|
5
|
+
const require = __createRequire(import.meta.url);
|
|
6
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
7
|
+
const __dirname = __dirname_fn(__filename);
|
|
8
|
+
import{a,b,c,d,e,f,g,h,i,j,k,l}from"./chunk-7476PETK.js";import"./chunk-V64AXUWB.js";import"./chunk-YBBF4DTY.js";export{a as TOOL_CATEGORIES,b as TOOL_DEFINITIONS,k as executeToolCommand,c as findToolDefinition,e as getDisplayFields,d as getToolCategory,i as getToolsContextString,j as printToolsContext,f as showAvailableTools,h as showMultipleToolSchemas,g as showToolHelp,l as toolCommand};
|
package/out/octocode-cli.js
CHANGED
|
@@ -5,4 +5,4 @@ import { dirname as __dirname_fn } from 'path';
|
|
|
5
5
|
const require = __createRequire(import.meta.url);
|
|
6
6
|
const __filename = __fileURLToPath(import.meta.url);
|
|
7
7
|
const __dirname = __dirname_fn(__filename);
|
|
8
|
-
import{c as
|
|
8
|
+
import{c as d}from"./chunks/chunk-V64AXUWB.js";import"./chunks/chunk-YBBF4DTY.js";var p=new Set(["ide","method","m","output","o","hostname","H","git-protocol","p","type","t","skill","k","local","limit","l","targets","mode","model","resume","r","id","client","c","search","category","env","config","tool","queries","input","responseCharLength","responseCharOffset","target","backup-path"]),S=new Set(["help","h","version","v","force","source","json","status","dry-run","installed","repos","skills","logs","all","tools","full","direct","lsp","api","list","schema","tools-context","check","rollback","install","yes","y","validate","sync"]),T=new Set(["output","responseCharLength","responseCharOffset","tool","queries"]);function h(t,o){return S.has(o)?!1:p.has(o)?!0:t.command==="tool"||typeof t.options.tool=="string"}function g(t=process.argv.slice(2)){let o={command:null,args:[],options:{}},e=0;for(;e<t.length;){let i=t[e];if(i.startsWith("--")){let[s,n]=i.slice(2).split("=");n!==void 0?o.options[s]=n:h(o,s)&&e+1<t.length&&!t[e+1].startsWith("-")?(o.options[s]=t[e+1],e++):o.options[s]=!0}else if(i.startsWith("-")&&!i.startsWith("--")&&i.length>2){let s=i.slice(1),[n,r]=s.split("=");if(T.has(n))r!==void 0?o.options[n]=r:h(o,n)&&e+1<t.length&&!t[e+1].startsWith("-")?(o.options[n]=t[e+1],e++):o.options[n]=!0;else{let a=s,c=a[a.length-1];if(a.length===1&&p.has(c)&&e+1<t.length&&!t[e+1].startsWith("-"))o.options[c]=t[e+1],e++;else for(let m of a)o.options[m]=!0}}else if(i.startsWith("-")&&i.length>1){let s=i.slice(1),n=s[s.length-1];if(s.length===1&&p.has(n)&&e+1<t.length&&!t[e+1].startsWith("-"))o.options[n]=t[e+1],e++;else for(let r of s)o.options[r]=!0}else o.command||typeof o.options.tool=="string"?o.args.push(i):o.command=i;e++}return!o.command&&typeof o.options.tool=="string"&&(o.command="tool",o.args=[o.options.tool,...o.args]),o}function w(t){return!!(t.options.help||t.options.h)}function C(t){return!!(t.options.version||t.options.v)}async function P(){return import("./chunks/commands-XBFPLHSQ.js")}async function H(){return import("./chunks/command-help-specs-JZXVSLZ5.js")}async function l(){return import("./chunks/tool-command-M6VA7P2F.js")}async function u(){return import("./chunks/main-help-ULF5PAQY.js")}async function _(){return import("./chunks/help-P7TCOYAJ.js")}function I(){console.log(),console.log(" Use octocode --tool <toolName> --queries '<json-stringified-input>'."),console.log(` Example: octocode --tool localSearchCode --queries '{"path":".","pattern":"runCLI"}'`),console.log()}function A(){console.log("octocode v1.5.0")}async function y(t){let o=g(t);if(o.options["tools-context"]===!0){let{printToolsContext:s}=await l();return await s(),!0}if(w(o)){if(o.command==="tool"&&typeof o.options.tool=="string"&&typeof o.args[0]=="string"){let{showToolHelp:n}=await l();if(await n(o.args[0]))return!0}if(o.command==="tool"){let{showHelp:n}=await u();return n(),!0}if(o.command==="tools"){if(typeof o.args[0]=="string"){let{showToolHelp:r}=await l();if(await r(o.args[0]))return!0}let{showAvailableTools:n}=await l();return await n(),!0}if(o.command){let[{findStaticCommandHelp:n},{showCommandHelp:r}]=await Promise.all([H(),_()]),a=n(o.command);if(a)return r(a),!0;let[{findCommand:c},{showHelp:m}]=await Promise.all([P(),u()]),f=c(o.command);return f?(r(f),!0):(m(),!0)}let{showHelp:s}=await u();return s(),!0}if(C(o))return A(),!0;if(!o.command)return!1;if(o.command==="tool")return typeof o.options.tool!="string"?(I(),process.exitCode=1,!0):(await(await l()).executeToolCommand(o)||(process.exitCode=1),!0);if(o.command==="tools"){let{executeToolCommand:s}=await l();return await s(o)||(process.exitCode=1),!0}if(o.command==="instructions"){let{printToolsContext:s}=await l();return await s(),!0}let{findCommand:e}=await P(),i=e(o.command);return i?(await i.handler(o),!0):(console.log(),console.log(` Unknown command: ${o.command}`),console.log(" Run 'octocode --help' to see available commands."),console.log(),process.exitCode=1,!0)}async function L(){let{showHelp:t}=await import("./chunks/main-help-ULF5PAQY.js");t()}async function N(){await y()||await L()}function x(){process.stdout.write("\x1B[?25h"),console.log(),console.log(d(" Goodbye! \u{1F44B}")),process.exit(0)}process.on("SIGINT",x);process.on("SIGTERM",x);N().catch(t=>{t?.name==="ExitPromptError"&&(console.log(),console.log(d(" Goodbye! \u{1F44B}")),process.exit(0)),console.error("Error:",t),process.exit(1)});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "octocode-cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"description": "Interactive CLI installer for octocode-mcp - Configure MCP servers for Cursor, Claude Desktop, and more",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai-coding",
|
|
@@ -27,7 +27,9 @@
|
|
|
27
27
|
"bugs": "https://github.com/bgauryy/octocode-mcp/issues",
|
|
28
28
|
"license": "MIT",
|
|
29
29
|
"type": "module",
|
|
30
|
-
"bin":
|
|
30
|
+
"bin": {
|
|
31
|
+
"octocode": "./out/octocode-cli.js"
|
|
32
|
+
},
|
|
31
33
|
"files": [
|
|
32
34
|
"out",
|
|
33
35
|
"skills",
|
|
@@ -66,7 +68,7 @@
|
|
|
66
68
|
"@vitest/coverage-v8": "^4.0.16",
|
|
67
69
|
"esbuild": "^0.27.2",
|
|
68
70
|
"eslint": "^9.18.0",
|
|
69
|
-
"octocode-mcp": "
|
|
71
|
+
"octocode-mcp": "^15.0.0",
|
|
70
72
|
"octocode-shared": "workspace:^",
|
|
71
73
|
"open": "^11.0.0",
|
|
72
74
|
"tsx": "^4.21.0",
|
package/skills/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# OctoCode Skills
|
|
2
2
|
|
|
3
|
-
Specialized AI agent skills extending OctoCode.
|
|
3
|
+
Specialized AI agent skills extending OctoCode. 19 skills live under `skills/`.
|
|
4
4
|
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -23,6 +23,9 @@ Specialized AI agent skills extending OctoCode. 15 skills live under `skills/`.
|
|
|
23
23
|
| **Doc Writer** | `octocode-documentation-writer/` | Produce comprehensive project documentation. |
|
|
24
24
|
| **News** | `octocode-news/` | Research recent AI, DevTools, web, and security updates. |
|
|
25
25
|
| **Search Skill** | `octocode-search-skill/` | Find, preview, and download agent skills. |
|
|
26
|
+
| **Chrome DevTools** | `octocode-chrome-devtools/` | Open Chrome via CDP, generate inspection scripts, trace errors to source. |
|
|
27
|
+
| **Agentic Flow Best Practices** | `agentic-flow-best-practices/` | Design agentic workflow patterns, agent collaboration, MCP/tool boundaries, context, memory scopes, caching, prompts, model settings, gates, and verification. |
|
|
28
|
+
| **Stats** | `octocode-stats/` | Render Octocode usage dashboards from local stats files. |
|
|
26
29
|
|
|
27
30
|
---
|
|
28
31
|
|
|
@@ -72,3 +75,12 @@ Scans recent AI, developer tooling, web platform, security, and notable-repo upd
|
|
|
72
75
|
|
|
73
76
|
### Search Skill
|
|
74
77
|
Searches GitHub for `SKILL.md` files, scores relevance, previews results, and downloads selected skill folders.
|
|
78
|
+
|
|
79
|
+
### Chrome DevTools
|
|
80
|
+
Opens Chrome with CDP WebSocket debugging, generates a custom inspection script per task, runs it live, and traces errors back to source code using Octocode local tools. Covers network, console, performance, DOM, CSS, screenshots, iframes, service workers, and any CDP domain. Includes script self-review, CDP error retry, and multi-target routing.
|
|
81
|
+
|
|
82
|
+
### Agentic Flow Best Practices
|
|
83
|
+
Designs practical agentic flows by choosing the simplest reliable pattern, shaping context packets, defining MCP/tool and skill boundaries, planning session/agent/shared memory scopes, tuning model configuration, and adding gates and verification where risk demands it.
|
|
84
|
+
|
|
85
|
+
### Stats
|
|
86
|
+
Renders an Octocode MCP usage dashboard from `${OCTOCODE_HOME}/stats.json` or `~/.octocode/stats.json`, including saved tokens/chars, cache hits, errors, and rate limits.
|
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: agentic-flow-best-practices
|
|
3
|
+
description: Use when the user asks to design, review, implement, debug, or evaluate an agentic workflow or AI-agent harness: MCP tools/resources/prompts, multi-agent routing or handoffs, agent memory/context/cache, Zod/JSON-schema protocols, human gates, observability, evals, or production safety. Do not use for ordinary app code, generic prompt writing, or model comparison unless an agentic flow boundary is involved.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Agentic Flow Best Practices
|
|
7
|
+
|
|
8
|
+
This skill is a compact thinking framework for agentic systems. It should help an agent choose the simplest reliable design, reason about the harness, and avoid wasting context.
|
|
9
|
+
|
|
10
|
+
## Reference Routing
|
|
11
|
+
|
|
12
|
+
Load references when they help the current decision:
|
|
13
|
+
|
|
14
|
+
- `references/resources.md`: research launchpad with official docs, GitHub/source repos, and search hints for MCP, agent frameworks, context, memory, caching, and long-context risks.
|
|
15
|
+
- `references/pr-review-agent-example.md`: compact build-ready workflow example.
|
|
16
|
+
- `references/agent-collaboration-patterns.md`: compact guide to flows between agents, roles, handoffs, agents-as-tools, routing, review, and shared workspaces.
|
|
17
|
+
|
|
18
|
+
When framework/protocol behavior matters, verify from official docs or source. Prefer project-local conventions first; use Octocode MCP tools when available. Carry evidence only when it changes the design.
|
|
19
|
+
|
|
20
|
+
## Operating Loop
|
|
21
|
+
|
|
22
|
+
Use this loop for substantial agentic-flow work:
|
|
23
|
+
|
|
24
|
+
1. Understand the user-visible outcome, non-goals, risk, and deployment surface.
|
|
25
|
+
2. Map what each model/agent sees and what each tool, memory, cache, or side effect can change.
|
|
26
|
+
3. Choose the smallest pattern that satisfies the outcome; name the rejected heavier option when useful.
|
|
27
|
+
4. Define protocols at boundaries: inputs, outputs, tools, handoffs, memory writes, gates, traces, and errors.
|
|
28
|
+
5. Design state, context, memory, cache, permissions, and ownership before adding agents.
|
|
29
|
+
6. Add gates, evals, observability, and rollout controls proportional to risk.
|
|
30
|
+
7. Output a compact design or review with assumptions, unknowns, and next verification steps.
|
|
31
|
+
|
|
32
|
+
Stop when the chosen pattern, contracts, gates, and verification plan are clear enough for the user's next decision. Ask one focused question only when a missing fact changes architecture, permissions, or side effects.
|
|
33
|
+
|
|
34
|
+
## Agentic Flow Brain
|
|
35
|
+
|
|
36
|
+
For any agentic flow, focus on the dimensions that affect the decision:
|
|
37
|
+
|
|
38
|
+
| Dimension | Question |
|
|
39
|
+
|---|---|
|
|
40
|
+
| Outcome | What user-visible job is done, and what is out of scope? |
|
|
41
|
+
| User experience | What should the user approve, see, interrupt, resume, or recover from? |
|
|
42
|
+
| Autonomy | Prompt, workflow, graph, tool-using agent, or multi-agent? |
|
|
43
|
+
| Runtime | Who owns the loop: code, protocol client, framework runtime, graph engine, or custom harness? |
|
|
44
|
+
| Tools/MCP | What tools/resources/prompts exist, who may call them, and what needs approval? |
|
|
45
|
+
| Identity | Which user, tenant, agent, service account, or policy grants each action? |
|
|
46
|
+
| Visible surface | What does each agent actually see: messages, instructions, MCP prompts/resources, tools, schemas, memory, retrieval, and examples? |
|
|
47
|
+
| Protocols | Which Zod schemas govern input, node output, tool result, handoff, memory, cache, gate, trace, and errors? |
|
|
48
|
+
| Context | What is static, retrieved, summarized, offloaded, isolated in subagents, or passed by artifact reference? |
|
|
49
|
+
| Memory | What is session state, checkpoint, agent-private, shared, user/project/org memory, artifact, or cache? |
|
|
50
|
+
| Data | What data can cross tenants, tools, models, logs, caches, memories, and artifacts? |
|
|
51
|
+
| Models | Which model class, reasoning effort, output budget, temperature, and fallback fit each node? |
|
|
52
|
+
| Safety | Where can the flow leak data, trust poisoned context, take irreversible action, or write bad memory? |
|
|
53
|
+
| Reliability | What retries, idempotency keys, timeouts, cancellation, and concurrency controls exist? |
|
|
54
|
+
| Observability | Can traces show route, schema version, model config, tool calls, cache decisions, errors, tokens, cost? |
|
|
55
|
+
| Evals | What golden, adversarial, schema, memory, and tool-failure tests prove behavior? |
|
|
56
|
+
| Rollout | How will versions, migrations, flags, canaries, and rollback work? |
|
|
57
|
+
|
|
58
|
+
Think first, then choose the smallest design that satisfies the outcome. The answer should feel like tradeoff reasoning, not a completed form.
|
|
59
|
+
|
|
60
|
+
## Pattern Choice
|
|
61
|
+
|
|
62
|
+
Start simple; add autonomy only when it solves a real constraint.
|
|
63
|
+
|
|
64
|
+
- Direct answer or augmented LLM: low-risk response, one model call, retrieval, tools, or memory.
|
|
65
|
+
- Deterministic pipeline or prompt chain: fixed parsing, transforms, validation, idempotency, and gated subtasks.
|
|
66
|
+
- Router/model router: known categories need distinct prompts, tools, or models.
|
|
67
|
+
- Parallel, map-reduce, or orchestrator-workers: independent facets, large inputs, speed, or runtime-discovered subtasks.
|
|
68
|
+
- Evaluator-optimizer or reviewer: clear criteria and independent quality/safety review help.
|
|
69
|
+
- Graph/state machine or autonomous loop: durable execution, checkpoints, resume, human gates, or `plan -> act -> observe -> update -> stop`.
|
|
70
|
+
- Agents as tools, handoff, supervisor, or blackboard: separation needs distinct context, tools, permissions, ownership, or shared artifacts.
|
|
71
|
+
- Background consolidation: memory, evals, or summaries can run after the user-facing response.
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
Framework fit is contextual, not a ranking: plain code for deterministic/small workflows; MCP for exposing tools/resources/prompts, not orchestration; SDKs or ADK-style runtimes when lifecycle, sessions, tools, tracing, and structured outputs are modeled; graph runtimes for durable state, persistence, human-in-loop, and long-running agents. Use names like OpenAI Agents SDK, Google ADK, LangChain, and LangGraph as examples to research, not required dependencies.
|
|
75
|
+
|
|
76
|
+
## Coverage Checks
|
|
77
|
+
|
|
78
|
+
Check these areas when they affect the decision:
|
|
79
|
+
|
|
80
|
+
- Product: user intent, interruption/resume, preview UX, explanation, and escalation path.
|
|
81
|
+
- Access: auth, tenant isolation, tool allowlists, service accounts, and audit trails.
|
|
82
|
+
- Data: PII/secrets handling, retention, redaction, training/logging policy, and cross-model sharing.
|
|
83
|
+
- Operations: deployment target, queueing, concurrency, cancellation, idempotency, rollback, and cost/latency budgets.
|
|
84
|
+
- Governance: human gates, policy checks, memory approval, provenance, and delete/export behavior.
|
|
85
|
+
- Evolution: prompt/schema/tool versioning, cache invalidation, migrations, eval drift, and compatibility.
|
|
86
|
+
|
|
87
|
+
## Nodes And State
|
|
88
|
+
|
|
89
|
+
Describe the flow as nodes, not transcript history. For important nodes, capture:
|
|
90
|
+
|
|
91
|
+
- `purpose`: why this node exists.
|
|
92
|
+
- `inputSchema` / `outputSchema`: Zod schemas or artifact contracts.
|
|
93
|
+
- `tools`: allowed tools and why.
|
|
94
|
+
- `state`: fields read/written and owner.
|
|
95
|
+
- `cache`: key, scope, freshness, invalidation, or `none`.
|
|
96
|
+
- `memory`: search/write/ignore plus consent and retention.
|
|
97
|
+
- `failure`: retry, ask, fallback, stop, or gate.
|
|
98
|
+
- `sideEffects`: files, APIs, messages, deploys, payments, memory writes.
|
|
99
|
+
- `runControl`: timeout, cancellation, resume, idempotency, and concurrency behavior.
|
|
100
|
+
|
|
101
|
+
Common nodes: `classify`, `retrieve`, `compute`, `reason`, `delegate`, `review`, `act`, `observe`.
|
|
102
|
+
|
|
103
|
+
## Zod Protocols
|
|
104
|
+
|
|
105
|
+
Agentic systems communicate through protocols. Agent-to-agent, node-to-node, agent-to-tool, cache, memory, gate, trace, and side-effect boundaries should have runtime-validated schemas. In TypeScript, use Zod as the source of truth; in other runtimes, use an equivalent schema library and keep JSON Schema interoperability.
|
|
106
|
+
|
|
107
|
+
Define the contracts that exist:
|
|
108
|
+
|
|
109
|
+
- `FlowInput`, `NodeInput`, `NodeOutput`
|
|
110
|
+
- `AgentTask`, `AgentResult`, `AgentHandoff`
|
|
111
|
+
- `ToolCall`, `ToolResult`, `ErrorEnvelope`
|
|
112
|
+
- `MemoryQuery`, `MemoryCandidate`, `MemoryWrite`
|
|
113
|
+
- `CacheEntry`, `HumanGate`, `TraceEvent`
|
|
114
|
+
- `PolicyDecision`, `RunControl`, `ArtifactRef`
|
|
115
|
+
|
|
116
|
+
Zod rules:
|
|
117
|
+
|
|
118
|
+
- Define Zod first; infer TypeScript types from schemas.
|
|
119
|
+
- `safeParse` runtime boundaries before trusting data.
|
|
120
|
+
- Generate JSON Schema from Zod/equivalent schemas for model/tool/MCP structured-output APIs.
|
|
121
|
+
- Version schemas with prompts, tools, cache, memory, and model changes.
|
|
122
|
+
- Use discriminated unions for routes, outcomes, and errors.
|
|
123
|
+
- Represent ambiguity explicitly: `unknown`, `not_found`, `not_allowed`, `redacted`.
|
|
124
|
+
- Keep schemas small and composable; avoid giant shared state blobs.
|
|
125
|
+
- Attach provenance to decision facts: source path/URL/tool id/trace id/timestamp.
|
|
126
|
+
|
|
127
|
+
Minimal packet shape: `AgentTask` should include `goal`, `inputs`, `knownFacts`, `constraints`, `allowedTools`, `expectedOutput`, and `stopConditions`. `AgentResult` should include `status`, `output`, `evidence`, `unknowns`, and `memoryCandidates`.
|
|
128
|
+
|
|
129
|
+
## Context Engineering
|
|
130
|
+
|
|
131
|
+
Attention is finite. Large context windows raise the ceiling but do not guarantee the model uses all tokens well; relevant facts buried in the middle can be missed. More context can lower signal-to-noise, duplicate facts, increase cost/latency, and create conflicting instructions.
|
|
132
|
+
|
|
133
|
+
Pass packets, not full history:
|
|
134
|
+
|
|
135
|
+
```text
|
|
136
|
+
goal, inputs, knownFacts, decisions, openQuestions, constraints,
|
|
137
|
+
artifacts, expectedOutput
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Before expanding context:
|
|
141
|
+
|
|
142
|
+
1. Reuse validated cache.
|
|
143
|
+
2. Retrieve the smallest relevant chunk.
|
|
144
|
+
3. Summarize with sources and omissions.
|
|
145
|
+
4. Ask if the missing fact changes architecture.
|
|
146
|
+
5. Pass broader context only when narrower context fails.
|
|
147
|
+
|
|
148
|
+
Token efficiency rules:
|
|
149
|
+
|
|
150
|
+
- Dedupe, rank, chunk, summarize, and retrieve on demand.
|
|
151
|
+
- Keep one source of truth per fact; pass the freshest cited version plus references.
|
|
152
|
+
- Prefer artifact paths, URLs, cache keys, trace ids over copied content.
|
|
153
|
+
- Keep stable instructions/examples before dynamic input for prompt caching; do not rewrite cacheable prefixes casually.
|
|
154
|
+
- Strip secrets, stale facts, speculation, and irrelevant history.
|
|
155
|
+
- Use context isolation: subagents inspect heavy artifacts and return compact Zod-valid results.
|
|
156
|
+
- Reserve output budget for visible answer and hidden reasoning tokens.
|
|
157
|
+
|
|
158
|
+
## Agent-Visible Surface
|
|
159
|
+
|
|
160
|
+
Review what each agent/model call actually receives, not only what the architecture diagram intends:
|
|
161
|
+
|
|
162
|
+
- Messages: system, developer, user, framework wrappers, skill text, node prompt.
|
|
163
|
+
- MCP surface: server instructions, tool names/descriptions, input schemas, output schemas, prompts, resources, and error text.
|
|
164
|
+
- Context surface: retrieved chunks, memory snippets, cache summaries, examples, prior decisions, artifacts, and hidden runtime facts exposed to the LLM.
|
|
165
|
+
- Action surface: allowed tools, approval gates, side effects, retries, and fallback instructions.
|
|
166
|
+
|
|
167
|
+
Check for duplicated or conflicting instructions across prompts, skills, MCP prompts, tool descriptions, schemas, memory, and retrieved docs. Keep one source of truth; place stable invariant instructions in the harness or stable prefix, and pass changing facts through compact task packets.
|
|
168
|
+
|
|
169
|
+
## Memory Scopes
|
|
170
|
+
|
|
171
|
+
Separate memory, state, cache, and artifacts.
|
|
172
|
+
|
|
173
|
+
- Runtime and LLM-visible context: clients/auth/request ids stay outside the model unless needed; task packets and retrieved chunks stay small and fresh.
|
|
174
|
+
- Working state, session state, and checkpoints: keep run/thread/resume data separate from durable facts.
|
|
175
|
+
- Agent-private, shared-flow, and user/project/org memory: define owner, scope, consent, retention, and conflict behavior.
|
|
176
|
+
- External knowledge, artifacts, and cache: cite retrieval, version artifacts, and key caches by tenant/scope/freshness without secrets.
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
Memory rules:
|
|
180
|
+
|
|
181
|
+
- Prefer working/session state until a fact proves it should persist.
|
|
182
|
+
- Long-term memory needs scope, owner, source, createdAt, retention, delete behavior, confidence.
|
|
183
|
+
- Read shared memory as evidence unless it is a trusted policy source.
|
|
184
|
+
- Prefer one writer per memory scope; workers propose `MemoryCandidate`s.
|
|
185
|
+
- Use append-only or conflict-aware shared memory when multiple agents write.
|
|
186
|
+
- Test should-remember and should-not-remember cases.
|
|
187
|
+
|
|
188
|
+
## MCP, Tools, And Skills
|
|
189
|
+
|
|
190
|
+
MCP exposes capabilities to AI apps:
|
|
191
|
+
|
|
192
|
+
- `tools`: actions such as search, file/API/db calls, comments, deploys.
|
|
193
|
+
- `resources`: context data such as files, schemas, tickets, logs.
|
|
194
|
+
- `prompts`: reusable templates or interaction starters.
|
|
195
|
+
|
|
196
|
+
Design tools like APIs: narrow names, clear docs, Zod/JSON schemas, example usage, error shapes, auth/retention notes, tool allowlists, and approval gates for destructive/costly/external actions.
|
|
197
|
+
|
|
198
|
+
Use skills for reusable procedural knowledge. Keep `SKILL.md` concise; move optional depth to references/scripts.
|
|
199
|
+
|
|
200
|
+
## Multi-Agent Flow
|
|
201
|
+
|
|
202
|
+
Use multiple agents when separation helps: expertise, tools, permissions, context windows, latency, review, or user-facing ownership. If specialists do not need separate tools/context, they may be prompt sections. For collaboration techniques, read `references/agent-collaboration-patterns.md`.
|
|
203
|
+
|
|
204
|
+
Handoff packet:
|
|
205
|
+
|
|
206
|
+
```text
|
|
207
|
+
goal, inputs, knownFacts, constraints, allowedTools,
|
|
208
|
+
expectedOutput, stopConditions
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
Common issues:
|
|
212
|
+
|
|
213
|
+
| Issue | Fix |
|
|
214
|
+
|---|---|
|
|
215
|
+
| vague ownership | one owner per state field/artifact |
|
|
216
|
+
| full-history handoff | handoff packet + artifact refs |
|
|
217
|
+
| supervisor bottleneck | workers decide locally inside bounds |
|
|
218
|
+
| tool bleed | per-agent tool allowlist |
|
|
219
|
+
| infinite delegation | max turns, budgets, terminal states |
|
|
220
|
+
| prose return | Zod-valid `AgentResult` |
|
|
221
|
+
| self-approval | separate reviewer/test/human gate |
|
|
222
|
+
| memory conflict | one memory writer or approval gate |
|
|
223
|
+
|
|
224
|
+
## Prompting And Models
|
|
225
|
+
|
|
226
|
+
Node prompts should define role, node goal, inputs, tool permissions, decision criteria, output schema, failure behavior, and evidence rules. Leave thinking room for ambiguous architecture, memory scope, tool choice, or tradeoffs; use firm instructions at schema/tool/memory/cache/side-effect boundaries.
|
|
227
|
+
|
|
228
|
+
Model/config checks:
|
|
229
|
+
|
|
230
|
+
- Smaller model: classification, extraction, formatting.
|
|
231
|
+
- Stronger reasoning model: planning, coding, tradeoffs, high-risk decisions.
|
|
232
|
+
- Long-context model: retrieval-heavy tasks, still curated.
|
|
233
|
+
- `max_output_tokens`: includes visible output and, for reasoning models, hidden reasoning.
|
|
234
|
+
- `reasoning effort`: more deliberation for harder decisions, more cost/latency.
|
|
235
|
+
- `temperature`: higher for ideation, lower for structured consistency.
|
|
236
|
+
- Trace model, prompt/schema version, tool version, cache decision, token use, latency, cost.
|
|
237
|
+
|
|
238
|
+
## Cache, Gates, Verification
|
|
239
|
+
|
|
240
|
+
Cache small validated results keyed by normalized input, prompt/model/tool/data versions, scope, and freshness. Cache safety invariant: no secrets, raw private data without policy, tenant-crossing data, or hidden unkeyed state. Memory and cache solve different problems.
|
|
241
|
+
|
|
242
|
+
Prompt-cache safety:
|
|
243
|
+
|
|
244
|
+
- Provider prompt caching depends on stable message/prefix/tool-schema bytes; changing system/developer messages, tool descriptions, schemas, MCP prompts, or prefix order can invalidate reuse or make cache assumptions unsafe.
|
|
245
|
+
- Keep cacheable instructions and examples stable, then append volatile user input, retrieval, memory, and runtime facts later.
|
|
246
|
+
- Include prompt version, model/config, tool description/schema version, MCP server/tool version, data source version, and tenant/scope in app cache keys.
|
|
247
|
+
- Do not cache LLM outputs when hidden inputs, retrieved context, or tool results that shaped the answer are missing from the key.
|
|
248
|
+
|
|
249
|
+
Consider gates before destructive/costly/external side effects, durable memory writes, cross-tenant cache risk, new auth/billing/deploy ownership, conflicting evidence, or vague prompts that trigger action.
|
|
250
|
+
|
|
251
|
+
Verification by risk:
|
|
252
|
+
|
|
253
|
+
- Sketch: chosen architecture, rejected alternative, biggest risk.
|
|
254
|
+
- Implementation: Zod tests, cache hit/miss/stale, golden path, tool permissions, gates.
|
|
255
|
+
- Production: evals, adversarial cases, traces, memory privacy, idempotency, retry, cost/latency budgets.
|
|
256
|
+
|
|
257
|
+
## Output Scheme
|
|
258
|
+
|
|
259
|
+
Use this as a flexible schema, not a required template. Select fields that help the user understand and build the flow.
|
|
260
|
+
|
|
261
|
+
Include the useful fields: `Goal`, `Decision`, `Runtime`, `Roles`, `Protocols`, `Context`, `Memory`, `Tools/MCP`, `Lifecycle`, `Models`, `Flow`, `Run control`, `Rollout`, and `Verification`.
|
|
262
|
+
|
|
263
|
+
## Recovery
|
|
264
|
+
|
|
265
|
+
- If requirements are broad, first return a sketch with assumptions and one decisive question.
|
|
266
|
+
- If framework behavior is uncertain, mark it unknown and verify against official docs/source before locking architecture.
|
|
267
|
+
- If tool, auth, tenant, or memory policy is unclear, gate side effects and design for least privilege.
|
|
268
|
+
- If context is too large, switch to retrieval, map-reduce, or subagent summaries with cited artifact refs.
|
|
269
|
+
- If eval criteria are missing, propose golden, adversarial, and tool-failure cases before implementation.
|
|
270
|
+
|
|
271
|
+
## Anti-Patterns
|
|
272
|
+
|
|
273
|
+
- Multi-agent before the core loop is proven.
|
|
274
|
+
- Full history where a compact packet works.
|
|
275
|
+
- Session state, memory, cache, and artifacts mixed together.
|
|
276
|
+
- Agent communication through prose instead of Zod protocols.
|
|
277
|
+
- Broad MCP/tools without auth, retention, validation, and gates.
|
|
278
|
+
- More context instead of better retrieval/dedupe/summarization.
|
|
279
|
+
- Larger model instead of fixing context, tools, schemas, or evals.
|
|
280
|
+
- A `reason` node deciding and executing risky action.
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# Agent Collaboration Patterns
|
|
2
|
+
|
|
3
|
+
Use this to reason about flows between agents, roles, ownership, and communication. Supervisor is one option; choose the collaboration shape that fits the work.
|
|
4
|
+
|
|
5
|
+
## Technique Map
|
|
6
|
+
|
|
7
|
+
| Technique | Shape | Use When | Watch For |
|
|
8
|
+
|---|---|---|---|
|
|
9
|
+
| Prompt roles | One agent, named internal roles | Separation is conceptual only | Fake multi-agent complexity |
|
|
10
|
+
| Router | `classify -> specialist/path` | Known categories map to tools/prompts/models | Overrouting ambiguous work |
|
|
11
|
+
| Agents as tools | Manager calls specialist and keeps control | Specialist returns artifact/result | Specialist leaking conversation control |
|
|
12
|
+
| Handoff | Agent transfers user-facing turn | Specialist should own next interaction | Full-history transfer, unclear return |
|
|
13
|
+
| Orchestrator-workers | Planner creates dynamic subtasks | Work is discovered at runtime | Weak task packets, duplicate work |
|
|
14
|
+
| Parallel specialists | Same/different facets run concurrently | Latency, coverage, independent evidence | Merge conflicts, inconsistent criteria |
|
|
15
|
+
| Reviewer/evaluator | Separate judge checks output | Quality/safety needs independent review | Self-approval |
|
|
16
|
+
| Debate/red-team | Advocate + critic + judge | High-stakes tradeoff or risk analysis | Performative disagreement |
|
|
17
|
+
| Blackboard | Agents read/write shared workspace | Coordination through artifacts/state | Concurrent writes, stale facts |
|
|
18
|
+
| Hierarchical team | Leads coordinate subteams | Large domain with nested ownership | Bottlenecks, hidden state |
|
|
19
|
+
| Human-gated team | Agent proposes, human approves | Trust, policy, cost, destructive action | Vague approval prompt |
|
|
20
|
+
| Background worker | Async consolidation/evals/memory | Work can happen after response | Hidden side effects |
|
|
21
|
+
|
|
22
|
+
Choose **agents-as-tools** when the manager should keep control and specialists return artifacts. Choose **handoff** when a specialist should own the next user-facing turn. Choose **blackboard/shared workspace** when agents coordinate through artifacts instead of direct conversation.
|
|
23
|
+
|
|
24
|
+
## Role Design
|
|
25
|
+
|
|
26
|
+
Define roles by responsibility, not titles:
|
|
27
|
+
|
|
28
|
+
- `owner`: one agent/node owns each state field and artifact.
|
|
29
|
+
- `planner`: decomposes work and assigns packets.
|
|
30
|
+
- `specialist`: performs bounded work with scoped tools/context.
|
|
31
|
+
- `reviewer`: checks output, evidence, risk, and schema.
|
|
32
|
+
- `memoryWriter`: approves durable memory writes.
|
|
33
|
+
- `actor`: performs side effects after gates.
|
|
34
|
+
- `observer`: traces, metrics, evals, cache/memory decisions.
|
|
35
|
+
|
|
36
|
+
Avoid roles that differ only by wording. If two roles share tools, context, and output type, they may be one role with a clearer prompt.
|
|
37
|
+
|
|
38
|
+
## Communication Protocol
|
|
39
|
+
|
|
40
|
+
Each agent boundary should use Zod-backed packets:
|
|
41
|
+
|
|
42
|
+
```text
|
|
43
|
+
AgentTask: goal, inputs, knownFacts, constraints, allowedTools,
|
|
44
|
+
expectedOutput, stopConditions
|
|
45
|
+
|
|
46
|
+
AgentResult: status, output, evidence, unknowns, actionNeeded,
|
|
47
|
+
memoryCandidates, traceId
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Pass artifact references over full history. Pass decisions separately from evidence. Let workers make local choices inside bounds; return to coordinator when scope, tool permission, confidence, or side effects exceed bounds.
|
|
51
|
+
|
|
52
|
+
## Common Failure Fixes
|
|
53
|
+
|
|
54
|
+
| Failure | Fix |
|
|
55
|
+
|---|---|
|
|
56
|
+
| duplicate work | disjoint ownership and task ids |
|
|
57
|
+
| context bloat | packet + artifact refs + input filters |
|
|
58
|
+
| tool bleed | per-agent allowlists |
|
|
59
|
+
| infinite delegation | max turns, budget, terminal states |
|
|
60
|
+
| prose result | Zod-valid `AgentResult` |
|
|
61
|
+
| weak merge | evidence ids and conflict surfacing |
|
|
62
|
+
| memory pollution | one approved memory writer |
|
|
63
|
+
| self-approval | reviewer, eval, or human gate |
|
|
64
|
+
|
|
65
|
+
## Output Mini-Scheme
|
|
66
|
+
|
|
67
|
+
```markdown
|
|
68
|
+
Roles: <role -> responsibility/tools/context>
|
|
69
|
+
Collaboration: <router | agents-as-tools | handoff | orchestrator-workers | blackboard | reviewer | hybrid>
|
|
70
|
+
Packets: <AgentTask/AgentResult/Zod schemas>
|
|
71
|
+
State: <owner per field/artifact>
|
|
72
|
+
Flow: <agent -> agent/tool/artifact>
|
|
73
|
+
Gates: <approval/memory/side-effect stops>
|
|
74
|
+
Failure controls: <loop limits, conflict policy, retries>
|
|
75
|
+
```
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Worked Example: PR Review Agent
|
|
2
|
+
|
|
3
|
+
Compact build-ready example.
|
|
4
|
+
|
|
5
|
+
```markdown
|
|
6
|
+
## Flow: PR Review Agent
|
|
7
|
+
|
|
8
|
+
Goal: Fetch a GitHub PR diff/context, produce schema-valid findings, and post only after approval.
|
|
9
|
+
Architecture: Checkpointed workflow/LangGraph. Route is known; durable state and gates matter. Avoid multi-agent until review core works.
|
|
10
|
+
|
|
11
|
+
State:
|
|
12
|
+
- `prRef`: input, owner/repo/number/headSha
|
|
13
|
+
- `diff`, `contextChunks`, `risk`: working state
|
|
14
|
+
- `findings`: artifact, Zod-valid review output
|
|
15
|
+
- `repoFacts`: memory candidates after approval
|
|
16
|
+
|
|
17
|
+
Protocols (Zod):
|
|
18
|
+
- `FlowInput`, `DiffPayload`, `ReviewFinding`, `ReviewOutput`
|
|
19
|
+
- `CacheEntry`, `MemoryCandidate`, `HumanGate`, `TraceEvent`, `ErrorEnvelope`
|
|
20
|
+
|
|
21
|
+
Context packet:
|
|
22
|
+
- goal, summarized diff when large, top relevant chunks, risk, repo instructions
|
|
23
|
+
- constraints: changed lines plus nearby context; no approve/merge/close/post
|
|
24
|
+
- expected output: `ReviewOutput`
|
|
25
|
+
- unknowns: missing files/symbols
|
|
26
|
+
|
|
27
|
+
Cache/memory:
|
|
28
|
+
- cache by `pr:{owner}/{repo}/{number}:{headSha}`, scope repo/workspace
|
|
29
|
+
- invalidate on new push or changed base
|
|
30
|
+
- never store raw private diffs as memory
|
|
31
|
+
- write approved conventions/facts only, with source and retention
|
|
32
|
+
|
|
33
|
+
Flow:
|
|
34
|
+
1. `classify`: PR ref -> task/risk; stop if invalid
|
|
35
|
+
2. `retrieve`: diff/context; cache by headSha; retry transient fetch
|
|
36
|
+
3. `reason`: context packet -> `ReviewOutput`; retry once on schema failure
|
|
37
|
+
4. `review`: preview findings; gate post/memory
|
|
38
|
+
5. `act`: post approved comment with idempotency key
|
|
39
|
+
6. `observe`: trace route, tools, cache, errors, memory candidates
|
|
40
|
+
|
|
41
|
+
Verify:
|
|
42
|
+
- Zod tests for protocols
|
|
43
|
+
- cache hit/miss/stale tests
|
|
44
|
+
- golden SQL injection PR -> high/block finding
|
|
45
|
+
- should-not-remember rejects raw diff/unapproved facts
|
|
46
|
+
- tool failure leaves no partial public comment
|
|
47
|
+
```
|