Skip to main content

AI Coding Agent Widget for Web Development - Code mutates like cosmic radiation

Project description

Cosmux

AI coding assistant that lives in your dev environment
Powered by Claude. Reads, writes, and edits your code while you work.

Cosmux Workflow

Quick StartFeaturesConfigurationHow It Works


Quick Start

npm install -D cosmux
// vite.config.ts
import { cosmux } from 'cosmux/vite'

export default defineConfig({
  plugins: [cosmux()]
})
# .env
ANTHROPIC_API_KEY=sk-ant-api03-...

Run npm run dev — the widget appears in the bottom-right corner.


Features

Feature Description
💬 Chat Interface Natural conversation with streaming responses
🧠 Extended Thinking Watch the AI reason through complex problems
📁 File Operations Read, Write, Edit files in your project
💻 Terminal Access Run shell commands via Bash tool
🔍 Code Search Glob and Grep tools for finding code
💾 Session Persistence Chat history saved locally
📖 Context-Aware Reads CLAUDE.md for project understanding

Vite Setup

Works with React, Vue, Svelte, and other Vite-based projects.

// vite.config.ts
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import { cosmux } from 'cosmux/vite'

export default defineConfig({
  plugins: [
    react(),
    cosmux()
  ]
})

The plugin automatically starts the Cosmux server and injects the widget.


Next.js Setup

// next.config.mjs
import { withCosmux } from 'cosmux/next'

export default withCosmux({
  // your existing Next.js config
})

For App Router, create a widget component:

// components/CosmuxWidget.tsx
'use client'

import { useEffect } from 'react'

export function CosmuxWidget({ port = 3333 }: { port?: number }) {
  useEffect(() => {
    if (process.env.NODE_ENV !== 'development') return

    ;(window as any).__COSMUX_CONFIG__ = { serverUrl: `http://localhost:${port}` }

    const script = document.createElement('script')
    script.src = `http://localhost:${port}/static/inject.js`
    script.async = true
    document.body.appendChild(script)

    return () => { script.remove() }
  }, [port])

  return null
}
// app/layout.tsx
import { CosmuxWidget } from '@/components/CosmuxWidget'

export default function RootLayout({ children }) {
  return (
    <html>
      <body>
        {children}
        <CosmuxWidget />
      </body>
    </html>
  )
}

Configuration

Plugin Options

cosmux({
  port: 3333,           // Server port (default: 3333)
  autoStart: true,      // Auto-start server (default: true)
  injectWidget: true,   // Inject widget script (default: true)
  workspace: './',      // Workspace path (default: cwd)
})

Environment Variables

Variable Description Default
ANTHROPIC_API_KEY Your Anthropic API key Required
COSMUX_PORT Server port 3333
COSMUX_MODEL Claude model claude-opus-4-5-20251101

Project Context

Create a CLAUDE.md file in your project root to give the AI context:

# My Project

## Tech Stack
- React 18 + TypeScript
- Tailwind CSS

## Code Style
- Use functional components
- Prefer named exports

CLI

Run Cosmux standalone:

npx cosmux serve                        # Start server
npx cosmux serve --port 4000            # Custom port
npx cosmux serve --workspace ./project  # Specific workspace

Manual Integration

For projects without Vite or Next.js:

<script>
  window.__COSMUX_CONFIG__ = { serverUrl: 'http://localhost:3333' };
</script>
<script src="http://localhost:3333/static/inject.js"></script>
npx cosmux serve

How It Works

  1. Install — Downloads a platform-specific binary
  2. Configure — Plugin starts the server automatically
  3. Develop — Widget injects into your dev HTML
  4. Code — AI reads and modifies files in your workspace

All file operations happen locally. Your code is only sent to Claude's API for processing.


Troubleshooting

Widget doesn't appear?
  • Check that the server is running (look for "Cosmux server ready" in terminal)
  • Verify your API key is set in .env
  • Try opening http://localhost:3333/widget directly
Server won't start?
  • Check if port 3333 is in use: lsof -i :3333
  • Try a different port: cosmux({ port: 4000 })
Binary download failed?
  • Install via pip as fallback: pip install cosmux

Requirements


License

MIT — see LICENSE


ContributingIssues

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cosmux-0.1.2.tar.gz (1.3 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cosmux-0.1.2-py3-none-any.whl (1.3 MB view details)

Uploaded Python 3

File details

Details for the file cosmux-0.1.2.tar.gz.

File metadata

  • Download URL: cosmux-0.1.2.tar.gz
  • Upload date:
  • Size: 1.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for cosmux-0.1.2.tar.gz
Algorithm Hash digest
SHA256 1fb8c2b510ace65e7a336aba43b8b12a535e03b0e52322b553fdd84b9db54f8a
MD5 aca0aef879d3807af21bd706e4473f97
BLAKE2b-256 432f3f52bece0a2ad05e12afcba3144446f8948e27edbcb594f987564de745e3

See more details on using hashes here.

Provenance

The following attestation bundles were made for cosmux-0.1.2.tar.gz:

Publisher: publish-pypi.yml on techdivision-rnd/cosmux

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cosmux-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: cosmux-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 1.3 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for cosmux-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d93deb5a5a246d305cdaf5a8f3132b7c9bb7b081e54cdac548054a46ae8f360e
MD5 51b5a6fdd6d82bd0014967fab6cf143e
BLAKE2b-256 e629aea1bf7f914ffd00bad21d61d37981a8640cd84e9bab82f4bffd55e15aca

See more details on using hashes here.

Provenance

The following attestation bundles were made for cosmux-0.1.2-py3-none-any.whl:

Publisher: publish-pypi.yml on techdivision-rnd/cosmux

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page