Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .claude-plugin/marketplace.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
},
"metadata": {
"description": "Basalt — the trust layer for AI-generated work. Connect your AI to publish, update and share governed docs by URL.",
"version": "0.2.0"
"version": "0.3.0"
},
"plugins": [
{
"name": "basalt",
"source": "./plugins/basalt",
"description": "Connect your AI to Basalt — publish, update and share governed docs by URL. Bundles the Basalt MCP server (OAuth) + a skill that converges on it when you ask to publish or share written work.",
"version": "0.2.0",
"version": "0.3.0",
"author": {
"name": "Cofoundy SAC"
},
Expand Down
28 changes: 27 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,10 @@ plugins/basalt/
├── .mcp.json # the Basalt MCP server (HTTP + per-user OAuth)
├── commands/basalt.md # the /basalt command
├── skills/basalt/SKILL.md # the auto-invoking skill (its description is the magic)
└── hooks/ # three session-boundary hooks (silence by default)
├── hooks/ # three session-boundary hooks (silence by default)
│ └── register.tsx # + the links band (a Claude Code function-hooks module)
├── types/index.d.ts # the band's state contract
└── tests/ # `claude plugin test plugins/basalt`
```

The plugin holds **no secrets** — it points at the public MCP endpoint and auth is
Expand All @@ -117,6 +120,29 @@ so you don't have to silence the whole vault to quiet one file. Every hook ships
tests that run against **real captured Claude Code payloads** (`hooks/tests/run.sh`) —
a silent hook is worthless if it's silently dead.

## The links band (every doc of the session, one key away)

Agents publish docs mid-conversation, and the URL scrolls away with the chat. The band
above the prompt keeps them: every `app.basalt.cofoundy.ai` link that enters the
session — from the CLI, the MCP, the model's own text or a subagent — lands there.

```
⬣ basalt 5 docs basalt-pm › … › v3.1-collaboration-…-review-loop-final [ Abrir ] [ Copiar ] [ Todos ]
```

`o` opens the latest doc in your browser, `c` copies its URL, `l` (or `/basalt-links`)
opens a side pane with every doc of the session. The pane stays pinned across reloads
and sessions until you close it. Long nested names keep the title (cut in the middle,
so its version suffix survives), then the space, then the nearest folders.

The mark is the real logo where the surface can draw it: the SVG on the desktop app,
a PNG on kitty or Ghostty run directly, and `⬣` in Molten elsewhere (inside tmux,
screen, zellij or herdr Claude Code draws no pictures).

It is a function-hooks module
(early access in Claude Code); clients without it keep the three shell hooks above,
unchanged.

## Already have docs in git?

Use the [`basalt` CLI](https://www.npmjs.com/package/basalt-cli) instead — it syncs a
Expand Down
5 changes: 3 additions & 2 deletions plugins/basalt/.claude-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "basalt",
"description": "Connect your AI to Basalt — publish, update and share governed docs by URL. Bundles the Basalt MCP server (OAuth), a skill that converges on it when you ask to publish or share written work, and quiet session hooks (auth probe · edit tracking · publish nudge).",
"version": "0.2.0",
"version": "0.3.0",
"author": {
"name": "Cofoundy SAC",
"url": "https://cofoundy.dev"
Expand All @@ -19,5 +19,6 @@
"ai-agents",
"share-docs",
"markdown"
]
],
"types": "./types/index.d.ts"
}
5 changes: 4 additions & 1 deletion plugins/basalt/hooks/hooks.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,8 @@
]
}
]
}
},
"modules": [
"./register.tsx"
]
}
7 changes: 7 additions & 0 deletions plugins/basalt/hooks/mark.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Basalt mark, from products/basalt/brand/assets: the SVG for surfaces that draw it,
// a 64 px PNG of it (basalt-mark-512.png) for terminals with the kitty graphics protocol.
export const MARK_SVG =
'<svg width="512" height="512" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg"> <g transform="translate(256.00,395.05) scale(0.9521)"> <path d="M 100.00,-292.10 L 50.00,-205.50 L 50.00,-0.00 L 100.00,-86.60 Z" fill="#4A5059" stroke="#1A1C20" stroke-width="5.50" stroke-linejoin="miter"/> <path d="M 50.00,-205.50 L -50.00,-205.50 L -50.00,0.00 L 50.00,-0.00 Z" fill="#3A3F47" stroke="#1A1C20" stroke-width="5.50" stroke-linejoin="miter"/> <path d="M -50.00,-205.50 L -100.00,-292.10 L -100.00,-86.60 L -50.00,0.00 Z" fill="#2A2E34" stroke="#1A1C20" stroke-width="5.50" stroke-linejoin="miter"/> <path d="M 100.00,-292.10 L 50.00,-205.50 L -50.00,-205.50 L -100.00,-292.10 L -50.00,-378.71 L 50.00,-378.71 Z" fill="#E2603B" stroke="#1A1C20" stroke-width="5.50" stroke-linejoin="miter"/> <path d="M -42.00,-140.40 L -92.00,-53.80 L -92.00,86.60 L -42.00,0.00 Z" fill="#4A5059" stroke="#1A1C20" stroke-width="5.50" stroke-linejoin="miter"/> <path d="M -92.00,-53.80 L -192.00,-53.80 L -192.00,86.60 L -92.00,86.60 Z" fill="#3A3F47" stroke="#1A1C20" stroke-width="5.50" stroke-linejoin="miter"/> <path d="M -192.00,-53.80 L -242.00,-140.40 L -242.00,0.00 L -192.00,86.60 Z" fill="#2A2E34" stroke="#1A1C20" stroke-width="5.50" stroke-linejoin="miter"/> <path d="M -42.00,-140.40 L -92.00,-53.80 L -192.00,-53.80 L -242.00,-140.40 L -192.00,-227.00 L -92.00,-227.00 Z" fill="#F4F5F3" stroke="#1A1C20" stroke-width="5.50" stroke-linejoin="miter"/> <path d="M 242.00,-140.40 L 192.00,-53.80 L 192.00,86.60 L 242.00,0.00 Z" fill="#4A5059" stroke="#1A1C20" stroke-width="5.50" stroke-linejoin="miter"/> <path d="M 192.00,-53.80 L 92.00,-53.80 L 92.00,86.60 L 192.00,86.60 Z" fill="#3A3F47" stroke="#1A1C20" stroke-width="5.50" stroke-linejoin="miter"/> <path d="M 92.00,-53.80 L 42.00,-140.40 L 42.00,0.00 L 92.00,86.60 Z" fill="#2A2E34" stroke="#1A1C20" stroke-width="5.50" stroke-linejoin="miter"/> <path d="M 242.00,-140.40 L 192.00,-53.80 L 92.00,-53.80 L 42.00,-140.40 L 92.00,-227.00 L 192.00,-227.00 Z" fill="#F4F5F3" stroke="#1A1C20" stroke-width="5.50" stroke-linejoin="miter"/> </g></svg>'

export const MARK_PNG =
'iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAQKADAAQAAAABAAAAQAAAAABGUUKwAAAMrklEQVR4Ae0beZBT5f2X+9gke4fdJQvL2mq3W0FbOrbi0VrGq6MOtE51WhHcEbW0YG1HLR6gVUarg0IFEeUoOChoh0qt46AieBSo4DqULRWUZc9kk90cm+Tl5e7v93aj7yXvSjb0j8o3k833vu93X9/xsgBn2hkLnLHAV9kCmv+F8rbGqW1TLPq7LVrQquEXy0CmN5b6Y8Tdc0wN/ERg9BNBVomrOavC8Piqb9ddU2fUQiYrj6VFlwwnMvCbj4drOwGuQ2gFDHl6SrM6JYCJzuvqmq5Z/PWqZVc1WjR6VM6i08h+zDjfZNFBIp09+92I7uMsEz4+URnk8E+zAZqsl021bbunrbqBhCDvkzuVPmkEONtu1BwNptq7h01bAMJJOSUmMqcqJ0tlUNNovG3+WY7pDoNGMfT5PMhQhLMAcYkGf67c/dNnAEvt5CsbzPf+yGmGOLm0yEY4lyHulY3me8FS4yoSXTX4aTNAa739/o6zKp3EoHj1x3AIt6O10tla77hPtUZFAp4eAziavzun2bbg3EoDJJTKvozAhEs0iBYgTRnQkqdOhwG0MyeZHp3X4jAlJ6B8TiOiQbRmTjKuwLGyy1vuVUBXUT/lpiXnVP72ojoTej+nRunflD41uH9A3Vs/CBu7k0zoKD6UklWiQpTXopampu/Vm1fOnVwBbAmFT1RCHCRacyZbgWgD8pCCK2W8rAYwm0xafyJlCiYzQDu6cjWiRTSJttmULavMZSVWY9Vk+1lNZtOpCBjKaAG9RgN/7mXAC5aMRaMpW/iTg8pqgBiwYDMb4Q1fCjoDcTCWwQhEo9Mfg/fYCqirqgKWDZQrs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PXzxNiDETjdKb3a1+v3c/b6qkrtc7sD8ei23lfhihsiCSsbJUfwZ6e8KhEcGyly+EvAEGBkZSifhDxJzqgZoPbaBCQf9wko08nM+s1OdMmn0YX7MP08qkRgaCoR1nJBR6KBwOy268FKtLe3u7MTDK7MAzeQTP4SrCOVuDvxL5x2D/qcdKVVgMr8nVci/KcCGmo19sXjCmAX06lbJXOazXd3V1Ff8DBwExfKhuba3MH5N5NrhcLovMfElTLS0tZkQU/ZGDGMEiZRYjcWbsjAW+Chb4L4a2YLN94TiHAAAAAElFTkSuQmCC'
231 changes: 231 additions & 0 deletions plugins/basalt/hooks/register.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,231 @@
import { atom, read, update } from 'claude-code'
import type { EngineInterface, Register } from 'claude-code'

import { MARK_PNG, MARK_SVG } from './mark'

import type { BasaltLink } from '../types'

// Basalt brand tokens (products/basalt/tokens/colors.css). Dark-first:
// Molten is the one ember (the mark, nothing else), Signal Teal is links.
const MOLTEN = '#E2603B'
const ASH = '#F4F5F3'
const MUTED = '#7C828B' // stone-400: metadata on dark
const TEAL = '#3FB6A8'
const COLUMN = '#3A3F47' // column grey: the chip behind the wordmark
const STONE = '#B8BDC4' // stone-300: secondary text on dark

const PANE = 'basalt-links'
const URL_RE = /https:\/\/app\.basalt\.cofoundy\.ai\/[^\s)\]"'<>`\\]+/g
// What the band's fixed parts take: "⬣ basalt · 12 docs · " + the four buttons.
const BAND_CHROME = 24 + 44
const links = atom({ plugin: 'basalt', key: 'links' } as const, [])

// Junta todos los strings de un content (texto del modelo, tool results, anidados).
const strings = (value: unknown, out: string[] = []): string[] => {
if (typeof value === 'string') out.push(value)
else if (Array.isArray(value)) value.forEach(v => strings(v, out))
else if (value && typeof value === 'object') Object.values(value).forEach(v => strings(v, out))

return out
}

// Canonical URLs are /{workspace}/{space}/{doc…}; the workspace is always the
// same for one person, so the trail starts at the space.
export const toLink = (url: string, by: string, at: number): BasaltLink => {
const segments = new URL(url).pathname.split('/').filter(Boolean).map(decodeURIComponent)
const trail = segments.length >= 3 ? segments.slice(1) : segments
const title = trail[trail.length - 1] ?? url

return { url, title, trail: trail.slice(0, -1), by, at }
}

// Rows stored by an earlier version of this mod carry no trail.
const fresh = (link: BasaltLink) => (Array.isArray(link.trail) ? link : toLink(link.url, link.by, link.at))

const cut = (text: string, room: number) => {
if (text.length <= room) return text
const keep = Math.max(1, room - 1)
const head = Math.ceil(keep / 2)

return text.slice(0, head) + '…' + text.slice(text.length - (keep - head))
}

// Fits "space › folder › title" into `room` cells: the title always survives
// (cut in the middle, so its start and its version suffix stay), then the
// nearest folders, and whatever does not fit collapses to "…".
// Fits "space › folder › title" into `room` cells. Priority: the title (cut in
// the middle, so its start and its version suffix stay), then the space, then
// the nearest folders; the folders that do not fit collapse to "…".
export const crumb = (link: BasaltLink, room: number) => {
const trail = link.trail
const space = trail[0]
// The space keeps its place beside the title unless the room is too small for both.
const reserve = space === undefined ? 0 : trail.length > 1 ? space.length + 7 : space.length + 3
const title = cut(link.title, Math.max(16, room - reserve))
let left = room - title.length
const whole = trail.reduce((sum, part) => sum + part.length + 3, 0)
if (whole <= left) return { path: trail.map(part => part + ' › ').join(''), title }
left -= 4 // "… › "
const folders = trail.slice(1)
const head = space !== undefined && space.length + 3 <= left ? [space] : []
left -= head.reduce((sum, part) => sum + part.length + 3, 0)
const near: string[] = []
for (const part of [...folders].reverse()) {
if (part.length + 3 > left) break
near.unshift(part)
left -= part.length + 3
}

return { path: [...head, '…', ...near].map(part => part + ' › ').join(''), title }
}

async function openUrl($: EngineInterface, url: string) {
const mac = await $.process.run(['open', url]).catch(() => ({ exitCode: 1 }))
if (mac.exitCode !== 0) await $.process.run(['xdg-open', url]).catch(() => undefined)
}

// The pane stays open across reloads and sessions until the person closes it.
async function openPane($: EngineInterface, focus?: true) {
await $.store.set('isPinned', true)
await $.ui.open({ id: PANE, title: 'Basalt · docs de la sesión', ...(focus ? { focus } : {}) })
}

async function copyUrl($: EngineInterface, url: string, surface: Parameters<EngineInterface['ui']['copy']>[0]['surface']) {
await $.ui.copy({ text: url, surface })
$.ui.toast('Link copiado')
}

// Whether this terminal shows kitty graphics: kitty or Ghostty, run directly.
// A multiplexer (tmux, screen, herdr) passes none through, and there `Image`
// would draw its alt dim, so the glyph in Molten is the better fallback.
async function hasGraphics($: EngineInterface) {
const multiplexed = [
await $.env.get('TMUX'),
await $.env.get('STY'),
await $.env.get('HERDR_ENV'),
await $.env.get('ZELLIJ'),
].some(Boolean)
if (multiplexed) return false
const program = await $.env.get('TERM_PROGRAM')

return program === 'ghostty' || Boolean(await $.env.get('KITTY_WINDOW_ID'))
}

// The mark, best the surface can draw: the SVG on desktop, the PNG on a
// terminal with kitty graphics, and the hexagon glyph in Molten elsewhere.
async function mark($: EngineInterface, e: Parameters<EngineInterface['ui']['resolve']>[0]) {
if (e.surface === 'terminal' && (await hasGraphics($))) {
const { Image } = $.ui.resolve(e)

return <Image source={{ png: MARK_PNG }} columns={2} rows={1} alt="⬣" />
}
if (e.surface === 'desktop') {
const { Svg } = $.ui.resolve(e)

return <Svg source={MARK_SVG} alt="Basalt" width={16} height={16} />
}
const { Text } = $.ui.resolve(e)

return <Text color={MOLTEN}>⬣</Text>
}

export const register: Register = on => {
on('session.start', async ($, e, next) => {
await $.command.register({ name: 'basalt-links', description: 'Lista los docs de Basalt de esta sesión' })
if ((await $.store.get('isPinned')) === true) void openPane($)

return next(e)
})

on('command.run', { command: 'basalt-links' }, async $ => {
await openPane($)

return { text: 'Docs de Basalt de esta sesión abiertos en el panel.' }
})

// Cada fila que entra a la conversación (tuya, del modelo, de un tool, de un subagente) se escanea.
on('session.append', async ($, e, next) => {
const stored = await next(e)
const found = strings(e.message.content).flatMap(text => text.match(URL_RE) ?? [])
if (found.length > 0) {
const now = await $.clock.now()
const by = e.agentId ? 'subagente' : 'sesión'
await update($, links, list => {
const known = new Set(list.map(link => link.url))
const fresh = [...new Set(found.map(url => url.replace(/[.,;:!?]+$/, '')))]
.filter(url => !known.has(url))
.map(url => toLink(url, by, now))

return [...list, ...fresh]
})
}

return stored
})

on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
const list = (await read($, links)).map(fresh)
const last = list[list.length - 1]
if (e.props.hasSurvey || !last) return next(e)

const { Box, Button, Text } = $.ui.resolve(e)
const { path, title } = crumb(last, e.props.bodyColumns - BAND_CHROME)
const below = await next(e)

return (
<Box flexDirection="column">
<Box>
{await mark($, e)}
<Text> </Text>
<Text color={ASH} backgroundColor={COLUMN} bold> basalt </Text>
<Text> </Text>
<Text color={TEAL} bold>{list.length}</Text>
<Text color={MUTED}> doc{list.length === 1 ? '' : 's'} </Text>
<Text key="path" color={STONE}>{path}</Text>
<Text key="title" color={ASH} bold>{title} </Text>
<Button key="abrir" hotkey="o" variant="primary" label="Abrir" onPress={() => openUrl($, last.url)} />
<Text> </Text>
<Button key="copiar" hotkey="c" label="Copiar" onPress={() => copyUrl($, last.url, e.surface)} />
<Text> </Text>
<Button key="todos" hotkey="l" label="Todos" onPress={() => openPane($, true)} />
</Box>
{below}
</Box>
)
})

