DenchClaw

repository·main·Indexed 23 days ago

https://github.com/denchhq/denchclaw

An AI CRM framework built on OpenClaw for managing CRM, sales automation, and outreach agents. Designed for local hosting, it provides a Web UI for managing workspaces, object tables, and AI chat. Version 4.0.0 requires Node.js 22 or higher.

Tokens
98.9K
Snippets
188
Records
401
Agent score
82%

What's inside denchclaw

  1. Explore DenchClaw App Builder child skills

    main

    The app-builder skill is a parent skill. For specialized functionality, refer to the following child skills located in skills/app-builder/<child>/SKILL.md:

    • Game Builder: 2D (p5.js) and 3D (Three.js) games, physics (Matter.js), audio, sprites, and game state machines.
    • Data Builder: Workspace CRUD (dench.objects.*), DuckDB queries (dench.db.*), and dashboards (Chart.js/D3.js).
    • Agent Builder: AI chat API (dench.chat.*), streaming, and agent memory.
    • Platform API: UI integration (dench.ui.*), KV store (dench.store.*), HTTP proxy (dench.http.*), real-time events (dench.events.*), and more.
  2. Build 2D and 3D games with the game-builder skill

    main

    The game-builder skill allows you to develop 2D and 3D games as DenchClaw apps. It provides guidance and patterns for using various game libraries including:

    • p5.js: For 2D games and creative coding.
    • Three.js: For 3D games and experiences.
    • Matter.js: For 2D physics integration.
    • DuckDB: For high score persistence.

    For fundamental app structure, manifest references, and the bridge API, refer to the parent app-builder skill.

  3. Use the Office Hours skill to reframe product ideas

    main

    The office-hours skill is a YC-style reframing tool used to understand the real problem behind a feature request before development begins. It operates in two distinct modes based on the user's goal:

    1. Startup Mode: Used when building for users, revenue, or growth. It uses a series of six forcing questions to validate demand and find a 'narrowest wedge'.
    2. Builder Mode: Used for side projects, hackathons, or learning exercises where the focus is on curiosity and the joy of building.

    Use this skill when you need to brainstorm, explore an idea, or before performing any planning tasks. The output of this skill is a Design Doc that serves as a prerequisite for plan-ceo-review and plan-eng-review.

  4. Land and Deploy workflow

    main
    The land-and-deploy skill manages the transition from an approved Pull Request to a verified production deployment. It follows a five-step lifecycle: performing pre-merge checks, merging the PR, monitoring the deployment process, verifying production health, and generating a post-deploy report. This skill is intended to be used immediately after the ship skill has completed.
  5. Use the ship skill for release engineering

    main
    The ship skill automates the workflow from 'code complete' to 'PR ready for review'. It handles syncing with the base branch, running the project's test suite, performing a coverage audit on changed files, pushing the branch, and creating a GitHub Pull Request. This skill is designed to act as a release engineer to ensure code quality and coverage before human review.
  6. Benchmark performance and catch regressions

    main

    The benchmark skill is used to establish performance baselines and detect regressions in Core Web Vitals, page load times, bundle sizes, and resource usage. It is designed to be run on every Pull Request to catch bundle size increases or performance degradation before they are shipped.

    Key Metrics to Monitor

    • Core Web Vitals:
      • LCP (Largest Contentful Paint): Target < 2.5s
      • FID (First Input Delay): Target < 100ms
      • CLS (Cumulative Layout Shift): Target < 0.1
    • Page Load: TTFB, DOMContentLoaded, Load event, and Full page load.
    • Bundle Size: JavaScript (compressed/uncompressed), CSS, Total transfer size, and Number of requests.
    • Resource Analysis: Largest assets, uncompressed assets, unused JavaScript, and image optimization opportunities.
  7. Overview of the DenchClaw Bridge API

    main

    The Bridge SDK is automatically injected into every app's HTML via the window.dench object. It provides various namespaces to interact with the platform, databases, agents, and UI. All methods return Promises and have a 30-second timeout. Accessing these namespaces requires specific permissions defined in your app manifest.

    | Namespace         | Permission                    | Methods                                                                                              | Details In        |
    | ----------------- | ----------------------------- | ---------------------------------------------------------------------------------------------------- | ----------------- |
    | `dench.db`        | `database` / `database:write` | `query(sql)`, `execute(sql)`                                                                         | **data-builder**  |
    | `dench.objects`   | `objects`                     | `list()`, `get()`, `create()`, `update()`, `delete()`, `bulkDelete()`, `getSchema()`, `getOptions()` | **data-builder**  |
    | `dench.files`     | `files` / `files:write`       | `read()`, `list()`, `write()`, `delete()`, `mkdir()`                                                 | below             |
    | `dench.app`       | _(none)_                      | `getManifest()`, `getTheme()`                                                                        | below             |
    | `dench.chat`      | `agent`                       | `createSession()`, `send()`, `getHistory()`, `getSessions()`, `abort()`, `isActive()`                | **agent-builder** |
    | `dench.agent`     | `agent`                       | `send(message)`                                                                                      | **agent-builder** |
    | `dench.tool`      | `agent`                       | `register(name, handler)`                                                                            | **agent-builder** |
    | `dench.memory`    | `agent`                       | `get()`                                                                                              | **agent-builder** |
    | `dench.ui`        | `ui`                          | `toast()`, `navigate()`, `openEntry()`, `setTitle()`, `confirm()`, `prompt()`                        | **platform-api**  |
    | `dench.store`      | `store`                       | `get()`, `set()`, `delete()`, `list()`, `clear()`                                                     | **platform-api**  |
    | `dench.http`      | `http`                        | `fetch(url, opts)`                                                                                    | **platform-api**  |
    | `dench.events`    | `events`                      | `on(channel, cb)`, `off(channel)`                                                                     | **platform-api**  |
    | `dench.context`   | _(none)_                      | `getWorkspace()`, `getAppInfo()`                                                                      | **platform-api**  |
    | `dench.apps`      | `apps`                        | `send()`, `on()`, `list()`                                                                           | **platform-api**  |
    | `dench.cron`      | `cron`                        | `schedule()`, `list()`, `run()`, `cancel()`                                                           | **platform-api**  |
    | `dench.webhooks`  | `webhooks`                    | `register()`, `on()`, `poll()`                                                                       | **platform-api**  |
    | `dench.clipboard` | `clipboard`                   | `read()`, `write()`                                                                                  | **platform-api**  |
  8. How to use Dench Integrations connected apps

    main

    In DenchClaw, you must use the Dench Integrations tools to interact with connected applications (Gmail, Slack, GitHub, etc.). The standard workflow is to search for the appropriate tool first, inspect its schema and guidance, and then execute it.

    1. Search: Use composio_search_tools to find the tool. This is the source of truth for input_schema, connection status, recommended_plan_steps, and known_pitfalls.
    2. Inspect: Review the returned input_schema to ensure arguments match the required types, enums, and structures.
    3. Execute: Call the tool using composio_call_tool.

    Note: composio_resolve_tool is available as a compatibility wrapper for single best-match results, but ranked search via composio_search_tools is the preferred path.

    Prohibited Methods

    Do not attempt to bypass the integration layer using:

    • gog or shell CLIs for the specific app.
    • curl or raw gateway HTTP calls.
    • Direct provider REST calls.
  9. CRM Object Design Patterns

    main

    When building CRM structures, follow these standard field and relationship patterns to ensure data integrity and connectivity across the system:

    Contact/Customer

    • Fields: Full Name (text, required), Email Address (email, required), Phone Number (phone), Notes (richtext).
    • Relation: Company (relation → company, many_to_one).
    • Rule: Always link to a company if one exists.

    Lead/Prospect

    • Fields: Full Name (text, required), Email Address (email, required), Phone Number (phone), Status (enum: New/Contacted/Qualified/Converted), Source (enum: Website/Referral/Cold Call/Social), Score (number), Assigned To (user), Notes (richtext).
    • Relations: Company (relation → company, many_to_one), Deal (relation → deal, many_to_one).

    Company/Organization

    • Fields: Company Name (text, required), Industry (enum), Website (url), Type (enum: Client/Partner/Vendor), Relationship Status (enum), Notes (richtext).
    • Note: Other objects (people, deals, invoices) typically link TO company.

    Deal/Opportunity

    • Fields: Deal Name (text, required), Amount (number), Stage (enum: Discovery/Proposal/Negotiation/Closed Won/Closed Lost), Close Date (date), Probability (number), Assigned To (user), Notes (richtext).
    • Relations: Primary Contact (relation → people, many_to_one), Company (relation → company, many_to_one).
    • Rule: Always link to BOTH contact and company.

    Task/Activity (Kanban)

    • Fields: Title (text, required), Description (text), Assigned To (user), Due Date (date), Status (enum: In Queue/In Progress/Done), Priority (enum: Low/Medium/High), Notes (richtext).
    • Relation: Related To (relation → contextual parent, many_to_one).
    • Setup: Use default_view = 'kanban' to auto-create Status and Assigned To fields.

    Invoice/Payment

    • Fields: Invoice Number (text, required), Amount (number), Status (enum: Draft/Sent/Paid/Overdue), Due Date (date), Notes (richtext).
    • Relations: Company (relation → company, many_to_one), Deal (relation → deal, many_to_one).
  10. How DenchClaw telemetry works

    main

    DenchClaw uses a shared identity model across all its components to ensure consistent tracking.

    • Shared Identity: All layers (CLI, Web App, and Plugins) read the same anonymousId from ~/.openclaw-dench/telemetry.json. The first component to run (typically the CLI during denchclaw bootstrap) generates this UUID, which is then reused by all subsequent layers.
    • CLI: Uses the posthog-node SDK. Events are batched and flushed asynchronously to ensure telemetry never blocks CLI operations.
    • Web App (Server): API route handlers use trackServer() via the posthog-node SDK, utilizing the persisted install ID.
    • Web App (Client): Uses the posthog-js SDK. The server bootstraps the client with the install ID so the browser shares the same PostHog identity. Note that no cookies are set; session data is stored in memory only.
    • OpenClaw Plugin: The @denchclaw/posthog-analytics plugin runs in-process with the OpenClaw Gateway. It reads the persisted install ID and hooks into agent lifecycle events to emit PostHog AI events.
    • Security: The PostHog project token (phc_...) is embedded in built artifacts as a write-only token. It can only send events and cannot be used to read dashboards or analytics data.
  11. SQL query rules for report panels

    main

    When writing the sql property for a report panel, follow these strict rules to ensure compatibility with the PIVOT views and DuckDB:

    1. Use PIVOT views: Always query the auto-generated v_{object} views (e.g., v_deal) instead of raw EAV tables.
    2. Read-only: SQL must be SELECT-only. No INSERT, UPDATE, or DELETE.
    3. Numeric Casting: Explicitly cast numeric fields using "Field"::NUMERIC or CAST("Field" AS NUMERIC).
    4. Time-series: Use DATE_TRUNC('month', column_name) for grouping time-based data.
    5. Ordering: Always include an ORDER BY clause for consistent rendering.
    6. Aggregates: Use standard functions like COUNT(*), SUM(...), AVG(...), MIN(...), or MAX(...).
    7. Quoting: Double-quote field names that contain spaces (e.g., "Full Name", "Assigned To").
    8. Verification: Before writing the report, verify the view exists by running SELECT COUNT(*) FROM v_{object}.