Capsule Development
できること
このスキルは、Unicity AOS内で動作する小さな安全なプログラムであるカプセルの作成を案内します。エージェントシステム用の新しいプログラムの部品を書いてインストールしたい開発者向けです。
使う場面
- ✓Unicity AOSの環境で、新しいカプセルを始めたいとき。
- ✓カプセルのビルド、リンク、インストールに失敗し、デバッグが必要なとき。
- ✓カプセルのアクセスルールが正しく設定されているか確認する必要があるとき。
スキルのリンク
https://github.com/unicity-aos/aos-ce/blob/main/capsules/capsule-system/src/skills/capsule-development/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“サポートされているテンプレートから新しいUnicity AOSカプセルを作成し、ビルドして、テスト用にインストールしてください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
エージェントは、公式のプロジェクトテンプレートから始め、カプセルがアクセスできるものを定めるマニフェストを設定します。そのうえで必要なターゲット向けにビルドし、インストールの前にアクセスリストを確認します。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
Capsule Development
A capsule is a Rust WebAssembly component that runs inside the Astrid Runtime sandbox shipped by Unicity AOS. The runtime routes IPC, enforces capabilities, mediates host access, and audits execution. Business logic belongs in capsules.
The manifest is part of the security boundary. Its [publish] and [subscribe]
tables are the IPC access-control list: a topic that is not declared is denied.
Capsules target wasm32-unknown-unknown, not WASI, and reach the host only through
the audited SDK/WIT imports granted by the manifest.
Start from the supported scaffold
aos capsule new my-capsule
cd my-capsule
The generated project contains:
my-capsule/
├── .cargo/config.toml
├── rust-toolchain.toml
├── Cargo.toml
├── Capsule.toml
└── src/lib.rs
Do not begin from an old [[interceptor]] manifest or an ipc_publish /
ipc_subscribe capability array. Those formats are obsolete.
Compiler target
.cargo/config.toml selects the capsule target and activates the SDK's custom
randomness backend:
[build]
target = "wasm32-unknown-unknown"
[target.wasm32-unknown-unknown]
rustflags = ["--cfg=getrandom_backend=\"custom\""]
The getrandom_backend setting must live in the final capsule crate. Without it,
dependencies such as UUID generators or randomized hash maps can fail to link.
Pin the toolchain and target in rust-toolchain.toml:
[toolchain]
channel = "1.94.0"
targets = ["wasm32-unknown-unknown"]
components = ["rustfmt", "clippy"]
Cargo package
Use a cdylib and the current 0.7 SDK surface:
[package]
name = "my-capsule"
version = "0.1.0"
edition = "2024"
publish = false
[lib]
crate-type = ["cdylib"]
[dependencies]
astrid-sdk = { version = "0.7", features = ["derive"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
[profile.release]
opt-level = "z"
lto = true
codegen-units = 1
strip = true
panic = "abort"
Capsule manifest
This minimal tool capsule exposes one hello tool:
[package]
name = "my-capsule"
version = "0.1.0"
description = "A small example capsule"
authors = ["Your Name <you@example.com>"]
astrid-version = ">=0.7.0"
[[component]]
id = "my-capsule"
file = "my_capsule.wasm"
type = "executable"
[capabilities]
fs_read = ["home://data/my-capsule/"]
fs_write = ["home://data/my-capsule/"]
[publish]
"tool.v1.execute.*.result" = { wit = "@unicity-astrid/wit/types/tool-call-result" }
"tool.v1.response.describe.*" = { wit = "@unicity-astrid/wit/tool/describe-response" }
[subscribe]
"tool.v1.execute.hello" = { wit = "@unicity-astrid/wit/types/tool-call", handler = "tool_execute_hello" }
"tool.v1.request.describe" = { wit = "@unicity-astrid/wit/tool/describe-request", handler = "tool_describe" }
Skills are agent user-space instructions, not a Capsule.toml protocol. Ship a trigger Skill through the host plugin or the agent-level Skills service, and expose capsule-owned reference material through typed IPC tools when useful. Do not add an agent Skill section to the manifest or request filesystem write authority merely to modify a host's instruction directory.
The published @unicity-astrid/wit/... strings and astrid:* WIT namespaces
are stable runtime identifiers. Keep them exact even though the product CLI is
aos.
For a tool capsule, both publish entries are required: one returns tool results,
and the other answers the describe fan-out that makes tools visible to agents.
Every tool needs its own concrete execute subscription. A subscribe wildcard may
have one trailing *; publish permissions should be as narrow as practical.
Manifest data is untrusted input. Do not put operator authority, principal identity, or a secret scope in a capsule-controlled field. The kernel stamps the caller identity and decides operator-only policy.
Implement a tool
#![deny(unsafe_code)]
#![deny(clippy::all)]
use astrid_sdk::prelude::*;
use astrid_sdk::schemars;
use serde::Deserialize;
#[derive(Default)]
pub struct MyCapsule;
#[derive(Debug, Default, Deserialize, schemars::JsonSchema)]
pub struct HelloArgs {
/// Person to greet.
pub name: String,
}
#[capsule]
impl MyCapsule {
/// Greet a person by name.
#[astrid::tool("hello")]
pub fn hello(&self, args: HelloArgs) -> Result<String, SysError> {
Ok(format!("Hello, {}!", args.name))
}
}
The tool macro derives the input schema from JsonSchema, uses the method's doc
comment as the tool desc
よくある質問
マニフェストが重要なのはなぜですか?
そのアクセスリストが、カプセルが送受信できるメッセージを制御し、宣言されていないものはすべて拒否されるからです。
古いサンプルから始めてもよいですか?
いいえ。古いマニフェスト形式は使えなくなっているため、スキルは現在のテンプレートから始めます。
Rustを知っている必要がありますか?
このスキルはRustを使うため、Rustを知っている開発者ほど得るものが多くなります。
詳細
作者による元の説明
Build, test, package, install, and debug a current Unicity AOS capsule
repo: unicity-aos/aos-ce
人気
- GitHubのスター
- 8.5k
- ランキング
- #12454
- ライセンス
- Apache-2.0
- 更新日
- 2026/10/22
コメント
- …
このリポジトリの他のスキル
capsule-forge
8.5k新しい能力をスキル、カプセル、プラグインのどれにするかを判断し、Unicity AOS上で作成または修正するよう支援します。
meta-harness
8.5k実際の作業中にエージェントが自身のツール、メモリ、指示の不足に気づき、改善して、より良いものを残すよう支援します。
似ているスキル
api-connector-builder
280kエージェントが既存のパターンに従って、新しいAPI連携を構築します。新しい方式を作らずに、もう一つ連携を追加したいときに使います。
api-design
280kエージェントがベストプラクティスに沿ってREST APIを設計できるようにします。APIの通信方法、エラーの表示方法、データの整理方法を決めるのに役立ちます。
backend-patterns
280kエージェントのサーバーサイドのアーキテクチャパターンとデータベースの最適化を支援します。サーバー上で動くコードを作成またはレビューするときに役立ちます。