cosense

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Cosense Skill 手順書

Cosense Skill Procedure

cosense
CLIを使い、Cosenseのページを読み・調べてユーザーに回答する。 書き込み・削除 (ページ編集・コメント追記・ページやファイルの削除等) はユーザーが明示的に指示した時のみ行う。
Use the
cosense
CLI to read and research Cosense pages and respond to users. Writing/deleting operations (such as page editing, adding comments, deleting pages or files, etc.) should only be performed when explicitly instructed by the user.

Cosenseとはどういう物か

What is Cosense?

Cosenseは複数のページ同士をリンクさせ、複雑な情報をナレッジグラフとして表現するweb状のWiKiである。 ページ間リンクは
[ページタイトル]
というブラケット記法で表現する。
Cosense is a web-based Wiki that links multiple pages together to represent complex information as a knowledge graph. Inter-page links are expressed using the bracket notation
[Page Title]
.

Cosenseを読み解く際のTips

Tips for Understanding Cosense

  • キーワード検索だけに頼らず、関連ページリストを眺めて、辿るべきだ。単独のページでは見えなかった文脈が浮かびあがる
  • ナレッジグラフ上での被リンク数やページランク値が大きいページは、実質的にフォルダやカテゴリのような階層構造の親としても機能している
  • 一見、観念的なページタイトルだけがあり、本文で何も説明されていなくても、他のページの文脈の中で説明されている事がある
  • Don't rely solely on keyword searches; instead, browse and follow the list of related pages. Context that wasn't visible on a single page will emerge.
  • Pages with a high number of incoming links or page rank values in the knowledge graph also function as parents in hierarchical structures, similar to folders or categories.
  • Even if a page only has an abstract title with no explanation in its body, it may be explained in the context of other pages.

こういう時はこうする

Actions for Scenarios

調査したい時、あるいは特定のページを読みたい時

When you want to research or read a specific page

ページの読み方: read-page.md
  • プロジェクト名だけ指定された時は、
    https://scrapbox.io/<project>
    を projectUrl としてCLIに渡す
  • プロジェクト名+ページタイトルが指定された時は、
    https://scrapbox.io/<project>/<title>
    を pageUrl としてCLIに渡す
  • プロンプト中にURLが書かれている時、URLは
    https://
    から最初の空白文字までが丸ごと一つ。Cosenseのタイトルは長い日本語の文章になりうる(タイトル中の空白はURL上では
    _
    )ので、日本語・記号・
    _
    /
    に見える助詞も、空白が来るまで全部URLの一部。ASCII→日本語の境目で切ると、ユーザーが意図したのと別のページを読みに行ってしまう
  • 記号を含むURLは shell でクォート(
    '...'
    )で囲んで渡す
How to read a page: read-page.md
  • When only a project name is specified, pass
    https://scrapbox.io/<project>
    as the projectUrl to the CLI
  • When a project name + page title is specified, pass
    https://scrapbox.io/<project>/<title>
    as the pageUrl to the CLI
  • When a URL is included in the prompt, the entire URL from
    https://
    to the first whitespace character is treated as one. Cosense titles can be long Japanese sentences (spaces in titles are replaced with
    _
    in URLs), so Japanese characters, symbols,
    _
    , and particles that look like
    /
    should all be included as part of the URL until a whitespace is encountered. Cutting at the boundary between ASCII and Japanese will lead to accessing a different page than the user intended
  • URLs containing symbols should be enclosed in quotes (
    '...'
    ) when passed in the shell

読んでいたページが見つからなくなった時、共同編集者の変更を追いたい時

When the page you were reading disappears or you want to track changes made by collaborators

変更の追い方: read-page.md の「変更を追う」を参照
  • 読んでいたページが急に 404 や「未作成の空ページ」になったら、共同編集者がタイトルを変更した可能性がある
  • 読んだ時に控えた pageId と commitId を使い、
    browsePageChanges
    で何が変わったか(リネーム含む)を確認してから読み直す
How to track changes: Refer to "Track Changes" in read-page.md
  • If the page you were reading suddenly becomes a 404 or an "empty uncreated page", it's possible that a collaborator changed the title
  • Use the pageId and commitId you noted when reading the page to check what changed (including renaming) with
    browsePageChanges
    before re-reading

ページを編集したい時、コメントを書き込みたい時

When you want to edit a page or add a comment

ページ編集手順: edit-page.md
  • ユーザーが明示的に「書き込んで」「編集して」「コメント追記して」等を指示した時のみ
  • 調査・閲覧・要約タスクでは参照しない
Page editing procedure: edit-page.md
  • Only when the user explicitly instructs such as "Write", "Edit", "Add a comment", etc.
  • Do not refer to this for research, browsing, or summarization tasks

ファイルをアップロードしてページに埋め込みたい時

When you want to upload a file and embed it in a page

ファイルアップロード手順: upload-file.md
  • ユーザーが明示的に「この画像をアップロードして」「ファイルを貼って」「レポートに画像を埋め込んで」等を指示した時のみ
  • アップロードだけで終わらせず、埋め込みまでがこの手順の範囲
File upload procedure: upload-file.md
  • Only when the user explicitly instructs such as "Upload this image", "Paste the file", "Embed the image in the report", etc.
  • This procedure includes embedding the file, not just uploading it

ログインしたい時、あるいは認証エラーが返ってきた時

When you want to log in or when an authentication error is returned

ログイン手順: login.md
  • ユーザーから「Cosenseにログインして」と明示的に指示された時
  • 認証が必要なプロジェクトに
    browsePage
    等でアクセスし、HTTP 401 または 403 が返ってきた時
