cosense Use the CLI to read and research Cosense pages and answer the user.
Writes and deletions (page edits, comment additions, deletion of pages or files, etc.) are performed only when the user explicitly instructs them.
What Cosense Is
Cosense is a web-like wiki that links multiple pages together to express complex information as a knowledge graph.
Links between pages are expressed using the bracket notation [ページタイトル] .
Tips for Reading Cosense
- Don't rely only on keyword searches; browse the list of related pages and follow the trail. Context that wasn't visible in a single page comes to the surface
- Pages with a high number of backlinks or a high page rank in the knowledge graph effectively also function as parents of a hierarchical structure, like folders or categories
- Even if a page at first glance has only an abstract page title and nothing is explained in its body, it may be explained within the context of other pages
In These Cases, Do This
When you want to research something, or when you want to read a specific page
How to read a page: read-page.md
- When only a project name is specified, pass
https://scrapbox.io/<project>as projectUrl to the CLI - When a project name + page title is specified, pass
https://scrapbox.io/<project>/<title>as pageUrl to the CLI - When a URL is written in the prompt, the URL is everything from
https://up to the first whitespace character as a single whole. Cosense titles can be long Japanese sentences (spaces within the title are represented in the URL as_), so Japanese, symbols, and even particles that look like_・で/をare all part of the URL until a whitespace appears. If you cut at the ASCII→Japanese boundary, you will end up reading a different page than the user intended - Pass URLs containing symbols enclosed in shell quotes (
'...')
When the page you were reading can no longer be found, or when you want to follow changes made by collaborators
How to follow changes: read-page.md see "Following Changes" in
- If the page you were reading suddenly becomes a 404 or an "uncreated empty page," a collaborator may have changed the title
- Using the pageId and commitId you noted down when reading, check with
browsePageChangeswhat changed (including renames), then read it again
When you want to edit a page or write a comment
Page editing procedure: edit-page.md
- Only when the user explicitly instructs things like "write," "edit," or "add a comment"
- Do not reference in investigation, browsing, or summarization tasks
When you want to upload a file and embed it in a page
File upload procedure: upload-file.md
- Only when the user explicitly instructs "upload this image," "paste the file," "embed the image in the report," etc.
- Do not stop at just uploading; the scope of this procedure extends through embedding
When you want to log in, or when an authentication error is returned
Login procedure: login.md
- When the user explicitly instructs "log in to Cosense"
- When accessing a project that requires authentication via
browsePageetc., and HTTP 401 or 403 is returned
When CLI behavior differs from expectations
Version compatibility check: version-mismatch.md
unknown command/unknown optionError- The structure of the returned JSON differs from the procedure manual
--helpThe output of does not contain a command referenced in the procedure manual
CLI command list
CLI execution command format
cosense <command> <args...>Execute- Beforehand,
npm install -g @helpfeel/cosense-cliinstall with - Node 24+ required
Command list
| command | Purpose |
|---|---|
| login | Save a Personal Access Token or Service Account to a configuration file |
| whoami | Get information about the currently authenticated user |
| listProjects | Get a list of projects you are participating in |
| browsePage | Read a single page. Outputs metadata + icon notation + telomere + Infobox + body in an AI-friendly format. If a line permalink (#<lineId>) is attached, mark the corresponding line |
| browseRelatedPages | Output a list of 1-hop + 2-hop related page titles in an AI-friendly format. For infobox definition pages, output a literary database (TSV table) |
| browsePageChanges | Retrieve a page's edit history (commits) starting from pageId, and explain in natural language who changed what and how. Also detects title changes (renames) |
| readPage | Read a single page |
| readPageSnapshot | Read past body content on Page History by specifying a snapshot ID |
| readFileInfo | Get file metadata and extracted text |
| downloadFile | Download the file body and save it locally |
| uploadFile | Upload a file to a project and get the embed URL |
| deleteFile | Delete a file from a project |
| readProjectMembers | Get the list of project members |
| listPages | Get the list of project pages |
| listPageSnapshots | Retrieve a page's snapshot list (Page History) starting from pageId |
| list1hopLinks | Get 1-hop neighborhood |
| list2hopLinks | Get 2-hop neighborhood |
| searchVector | Search for pages via vector search (targets only titles + link notation in body) |
| searchFullText | Search across the full body text |
| search1hopLinks | Filter the 1-hop neighborhood by full-text search |
| search2hopLinks | Filter the 2-hop neighborhood by full-text search |
| previewEdit | Dry-run page edit ops to obtain previewId |
| previewDelete | Dry-run page deletion to obtain previewId |
| submitEdit | Use the previewId obtained from previewEdit/previewDelete to finalize page edit/deletion |
| replaceLinks | Bulk-replace link notation to the old title with the new title |
When you want to know the details of a command
- List and overview of all commands:
cosense --help - Arguments, return value schema, and HTTP errors for individual commands:
cosense <command> --help - If you are not sure about the JSON structure of the return value, always read the help before using it
Answer format
- Answer the user's question directly while indicating the source of information (page URL)
- Use the page URL exactly as output by the CLI, and present it as a Markdown link with the page title as the link text. If a URL with Japanese written raw is mixed with escapes such as
%2F, clicking it in the terminal may navigate to a different page - No fixed template is specified