Skip to Content
DocsPluginsComparisonChangelog
0
DocsChangelog

More

Discussionsllms.txtllms-full.txt
Getting startedWhat is concivComparisonRequirementsPlaygroundExamplesAPI reference

Engine and widgetSessionsHarnessesTools and code modeAgents and permissionsSkills

Use conciv
Bundlers
Agents
PluginsBuild your first plugin
Plugin API reference
Plugins

Build your first plugin

Build a plugin from an empty folder to a tool the agent calls and a card you see in the chat.

The agent cannot run your code or read what only your project knows. A plugin gives it a tool that can. This guide builds project_version, a tool that reads your project's package.json, and a card that shows each call in the chat.

This guide takes the shortest path:

  1. Write the tool in conciv/plugins/project-version.
  2. Ask the agent, and see the generic card.
  3. Draw the calls as your own card.
  4. Build the card, and see it in the chat.

Promise or Effect?

You write the engine part in one of two styles. Both can do the same things. Promise is plain async and await. Effect is for code that already uses Effect: typed errors, and work that stops when the user stops the turn. Every engine example has a tab for each. The site remembers your choice.

Copy this prompt into your agent. It builds this in your project from this page.

Prompt
Build this in my project with conciv. conciv is a dev-only AI agent widget, and it already runs in my app.

1. Read https://conciv.dev/docs/plugins/first-plugin.md and follow it. It is the source of truth for the API.
2. If the project has the conciv-develop skill (conciv init installs it with the @conciv/skills docs pack), load it too.
3. Add a plugin folder, conciv/plugins/project-version. Its server.ts adds a project_version tool that reads my package.json and returns its name and version.
4. Add a browser card that shows the name and version for each project_version call.
5. Write the browser part in the UI framework my app uses. For React or Preact, put it in my app with @conciv/react or @conciv/preact and give it to <ConcivWidget>, as the page shows. For anything else, use Solid in the plugin folder and build it as the page shows.
6. Install only the packages the page lists, with the package manager this project uses.
7. Check that the engine sees it: run `npx @conciv/cli tools --help` while the dev server runs. project_version must be listed.
8. Tell me to ask the conciv chat "What version is this project?" and to look for the card.
9. When you are done, tell me what you changed and how to see it.

Installation

You need a project where conciv already runs. See Getting started. Then install what the engine part imports:

npm install -D @conciv/backend-plugin-api zod
pnpm add -D @conciv/backend-plugin-api zod
yarn add --dev @conciv/backend-plugin-api zod
bun add --dev @conciv/backend-plugin-api zod

For the Effect style, also install Effect and the package that holds the Tool error type:

npm install -D effect @conciv/protocol
pnpm add -D effect @conciv/protocol
yarn add --dev effect @conciv/protocol
bun add --dev effect @conciv/protocol

Write the tool

A plugin is a folder in conciv/plugins. Its engine part is server.ts. Make the folder and the file:

server.ts
conciv/plugins/project-version/server.ts
import {} from 'node:fs/promises'
import path from 'node:path'
import {} from 'zod'
import {Plugin, } from '@conciv/backend-plugin-api'

const  = .({: .(), : .()})

async function (: string) {
  try {
    return .(.(await (path.(, 'package.json'), 'utf8')))
  } catch {
    throw .({: 'package.json is missing, or has no name and version.'}) // <- what the agent reads
  }
}

export default Plugin.({
  : 'project-version', // <- the plugin's name in conciv
  async () {
    await ..(() => {
      .({
        : 'project_version',
        : "Read the project's name and version from its package.json.", // <- the agent reads this
        : .({}),
        : ,
        : {: false}, // <- a direct tool: each call gets its own card
        : async () => ({: await (..)}),
      })
    })
  },
})
conciv/plugins/project-version/server.ts
import {} from 'node:fs/promises'
import path from 'node:path'
import {} from 'effect'
import {} from 'zod'
import {Plugin} from '@conciv/backend-plugin-api/effect'
import * as  from '@conciv/protocol/schema/tool'

const  = .

