Skip to content

TIP

This guide shows you how to use lovrabet kb to create, view, update, and search your personal knowledge base within the current app. Once that's done, the Agent can draw on these business rules, SOPs, and fixed notes whenever a search hits them.

Prerequisites

ItemRequirementHow to check
Lovrabet Runtime CLIlovrabet runs locallylovrabet --help
AccessKeyYour account has access to the target applovrabet auth status
Target appYou know the app name or appcodelovrabet app list
Knowledge content fileA local UTF-8 text or Markdown filee.g. ./approval.md

WARNING

A personal knowledge base only holds knowledge the current user writes in the current app. lovrabet kb search searches both the company knowledge and personal knowledge visible to you, telling them apart with scope.

Sign in and pick your app

bash
lovrabet auth login --access-key <ACCESS_KEY>
lovrabet auth status
bash
lovrabet app list
lovrabet app use <应用名>

If you'd rather not set a default app, append --appcode <APP_CODE> to each command instead.


Create a personal knowledge base entry

Start by writing the rules you want to store into a local file. Both create and update read the body from a file — passing inline content in the command is not supported.

markdown
# 订单审批规则

- 金额超过 50000 元,需要主管审批。
- 加急订单必须填写加急原因。
- 缺少客户编号时,不允许进入审批。

Preview the create request

bash
lovrabet kb create --title "订单审批规则" --file ./approval.md --dry-run

Check that appCode, title, and the file body in the preview look right, then run the actual create.

Create the entry

bash
lovrabet kb create --title "订单审批规则" --file ./approval.md --format compress

On success, the output includes fields such as id, title, version, ragStatus, ragErrorMessage, and updateTime. Note down the id — you'll need it for updates and detail lookups.


View and update personal knowledge

List your entries

bash
lovrabet kb list --format compress

By default, the list shows each entry's id, title, version, ragStatus, and update time.

View an entry's body

bash
lovrabet kb detail --id <条目ID> --format compress

The detail command returns the full body, version, creation time, update time, and RAG status. Reading the detail before an update helps you avoid overwriting the wrong entry.

Update an entry from a file

bash
lovrabet kb update --id <条目ID> --file ./approval-v2.md --dry-run
lovrabet kb update --id <条目ID> --file ./approval-v2.md --format compress

When you omit --title, the CLI reads the current entry first and keeps the original title. Pass a new title explicitly when you want to change it.

bash
lovrabet kb update --id <条目ID> --title "新版订单审批规则" --file ./approval-v2.md --format compress

WARNING

lovrabet kb currently has no delete command. To delete a knowledge entry, use the product UI.


Search the knowledge base

Search by business question

bash
lovrabet kb search --query "订单审批" --topk 5 --format compress

The result returns the hit count and hits. Each hit contains scope, docId, score, weightedScore, content, and metadata. scope distinguishes company knowledge from personal knowledge.

FieldMeaning
PERSONALPersonal knowledge written by the current user
COMPANYCompany knowledge visible to the current user
scoreRaw similarity score
weightedScoreWeighted ranking score

Check the RAG status

A successful create or update only means the entry has been written. To confirm the Agent can actually retrieve it, keep an eye on ragStatus and search hits.

ragStatusWhat to do
PENDINGWaiting to sync. Check the detail or search again later.
PARSINGParsing the file. Check again later.
INDEXINGBuilding the index. Check again later.
READYSearchable. Verify hits with kb search.
FAILEDCheck ragErrorMessage, fix the document, and update again.
DISABLEDRAG search is disabled in this environment. You can only confirm the entry is saved.
bash
lovrabet kb detail --id <条目ID> --format compress
lovrabet kb search --query "刚写入的关键词" --topk 5 --format compress

Save knowledge in an Agent conversation

To save knowledge during a Lovrabet Runtime Agent conversation, state the title and body clearly first. The Agent writes to the personal knowledge base only when the content is unambiguous.

text
把下面这条规则保存到知识库,标题叫「订单审批规则」:
金额超过 50000 元,需要主管审批;加急订单必须填写加急原因。
Agent behaviorWhat you see
Confirms the title and bodyTitle and body come from your explicit input or content already confirmed in the conversation
Calls the knowledge write capabilityCreates or updates personal knowledge in the current app
Opens the detail after a successful writeIf a kbId is returned, the page opens the corresponding knowledge entry
Searches knowledgeThe Agent can search company and personal knowledge by question

WARNING

Never store AccessKeys, cookies, account passwords, customer PII, or throwaway debug details in a knowledge base. Knowledge bases are for stable rules, SOPs, field definitions, query conditions, and reusable cases.


Final checklist

  • [ ] You have written an entry with lovrabet kb create or lovrabet kb update.

  • [ ] You ran lovrabet kb detail --id <entry ID> and saw the correct title, body, and version.

  • [ ] ragStatus is READY, or you've confirmed the environment is in a waiting, failed, or disabled state.

  • [ ] You found the keywords you just wrote with lovrabet kb search.

  • [ ] If the Agent needs to use the knowledge, you verified with the same business question that its answer reflects it.


FAQ

"Authentication required"

No AccessKey is configured locally, or the current environment can't read the configuration. Sign in first.

bash
lovrabet auth login --access-key <ACCESS_KEY>
lovrabet auth status

"App code is required"

The command couldn't resolve the target app. Set a default app first, or append --appcode <APP_CODE> explicitly.

bash
lovrabet app list
lovrabet app use <应用名>

"File not found"

The file --file points to doesn't exist or isn't a regular file. Check the path and retry. Both create and update require a local file.

Search returns no hits

Check ragStatus in the entry detail first. If it is still PENDING, PARSING, or INDEXING, search again later. If it's FAILED, fix the document based on ragErrorMessage and update again.

Can I delete knowledge entries with the CLI?

No. lovrabet kb currently supports only list, detail, create, update, and search. Handle deletion in the product UI.

基于飞书知识库同步生成,内容以飞书源文档为准