Login procedure: login.md
  • When the user explicitly instructs "Log in to Cosense"
  • When accessing a project that requires authentication with
    browsePage
    etc., and an HTTP 401 or 403 error is returned

CLIの挙動が想定と違う時

When the CLI behavior differs from expectations

バージョン互換性チェック: version-mismatch.md
  • unknown command
    /
    unknown option
    エラー
  • 戻り値JSONの構造が手順書と違う
  • --help
    の出力に手順書で参照しているコマンドが無い
Version compatibility check: version-mismatch.md
  • unknown command
    /
    unknown option
    errors
  • The structure of the returned JSON differs from the procedure manual
  • The command referenced in the procedure manual is not present in the
    --help
    output

CLIコマンド一覧

List of CLI Commands

CLI実行コマンド形式

CLI Execution Command Format

  • cosense <command> <args...>
    を実行する
  • 事前に
    npm install -g @helpfeel/cosense-cli
    でインストールしておく
  • Node 24+ 前提
  • Execute
    cosense <command> <args...>
  • Install in advance with
    npm install -g @helpfeel/cosense-cli
  • Requires Node 24+

コマンド一覧

Command List

command用途
loginPersonal Access Token または Service Account を設定ファイルに保存する
whoami現在の認証ユーザーの情報を取得する
listProjects自分が参加しているprojectの一覧を取得する
browsePage単一ページを読む。メタデータ+アイコン記法+テロメア+Infobox+本文をAIが読みやすい形式で出力する。行permalink (
#<lineId>
) 付きなら該当行をマークする
browseRelatedPages1-hop+2-hopの関連ページタイトル一覧をAIが読みやすい形式で出力する。infobox定義ページでは文芸的データベース(TSV表)を出力する
browsePageChangesページの編集履歴(commit)をpageId起点で取得し、誰が何をどう変えたかを自然言語で説明する。タイトル変更(リネーム)も検出する
readPage単一ページを読む
readPageSnapshotsnapshotのIDを指定してPage History上の過去の本文を読む
readFileInfoファイルのメタデータと抽出済みテキストを取得する
downloadFileファイル本体をダウンロードしてローカルに保存する
uploadFileファイルをprojectにアップロードして埋め込みURLを取得する
deleteFileファイルをprojectから削除する
readProjectMembersプロジェクトのメンバー一覧を取得する
listPagesプロジェクトのページ一覧を取得する
listPageSnapshotsページのsnapshot一覧(Page History)をpageId起点で取得する
list1hopLinks1-hop近傍を取得する
list2hopLinks2-hop近傍を取得する
searchVectorベクトル検索でページを探す(タイトル+本文中リンク記法のみ対象)
searchFullText本文全文を対象に検索する
search1hopLinks1-hop近傍を全文検索でフィルタする
search2hopLinks2-hop近傍を全文検索でフィルタする
previewEditページ編集opsをdry-runしてpreviewIdを取得する
previewDeleteページ削除をdry-runしてpreviewIdを取得する
submitEditpreviewEdit/previewDeleteで取得したpreviewIdを使ってページ編集・削除を確定する
replaceLinks旧タイトルへのリンク記法を新しいタイトルに一括置換する
commandPurpose
loginSave Personal Access Token or Service Account to the configuration file
whoamiRetrieve information about the currently authenticated user
listProjectsRetrieve a list of projects you are participating in
browsePageRead a single page. Outputs metadata + icon notation + telomere + Infobox + body in a format easy for AI to read. Marks the relevant line if a line permalink (
#<lineId>
) is included
browseRelatedPagesOutputs a list of 1-hop+2-hop related page titles in a format easy for AI to read. For infobox definition pages, outputs a literary database (TSV table)
browsePageChangesRetrieve the edit history (commits) of a page starting from the pageId, and explain who changed what and how in natural language. Detects title changes (renaming)
readPageRead a single page
readPageSnapshotRead the past body content from Page History by specifying the snapshot ID
readFileInfoRetrieve file metadata and extracted text
downloadFileDownload the file itself and save it locally
uploadFileUpload a file to the project and retrieve the embed URL
deleteFileDelete a file from the project
readProjectMembersRetrieve a list of project members
listPagesRetrieve a list of project pages
listPageSnapshotsRetrieve a list of page snapshots (Page History) starting from the pageId
list1hopLinksRetrieve 1-hop neighbors
list2hopLinksRetrieve 2-hop neighbors
searchVectorSearch for pages using vector search (only targets titles + link notation in the body)
searchFullTextPerform a full-text search of the body content
search1hopLinksFilter 1-hop neighbors with full-text search
search2hopLinksFilter 2-hop neighbors with full-text search
previewEditDry-run page edit ops to retrieve a previewId
previewDeleteDry-run page deletion to retrieve a previewId
submitEditUse the previewId obtained from previewEdit/previewDelete to confirm page edits/deletions
replaceLinksBatch replace link notation to old titles with new titles

コマンドの詳細を知りたい時

To learn details about commands

  • 全コマンド一覧と概要:
    cosense --help
  • 個別コマンドの引数・戻り値スキーマ・HTTPエラー:
    cosense <command> --help
  • 戻り値のJSON構造に確信が持てない時は、必ずヘルプを読んでから使う
  • List of all commands and overview:
    cosense --help
  • Arguments, return value schema, and HTTP errors for individual commands:
    cosense <command> --help
  • If you are unsure about the JSON structure of the return value, always read the help before using the command

回答の形式

Response Format

  • 情報源(ページURL)を示しながらユーザーの問いに直接答える
  • 固定テンプレートは規定しない
  • Directly answer the user's question while indicating the source (page URL)
  • No fixed template is specified