export default Plugin.({
  : 'project-version', // <- the plugin's name in conciv
  : () =>
    ..(() => {
      .
        : 'project_version',
        : "Read the project's name and version from its package.json.", // <- the agent reads this
        : .
        : 
        : {: false}, // <- a direct tool: each call gets its own card
        : () =>
          .
            : async () =>
              .(




A few things to notice:

  • setup (Promise) or effect (Effect) runs once, when the engine loads the plugin. ctx is what the engine gives it. ctx.location.directory is your project folder.
  • input and output are zod schemas. The engine checks the agent's input before your code runs.
  • Both tabs fail the same way. A missing file or a bad shape fails the call with one Tool.toolError message.
  • codemode: false makes it a direct tool. Learn more in Tools and code mode.

Ask the agent

The engine watches conciv/plugins. A new folder loads with no restart. So does a saved change. Open your app and ask in the chat:

chat
What version is this project?

The agent calls project_version and answers with your project's name and version. The call shows as the generic card for now.

A folder elsewhere, such as one shared across projects, loads through the plugins option instead. See Add plugins.

Draw the card

The browser part draws a tool's calls as your own card. Write it in Solid, React, Preact or plain DOM. Pick a tab: the site keeps your pick on every page.

  • Solid and plain DOM: the browser part sits in the plugin folder, and you build it into one file.
  • React and Preact: the card lives in your app and draws inside your app's own tree, so your providers reach it. Your app's bundler compiles it, with no extra build.

Install what the browser part is built with:

npm install -D @conciv/frontend-plugin-api solid-js vite vite-plugin-solid
pnpm add -D @conciv/frontend-plugin-api solid-js vite vite-plugin-solid
yarn add --dev @conciv/frontend-plugin-api solid-js vite vite-plugin-solid
bun add --dev @conciv/frontend-plugin-api solid-js vite vite-plugin-solid

Add plugin-experimental.tsx next to server.ts:

conciv/plugins/project-version/plugin-experimental.tsx
import






























Install the React bridge:

npm install -D @conciv/react @conciv/frontend-plugin-api zod
pnpm add -D @conciv/react @conciv/frontend-plugin-api zod
yarn add --dev @conciv/react @conciv/frontend-plugin-api

Install the Preact bridge:

npm install -D @conciv/preact @conciv/frontend-plugin-api zod
pnpm add -D @conciv/preact @conciv/frontend-plugin-api zod
yarn add --dev @conciv/preact @conciv/frontend-plugin-api

Install what the browser part is built with. The build helper compiles with vite-plugin-solid, so it needs Solid even when your code does not use it:

npm install -D @conciv/frontend-plugin-api solid-js vite vite-plugin-solid
pnpm add -D @conciv/frontend-plugin-api solid-js vite vite-plugin-solid
yarn

A few things to notice:

  • render draws one call. It runs again as the call moves on. props.output is empty until the call ends.
  • A failed call draws the error card, not render.
  • In Solid, the browser part's Plugin.define has no id. It takes the engine part's.
  • In Solid, ctx.ui.Icon draws an icon from the widget's set. The names are lucide names.
  • reactRender, preactRender and mountRender each turn your component into the render the registry takes.

Build or wire the browser part

The engine looks for exactly plugin-experimental.cjs (or .js) in the plugin folder. The name says "experimental" because the browser API can still change. Add a Vite config that builds it:

conciv/plugins/project-version/vite.config.ts
import {} from 'vite'
import {

export default ({
  : import.., // <- entry and outFile resolve from the plugin folder
  : false,
  : [
})

Build it from your project folder:

terminal
npx vite build --config conciv/plugins/project-version/vite.config.ts

Run the build again after each change to the browser part, then reload your app.

The card draws through <ConcivWidget> from @conciv/react. Render it once in your app, and give it the card under the plugin's id:

src/app.tsx

The card draws through <ConcivWidget> from @conciv/preact. Render it once in your app, and give it the card under the plugin's id:

src/app.tsx

The engine looks for exactly plugin-experimental.cjs (or .js) in the plugin folder. The name says "experimental" because the browser API can still change. Add a Vite config that builds it:

conciv/plugins/project-version/vite.config.ts
import {






Reload your app and ask again. The call now shows your card with your project's name and version.

Your plugin draws its own card

A scripted session in the real panel. It plays in your browser, with no server.

conciv / transcript

Your plugin draws its own card

  1. You: Which version is this project?

    The agent calls project_version

    This is vite-project 0.0.0, read from package.json.

Add an instruction…

The generic card, then your own card

Next steps

  • Add a tool: namespaces, failures, and code mode.
  • Share an RPC method: let the browser part call the engine part.
  • Test your plugin: run this plugin on a real engine in a test.

Plugins

What a plugin adds to conciv, when a skill is enough instead, and the guides for every part of a plugin.

Add a tool

Give the agent a tool that runs your code, choose how the agent calls it, and draw its calls as your own card.

On this page

InstallationWrite the toolAsk the agentDraw the cardBuild or wire the browser partNext steps
Edit on GitHubView .mdOpen in ClaudeOpen in ChatGPT
: () => .
}).
})
}),
})
{
Plugin
,
}
from
'@conciv/frontend-plugin-api'
import {} from 'zod'
const = .
function (: string | undefined) {
try {
return .
} catch {
return // <- a denied or cancelled call has text, not JSON
}
}
export default Plugin.
() {
.
: 'project_version', // <- the tool this card draws
: () => {
const = () =>
ToolProps.output?: string | undefined
return (
<>
<..
{()
? `${()?.} ${
: . ===
? 'Reading package.json'
: 'No version to show'}
</>
)
},
})
},
})
zod
bun add --dev @conciv/react @conciv/frontend-plugin-api zod

Add the card to your app:

src/conciv/project-version.tsx
import























zod
bun add --dev @conciv/preact @conciv/frontend-plugin-api zod

Add the card to your app:

src/conciv/project-version.tsx
import























add
--dev
@conciv/frontend-plugin-api
solid-js
vite
vite-plugin-solid
bun add --dev @conciv/frontend-plugin-api solid-js vite vite-plugin-solid

Add plugin-experimental.ts next to server.ts:

conciv/plugins/project-version/plugin-experimental.ts
import {





























}
from
'@conciv/frontend-plugin-api/vite'
({
:
'plugin-experimental.tsx'
,
:
'plugin-experimental.cjs'
})],
import {} from '@conciv/react' import {} from './conciv/project-version' const

<ConcivWidget> mounts the widget itself, so turn off the widget the bundler plugin adds. Set widget: false:

vite.config.ts
import {} from 'vite'




A card drawn outside a <ConcivWidget> throws. Use the engine part's id, here project-version.

import {} from '@conciv/preact' import {} from './conciv/project-version' const

<ConcivWidget> mounts the widget itself, so turn off the widget the bundler plugin adds. Set widget: false:

vite.config.ts
import {} from 'vite'




A card drawn outside a <ConcivWidget> throws. Use the engine part's id, here project-version.

}
from
'vite'
import {
export default ({
: import.., // <- entry and outFile resolve from the plugin folder
: false,
: [
})

Build it from your project folder:

terminal
npx vite build --config conciv/plugins/project-version/vite.config.ts

Run the build again after each change to the browser part, then reload your app.

({
:
.
(),
:
.
()})
({
({}),
,
({
.
(
await
(
path
.
(
.
.
,
'package.json'
),
'utf8'
))),
({
:
'package.json is missing, or has no name and version.'
}),
(
.
((
)
=>
({
:
}))),
({
:
.
(),
:
.
()})
(
.
(
??
''
)).
({
(
, {
(
.
output
)
=
"box"
=
"small"
/>
()?.
}`
{
,
type
Plugin
,
type
ToolProps
}
from
'@conciv/frontend-plugin-api'
import {} from '@conciv/react'
import {} from 'zod'
const = .
function (: string | undefined) {
try {
return .
} catch {
return // <- a denied or cancelled call has text, not JSON
}
}
function (: ToolProps) {
const manifest = (.
const manifest: {
    name: string;
    version: string;
} | undefined
if () return <>{`${
return <>{. === ? 'Reading package.json' : 'No version to show'}</>
}
export const : Plugin.
.
: 'project_version', // <- the tool this card draws
: (
})
}
{
,
type
Plugin
,
type
ToolProps
}
from
'@conciv/frontend-plugin-api'
import {} from '@conciv/preact'
import {} from 'zod'
const = .
function (: string | undefined) {
try {
return .
} catch {
return // <- a denied or cancelled call has text, not JSON
}
}
function (: ToolProps) {
const manifest = (.
const manifest: {
    name: string;
    version: string;
} | undefined
if () return <>{`${
return <>{. === ? 'Reading package.json' : 'No version to show'}</>
}
export const : Plugin.
.
: 'project_version', // <- the tool this card draws
: (
})
}
,
Plugin
,
,
type
ToolProps
}
from
'@conciv/frontend-plugin-api'
import {} from 'zod'
const = .
function (: string | undefined) {
try {
const =
return `${.} ${
} catch {
return === ? 'Reading package.json' : 'No version to show'
}
}
export default Plugin.
() {
.
: 'project_version', // <- the tool this card draws
:
const = .(.
const = .(() => {
. = (
})
return () => {
()
.()
}
}),
})
},
})
=
[[{
:
'project-version'
,
:
async
()
=>
({
:
})}, {}]]
as
export function () {
return (
<>
<>Your app</>
< ={
</>
)
}
import
from
'@conciv/it/plugin/vite'
export default ({
: [
})
=
[[{
:
'project-version'
,
:
async
()
=>
({
:
})}, {}]]
as
export function () {
return (
<>
<>Your app</>
< ={
</>
)
}
import
from
'@conciv/it/plugin/vite'
export default ({
: [
})
}
from
'@conciv/frontend-plugin-api/vite'
({
:
'plugin-experimental.ts'
,
:
'plugin-experimental.cjs'
})],
({
:
.
(),
:
.
()})
(
.
(
??
''
)).
)
.
} ${
.
}`
}</
>
=
(
)
=>
{
(
, {
),
({
:
.
(),
:
.
()})
(
.
(
??
''
)).
)
.
} ${
.
}`
}</
>
=
(
)
=>
{
(
, {
),
({
:
.
(),
:
.
()})
.
(
.
(
??
''
))
.
}`
({
(
, {
<
ToolProps
>((
,
)
=>
{
(
'p'
))
.
().
)
// <- runs now, and on every change
} />
({
:
false
})],
// <- keep your framework's plugin next to it
} />
({
:
false
})],
// <- keep your framework's plugin next to it