Skip to content

x402agent/SolanaOS / .agents/skills/honcho-integration

honcho-integration

Verified

Integrate Honcho memory and social cognition into existing Python or TypeScript codebases. Use when adding Honcho SDK, setting up peers, configuring sessions, implementing the dialectic chat endpoint for AI agents, or wiring Honcho into bot frameworks (nanobot, openclaw, picoclaw, etc).

references/bot-frameworks/nanobot/client.py

View on GitHub
"""Honcho client initialization and configuration."""

from __future__ import annotations

import os
from dataclasses import dataclass
from typing import TYPE_CHECKING

from loguru import logger

if TYPE_CHECKING:
    from honcho import Honcho


@dataclass
class HonchoConfig:
    """Configuration for Honcho client."""

    workspace_id: str = "nanobot"
    api_key: str | None = None
    environment: str = "production"

    @classmethod
    def from_env(cls, workspace_id: str = "nanobot") -> HonchoConfig:
        """Create config from environment variables."""
        return cls(
            workspace_id=workspace_id,
            api_key=os.environ.get("HONCHO_API_KEY"),
            environment=os.environ.get("HONCHO_ENVIRONMENT", "production"),
        )


_honcho_client: Honcho | None = None


def get_honcho_client(config: HonchoConfig | None = None) -> Honcho:
    """
    Get or create the Honcho client singleton.

    Args:
        config: Optional config. If not provided, uses environment variables.

    Returns:
        Configured Honcho client.

    Raises:
        ValueError: If HONCHO_API_KEY is not set.
    """
    global _honcho_client

    if _honcho_client is not None:
        return _honcho_client

    if config is None:
        config = HonchoConfig.from_env()

    if not config.api_key:
        raise ValueError(
            "HONCHO_API_KEY environment variable is required. "
            "Get an API key from https://app.honcho.dev"
        )

    try:
        from honcho import Honcho
    except ImportError:
        raise ImportError(
            "honcho-ai is required for Honcho integration. "
            "Install it with: nanobot honcho enable --api-key YOUR_KEY"
        )

    logger.info(f"Initializing Honcho client (workspace: {config.workspace_id})")

    _honcho_client = Honcho(
        workspace_id=config.workspace_id,
        api_key=config.api_key,
        environment=config.environment,
    )

    return _honcho_client


def reset_honcho_client() -> None:
    """Reset the Honcho client singleton (useful for testing)."""
    global _honcho_client
    _honcho_client = None
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 471kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 322kUpdated Claude CodeCodexVerifiedInstall