spacehub

surshar / claude-code

Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.

Built by Anthropic · github.com/anthropics

claude-code / mods / sec-default / tests / fixtures / noting.ts
GitHub Actions (publish-mods)chore: Update mods/ 3deb873 · 14 days ago History
26 lines · 725 BRaw
1import type { Plugin } from 'claude-code/testing'
2
3/**
4 * A plugin that appends a note of its own to the conversation when the
5 * session starts, and logs what was kept of it, in the tier given: the
6 * person's own by default.
7 *
8 * @param name the plugin's name
9 * @param tier the tier it loads in
10 * @returns the plugin
11 */
12export const noting = (name: string, tier?: Plugin['tier']): Plugin => ({
13 name,
14 tier,
15 register(on) {
16 on('session.start', async ($, e, next) => {
17 const kept = await $.session.append({
18 message: { type: 'user', content: [{ type: 'text', text: 'a note' }] },
19 })
20
21 await $.ui.log(JSON.stringify(kept.message?.content ?? kept.deny))
22
23 return next(e)
24 })
25 },
26})