Examples
NotesPlugin Scenario
Use a minimal NotesPlugin to combine an Action, System content, and City registration.
NotesPlugin Scenario
import {
Plugin,
type PluginActions,
type PluginContext,
} from "@downcity/city/plugin";
class NotesPlugin extends Plugin {
readonly name = "notes";
readonly title = "Project Notes";
readonly description = "Describe the project notes folder.";
system(context: PluginContext) {
return `Project notes folder: ${context.workspace.path}/.notes`;
}
readonly actions: PluginActions = {
status: {
execute: async ({ context }) => ({
success: true,
data: {
workspace_path: context.workspace.path,
storage_path: context.storage.path,
},
}),
},
};
}
const notes_plugin = new NotesPlugin();The host provides notes_plugin to City, which exposes it to every Agent. After entering a
Workspace, host code may call
city.plugins.scope({ agent_id: agent.id, workspace_id: workspace.id }).run_action() explicitly. Sessions collect System content and Hooks from the same City
execution view.
This Plugin owns no long-lived resources, so it needs no Lifecycle. Use context.workspace.files for
user project files and context.storage.files for private Plugin state.