Skip to content

Fix frontend backend issues #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
39 changes: 39 additions & 0 deletions .cursor/rules/agent-best-practices.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
description: Backend
globs:
alwaysApply: false
---
# Agent Backend Best Practices Rule

To ensure easy, non-breaking development in the agent backend (`/agent`), follow these guidelines:

## Project Structure
- The main agent logic is in .@`mcp_agent\agents.py`
- Add new agent logic or workflows as new nodes in the workflow graph.
- Place supporting scripts (e.g., math server) in the agent directory (e.g., [`math_server.py`](mdc:agent/math_server.py)).

## Extensibility
- Use the `MCPConfig` pattern to add new tools or servers without modifying core logic.
- Extend `AgentState` for new agent/team features, but keep backward compatibility.
- Add new workflow nodes for advanced agent/team orchestration, not by modifying existing nodes.
- For advanced memory, swap `MemorySaver` for a compatible memory backend (e.g., Mem0) in a non-breaking way.

## Code Quality
- Use type hints and TypedDict for all state/config structures.
- Write docstrings for all functions and classes.
- Use camelCase for variables and PascalCase for classes.
- Prefer async/await for all agent logic.
- Log tool and agent responses for debugging.

## Backward Compatibility
- Default to existing config and memory if new features/settings are not provided.
- Never remove or rename existing config fields without a migration path.
- Test all changes with existing agent workflows before merging.

## Documentation
- Update [`README.md`](mdc:agent/README.md) with any major changes or new features.
- Document new tools, memory backends, or workflow nodes inline and in the README.

## Summary
Following these rules will help maintain a robust, extensible, and backward-compatible agent backend.

26 changes: 26 additions & 0 deletions .cursor/rules/context7-mcp-tool.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
description: use context7
globs:
alwaysApply: false
---
# Context7 MCP Tool Usage Rule

When using the context7 MCP tool, especially the `get-library-docs` action, always set the `tokens` parameter to **5000 or greater**. This is required to avoid errors and ensure successful documentation retrieval.

## Example (Correct Usage)

```json
{
"context7CompatibleLibraryID": "/mem0ai/mem0",
"tokens": 5000
}
```

## Best Practices
- Never set `tokens` below 5000 for `get-library-docs`.
- If specifying a topic, include it as a string, but always set `tokens` to at least 5000.
- Update any tool call templates or scripts to default to `tokens: 5000` or higher.

## Reference
This rule is enforced to comply with the requirements of the context7 MCP tool and prevent repeated errors in documentation retrieval.

46 changes: 46 additions & 0 deletions .cursor/rules/frontend-best-practices.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
description: frontend, ui.
globs:
alwaysApply: false
---
# Frontend Best Practices Rule

To ensure robust, bug-free development in the frontend (`/frontend`), follow these guidelines:

## Project Structure
- Main app entry and routing are in [`src/app/`](mdc:frontend/src/app).
- Reusable UI components are in [`src/components/ui/`](mdc:frontend/src/components/ui).
- Agent-specific UIs are in [`src/components/agents/`](mdc:frontend/src/components/agents).
- Global state providers are in [`src/providers/`](mdc:frontend/src/providers).
- Custom hooks are in [`src/hooks/`](mdc:frontend/src/hooks).
- Utility functions and agent config types are in [`src/lib/`](mdc:frontend/src/lib).

## Code Quality
- Use TypeScript for all files to ensure type safety.
- Write JSDoc comments for all functions and components.
- Use camelCase for variables and PascalCase for components/classes.
- Prefer async/await for asynchronous logic.
- Use React context for global state management.
- Keep components small and focused; extract logic into hooks when possible.

## UI/UX
- Use Tailwind CSS for styling; avoid inline styles.
- Ensure all UI is responsive and mobile-friendly.
- Use skeletons/loading states from [`src/components/skeletons/`](mdc:frontend/src/components/skeletons) for async data.

## Extensibility
- Register new agents in [`src/lib/available-agents.ts`](mdc:frontend/src/lib/available-agents.ts).
- Add new agent UIs in [`src/components/agents/`](mdc:frontend/src/components/agents).
- Use the agent/team creation UI (planned) for dynamic agent management.

## Testing & Debugging
- Test all new features in both development and production builds.
- Use React Query Devtools and CopilotKit Dev Console for debugging.
- Validate all forms and user input.

## Documentation
- Update [`README.md`](mdc:frontend/README.md) with any major changes or new features.

## Summary
Following these rules will help maintain a clean, scalable, and bug-resistant frontend codebase.

43 changes: 43 additions & 0 deletions .cursor/rules/fullstack-best-practices.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
description:
globs:
alwaysApply: true
---
# Fullstack Best Practices Rule

To ensure a complete, bug-free app across both frontend and backend, follow these unified guidelines:

## Project Structure
- Frontend code is in [`/frontend`](mdc:frontend/README.md), with main logic in [`src/app/`](mdc:frontend/src/app) and components in [`src/components/`](mdc:frontend/src/components).
- Backend agent code is in [`/agent`](mdc:agent/README.md), with main logic in .@`mcp_agent\agents.py`.

## Code Quality
- Use TypeScript for frontend and type hints for backend Python.
- Write JSDoc (frontend) and docstrings (backend) for all functions and classes.
- Use camelCase for variables and PascalCase for components/classes.
- Prefer async/await for all asynchronous logic.
- Keep components, functions, and modules small and focused.

## Extensibility
- Register new agents and tools via config files ([`src/lib/available-agents.ts`](mdc:frontend/src/lib/available-agents.ts) for frontend, `MCPConfig` for backend).
- Add new features as new components, hooks, or workflow nodes—avoid modifying existing logic unless necessary.
- Use context providers (frontend) and state classes (backend) for global/shared state.

## Testing & Debugging
- Test all new features in both development and production builds.
- Use React Query Devtools and CopilotKit Dev Console (frontend) and log tool/agent responses (backend).
- Validate all forms and user input.
- Add unit/integration tests for critical workflows.

## Documentation
- Update [`README.md`](mdc:frontend/README.md) and [`README.md`](mdc:agent/README.md) with any major changes or new features.
- Document new agents, tools, memory backends, or workflow nodes inline and in the README.

## Backward Compatibility
- Default to existing config and memory if new features/settings are not provided.
- Never remove or rename existing config fields without a migration path.
- Test all changes with existing workflows before merging.

## Summary
Following these rules will help maintain a robust, extensible, and bug-resistant fullstack codebase.

10 changes: 10 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions .idea/AugmentWebviewStateStore.xml

Large diffs are not rendered by default.

17 changes: 17 additions & 0 deletions .idea/KB-multi-agent.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading