# AGENTS.md — coding agent onboarding for {{name}}
> **You are a coding agent working in `node-app-{{name}}`.**
> This app was scaffolded by `node-app new --profile native`. It is a
> **native Rust cdylib loaded in-process** by the platform via `dlopen`.
> It is NOT eligible for the shared Bun runtime (#810) — that feature is
> for Bun apps. Native apps already share the host process.
## What this means for you
- **No `Bun.serve()`, no own HTTP listener, no own systemd unit.** The
platform's native loader resolves `_node_app_entry` from your `.so` and
calls `init() → handle_capability() → shutdown()` directly.
- **In-process**: a panic in your code crashes the host. Use `Result` and
`?` everywhere; avoid `.unwrap()` outside tests.
- **FirstParty tier requires GPG signing.** Non-econ-v1 community apps
should prefer the `bun` profile — Bun apps sandbox without signing.
- **Cross-FFI data is JSON text only.** Request: `{ capability, payload,
caller_node_id }`. Response: `{ status, data, error }`. Capped at 16 MiB.
## First files to open
| `src/lib.rs` | the `NodeApp` impl + `declare_node_app!(App)` |
| `manifest.json` | declare `capabilities.requires` / `capabilities.provides`; `app_type: "native"` |
| `Cargo.toml` | add crate deps (keep `node-app-sdk-rust` pinned) |
| `node-app.toml` | per-app dev config |
## Capability invocation cheatsheet
Inside `handle_capability(request)`:
```rust
use node_app_sdk_rust::{invoke_capability, publish_event, CapabilityRequest};
use serde_json::json;
// Read from core storage
let res = invoke_capability(CapabilityRequest {
capability: "core.storage.kv.get".into(),
payload: json!({ "namespace": "{{name}}", "key": "my-key" }),
caller_node_id: None,
}).await?;
// Publish an event to all connected WebSocket clients
publish_event("{{name}}.something-happened", &json!({ "foo": "bar" }))?;
```
## Useful commands
```bash
node-app audit # check this app against the blueprint
node-app dev # hot-reload dev loop against a local monorepo
node-app build # build cdylib (phase 3 of #868)
node-app package # build .deb (phase 3 of #868)
```
## Don'ts
- Don't make HTTP calls to localhost host ports. Use `invoke_capability()`.
- Don't export extra `pub extern "C"` symbols beyond `_node_app_entry`.
- Don't change `app_type` to `"bun"` — your code is Rust, not TypeScript.
- Don't expect shared-runtime memory savings — that's a Bun-only feature.