on('ui.close', { id: PANE }, async ($, e, next) => {
if (e.origin.kind === 'person') await $.store.set('isPinned', false)

return next(e)
})

on('ui.render', { component: 'Pane', requestId: PANE }, async ($, e) => {
const { Box, Button, Text } = $.ui.resolve(e)
const list = (await read($, links)).map(fresh)
const room = Math.max(16, e.props.bodyColumns - 2)

return (
<Box flexDirection="column">
{list.length === 0 && <Text color={MUTED}>Ningún doc de Basalt en esta sesión todavía.</Text>}
{[...list].reverse().map(link => {
const { path } = crumb({ ...link, title: '' }, room)

return (
<Box flexDirection="column" marginBottom={1}>
<Text color={ASH} bold wrap="truncate-middle">{link.title}</Text>
{link.trail.length > 0 && <Text color={MUTED} wrap="truncate-start">{path.replace(/ › $/, '')}</Text>}
<Text color={TEAL} wrap="truncate-middle">{link.url}</Text>
<Box>
<Button key={`o-${link.url}`} variant="primary" label="Abrir" onPress={() => openUrl($, link.url)} />
<Text> </Text>
<Button key={`c-${link.url}`} label="Copiar" onPress={() => copyUrl($, link.url, e.surface)} />
<Text color={MUTED}> · {link.by}</Text>
</Box>
</Box>
)
})}
</Box>
)
})
}
Loading
Loading