knowit-benchai
v0.1.19
Published
BenchAI command line tool for publishing and cloning SOP document repositories.
Readme
knowit-benchai
BenchAI CLI publishes and clones team SOP document repositories.
Install
npm install -g knowit-benchaiThe installed command is:
benchai helpConfigure
Login with your BenchAI account. This creates a personal API key and saves it locally:
benchai login --email [email protected]Or use an email verification code:
benchai login --email [email protected] --otpUse --code 123456 or BENCHAI_OTP_CODE=123456 if the code was already sent.
The saved API key is used by BenchAI CLI commands and Git HTTP operations. For raw Git prompts, use your account email as the username and the API key as the password.
export BENCHAI_GIT_BASE_URL=http://47.241.223.57:8083
export BENCHAI_API_KEY=bai_xxxOr save the key once on this machine:
benchai key set --base-url http://47.241.223.57:8083 bai_xxx
benchai key showThe key is stored in ~/.benchai/config.json with file permission 600. Environment variables and command flags still override the saved value.
All SOP document commands require an API key, including list, clone, pull, publish, and update. benchai login is the recommended way to obtain and save that key.
Use
Publish any local folder as a BenchAI SOP document repository:
benchai publish ./my-experience-docs --name "团队经验文档" --description "团队可复用经验和标准"List available SOP document repositories:
benchai listThe list shows document code, name, and description. Use the code to clone or rename.
Clone one document by code:
benchai clone ABC123Pull latest changes for a cloned document repository and refresh UPDATE-RULE.md:
benchai pull .Rename one document by code:
benchai rename ABC123 --name "新的经验文档名称"Create a new API key from your BenchAI account and save it locally:
benchai key create --email [email protected] --password password123benchai key create saves the created token locally by default. Use --save=false if you only want to print it.
Publishing and cloning a SOP document repository both ensure UPDATE-RULE.md exists. Agents should read it, pull the latest docs before editing, and use:
benchai pull .Then update reusable experience with:
benchai update . --message "Update experience documents"when a user request produces reusable experience worth saving.
After a successful commit and push, benchai update also submits the document update to the BenchAI backend so reusable lessons can be extracted into the experience fragment library. Pass --skip-fragments for pure formatting or maintenance-only changes.
Run benchai update . from the root of the cloned document repository. If you are in another folder, pass the document repository path explicitly:
benchai update /path/to/document-repository --message "Update experience documents"Capture Codex prompts
Start Codex through BenchAI to record submitted user prompts through Codex UserPromptSubmit hooks. Captured prompts are sent to the BenchAI backend, stored in MongoDB, and indexed into Pinecone when Pinecone is configured:
benchai capture -- codexCodex arguments can be passed after codex:
benchai capture -- codex --model gpt-5.5The command installs a user-level Codex hook in ~/.codex/hooks.json if needed, then launches Codex with capture enabled for that session. The hook calls:
POST /api/prompts/captureIf the backend call fails, the hook writes a local fallback JSONL file. Use --log-dir to choose that fallback directory:
benchai capture --log-dir ./benchai-prompts -- codexIf Codex asks to review hooks, open /hooks inside Codex and trust the BenchAI capture hook.
Maintainers
Build the local wrapper binary:
npm run build:localBuild prebuilt binaries before publishing:
BENCHAI_DEFAULT_BASE_URL=http://47.241.223.57:8083 npm run build:prebuilds
npm publish --access publicIf binaries are hosted outside the npm package, set one of these during install:
BENCHAI_CLI_DOWNLOAD_BASE=https://example.com/benchai npm install -g knowit-benchai
BENCHAI_CLI_DOWNLOAD_URL=https://example.com/benchai-darwin-arm64 npm install -g knowit-benchai