Claudian

repository·main·Indexed 11 days ago

https://github.com/yishentu/claudian

An Obsidian plugin that embeds AI coding agents such as Claude Code, Codex, Grok, OpenCode, and Pi directly into your vault. It allows agents to interact with local files, execute bash commands, and perform multi-step workflows. Key features include inline editing with diff previews, slash commands, @mentions for vault files, and MCP server integration. Requires Obsidian v1.7.2+ on desktop (macOS, Linux, Windows).

Tokens
20.5K
Snippets
56
Records
83
Agent score
94%

What's inside Claudian

  1. Overview of Claudian

    main

    Claudian is an Obsidian plugin that embeds AI coding agents (such as Claude Code, Codex, Grok, Opencode, and Pi) directly into your Obsidian vault. It turns your vault into a working directory for the agent, allowing it to perform file read/write, search, bash commands, and multi-step workflows.

    Key features include:

    • Inline Edit: Edit notes directly with word-level diff previews using hotkeys.
    • Slash Commands & Skills: Use / or $ for reusable prompt templates and skills.
    • @mention: Reference vault files, subagents, or external files using @.
    • Plan Mode: Toggle with Shift+Tab to let the agent design a plan before implementation.
    • Instruction Mode: Add custom instructions using # in the chat input.
    • MCP Servers: Connect external tools via the agent's native CLI-managed MCP configuration.
    • Session Management: Manage multiple tabs or persistent sessions in dual-pane mode.
  2. Install Claudian from source (Development)

    main

    To install Claudian from source for development purposes, clone the repository into your vault's plugins folder and build it using npm.

    1. Clone the repository:
    cd /path/to/vault/.obsidian/plugins
    git clone https://github.com/YishenTu/claudian.git
    cd claudian
    1. Install dependencies and build:
    npm install
    npm run build
    1. Enable the plugin in Obsidian via SettingsCommunity plugins.
    cd /path/to/vault/.obsidian/plugins
    git clone https://github.com/YishenTu/claudian.git
    cd claudian
    npm install
    npm run build
  3. Install Claudian via Obsidian Community Plugins

    main

    The recommended way to install Claudian is through the Obsidian Community Plugins browser:

    1. Open ObsidianSettingsCommunity pluginsBrowse.
    2. Search for "Claudian" and click Install.
    3. Enable the plugin.
  4. Use Codex commands and skills via trigger characters

    main

    The Codex provider uses specific trigger characters to distinguish between system commands and user skills in the command dropdown:

    • Commands: Triggered using the / prefix (e.g., /compact).
    • Skills: Triggered using the $ prefix (e.g., $skill-name).

    Built-in commands like compact are available under the / prefix, while skills discovered from the Codex app server are mapped to the $ prefix.

    /* Example of how triggers are categorized */
    // Commands (Built-in)
    /compact
    
    // Skills (User/Repo)
    $skill-name
  5. Understand the AssembledTabRuntime structure

    main

    An AssembledTabRuntime represents a single, fully initialized chat tab. It is the central object containing all resources, state, and controllers for an independent chat session.

    Key properties include:

    • id: The unique TabId for the tab.
    • session: The underlying TabSession identity.
    • lifecycleState: The current runtime state ('provisional' | 'cold' | 'warm' | 'closing').
    • hydrationState: The loading state of the conversation ('idle' | 'loading' | 'ready' | 'failed').
    • controllers: A collection of TabControllers (selection, conversation, stream, etc.) for managing tab logic.
    • ui: A collection of TabUIComponents (model selectors, context trays, etc.) for the interface.
    • dom: The TabDOMElements used for rendering the tab's content and input areas.
    • state: The current ChatState for the session.
    • providerId: The ID of the active provider for this tab.
  6. Format Claude Code (CC) permission rules

    main

    Claude Code (CC) compatible permission rules are defined as strings that specify which tools are allowed, denied, or require confirmation.

    Rules follow the format Tool(pattern) or simply Tool to apply to all actions of that tool.

    Examples:

    • Bash(git *): Allows the Bash tool for any command starting with git .
    • Read(*.md): Allows the Read tool for all Markdown files.
    • WebFetch(domain:github.com): Allows the WebFetch tool specifically for the github.com domain.
    • Read: Allows the Read tool for everything.
    // Use createPermissionRule to cast a string to a PermissionRule
    const rule = createPermissionRule("Bash(git *)");
  7. Understand the SlashCommand structure for Claude SDK commands

    main

    When probeRuntimeCommands discovers commands from the Claude SDK, they are mapped to the internal SlashCommand format. Each discovered command includes:

    • id: A unique identifier prefixed with sdk: (e.g., sdk:name).
    • name: The original command name from the SDK.
    • description: The command's description.
    • argumentHint: Information about expected arguments.
    • content: An empty string (as these are discovered via the SDK probe).
    • source: Set to 'sdk' to indicate the origin.
  8. Manage TabBar expansion state

    main

    The TabBar supports expanding tab titles to show the full text instead of just the index number. This is toggled via a double-click on a badge.

    • Double-click: Toggles the expansion state of a specific tab.
    • State Persistence: You can control which tabs are expanded using setExpandedTitleTabIds(tabIds: readonly TabId[]).
    • Retrieval: Use getExpandedTitleTabIds() to see which tabs are currently in an expanded state.

    When a title is expanded, it is truncated to a maximum length of 32 characters followed by ... if it exceeds that limit.

  9. Understand ProviderCommandDiscoverySnapshot states

    main

    The ProviderCommandDiscoverySnapshot<T> represents the current state of the command discovery process. It can be one of the following:

    • { status: 'idle' }: The store is in its initial state or has been invalidated.
    • { status: 'loading' }: A discovery process is currently in progress.
    • ProviderCommandDiscoveryResult<T>: The discovery process has completed. If the status is 'ready', it contains the discovered items. If the status is 'error', it contains an error message and a retryable boolean.
  10. Understand Permission Modes for Tool Execution

    main

    The permissionMode setting determines how Claudian handles tool execution requests. It can be set to one of three values:

    • 'yolo': Likely allows automatic execution without manual intervention.
    • 'plan': Likely requires a plan or confirmation before execution.
    • 'normal': The standard permission level.
  11. Manage hidden provider commands in settings

    main

    Claudian allows you to hide specific provider commands via the hiddenProviderCommands configuration object in your ClaudianSettings. This object maps a providerId to an array of command names that should be suppressed from the UI.

    Configuration Structure

    The hiddenProviderCommands object follows this shape:

    {
      "providerId": ["commandName1", "commandName2"]
    }

    Normalization Rules

    When providing command lists, the system applies the following normalization:

    • Trimming: Leading and trailing whitespace is removed.
    • Prefix Stripping: Leading / or $ characters are stripped from the command name.
    • Uniqueness: Duplicate commands (case-insensitive) are removed.
    • Empty Values: Providers with no valid commands are omitted from the final configuration.