Name | cligent JSON |
Version |
0.1.0
JSON |
| download |
home_page | None |
Summary | Chat Parser Library for parsing AI agent conversation logs |
upload_time | 2025-08-27 08:10:54 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.8 |
license | AGPL-3.0 |
keywords |
agent
ai
chat
conversation
logs
parser
|
VCS |
 |
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# Cligent - Chat Parser Library
A Python library for parsing AI agent conversation logs, with specialized support for Claude AI conversations.
## Installation
```bash
pip install cligent
```
## Features
- Parse AI conversation logs from JSONL format
- Support for multi-turn conversations with user, assistant, and system messages
- Handle tool usage and function calls in conversations
- Filter and process Claude-specific message formats
- Export conversations to YAML format
- Robust error handling for malformed logs
## Quick Start
```python
from cligent import ChatParser
# Initialize parser with a project directory
parser = ChatParser("/path/to/project")
# Parse all conversation logs
chats = parser.parse_logs()
# Access individual messages
for chat in chats:
print(f"Chat ID: {chat.id}")
print(f"Messages: {len(chat.messages)}")
for message in chat.messages:
print(f" {message.role}: {message.content[:100]}...")
```
## Advanced Usage
### Working with specific stores
```python
from cligent import ChatParser, LogStore
# Parse logs from specific Claude Code conversations
parser = ChatParser("/path/to/project")
# Get available stores
stores = parser.list_stores()
# Parse logs from a specific store
store = LogStore("project_name", "/path/to/logs")
chats = parser.parse_logs(stores=[store])
```
### Exporting to YAML
```python
from cligent import ChatParser
parser = ChatParser("/path/to/project")
chats = parser.parse_logs()
# Export to YAML format
yaml_output = parser.export_yaml(chats)
print(yaml_output)
```
### Error Handling
```python
from cligent import ChatParser, ChatParserError, LogCorruptionError
try:
parser = ChatParser("/path/to/project")
chats = parser.parse_logs()
except LogCorruptionError as e:
print(f"Log file corrupted: {e}")
except ChatParserError as e:
print(f"Parser error: {e}")
```
## API Reference
### Core Classes
- `ChatParser`: Main parser class for processing conversation logs
- `Chat`: Represents a complete conversation
- `Message`: Individual message within a conversation
- `LogStore`: Represents a storage location for conversation logs
### Exceptions
- `ChatParserError`: Base exception for all parser errors
- `ParseError`: Error during parsing operations
- `LogAccessError`: Error accessing log files
- `LogCorruptionError`: Corrupted or malformed log file
- `InvalidFormatError`: Invalid message format
## License
This project is licensed under the GNU Affero General Public License v3.0 - see the LICENSE file for details.
## Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Raw data
{
"_id": null,
"home_page": null,
"name": "cligent",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "agent, ai, chat, conversation, logs, parser",
"author": null,
"author_email": "Jinglei Ren <jinglei@merico.ai>",
"download_url": "https://files.pythonhosted.org/packages/cb/34/6eb1a769c20431b52383c2cd9a2d4da1e37905f94f3774f50982aa0c28aa/cligent-0.1.0.tar.gz",
"platform": null,
"description": "# Cligent - Chat Parser Library\n\nA Python library for parsing AI agent conversation logs, with specialized support for Claude AI conversations.\n\n## Installation\n\n```bash\npip install cligent\n```\n\n## Features\n\n- Parse AI conversation logs from JSONL format\n- Support for multi-turn conversations with user, assistant, and system messages\n- Handle tool usage and function calls in conversations\n- Filter and process Claude-specific message formats\n- Export conversations to YAML format\n- Robust error handling for malformed logs\n\n## Quick Start\n\n```python\nfrom cligent import ChatParser\n\n# Initialize parser with a project directory\nparser = ChatParser(\"/path/to/project\")\n\n# Parse all conversation logs\nchats = parser.parse_logs()\n\n# Access individual messages\nfor chat in chats:\n print(f\"Chat ID: {chat.id}\")\n print(f\"Messages: {len(chat.messages)}\")\n \n for message in chat.messages:\n print(f\" {message.role}: {message.content[:100]}...\")\n```\n\n## Advanced Usage\n\n### Working with specific stores\n\n```python\nfrom cligent import ChatParser, LogStore\n\n# Parse logs from specific Claude Code conversations\nparser = ChatParser(\"/path/to/project\")\n\n# Get available stores\nstores = parser.list_stores()\n\n# Parse logs from a specific store\nstore = LogStore(\"project_name\", \"/path/to/logs\")\nchats = parser.parse_logs(stores=[store])\n```\n\n### Exporting to YAML\n\n```python\nfrom cligent import ChatParser\n\nparser = ChatParser(\"/path/to/project\")\nchats = parser.parse_logs()\n\n# Export to YAML format\nyaml_output = parser.export_yaml(chats)\nprint(yaml_output)\n```\n\n### Error Handling\n\n```python\nfrom cligent import ChatParser, ChatParserError, LogCorruptionError\n\ntry:\n parser = ChatParser(\"/path/to/project\")\n chats = parser.parse_logs()\nexcept LogCorruptionError as e:\n print(f\"Log file corrupted: {e}\")\nexcept ChatParserError as e:\n print(f\"Parser error: {e}\")\n```\n\n## API Reference\n\n### Core Classes\n\n- `ChatParser`: Main parser class for processing conversation logs\n- `Chat`: Represents a complete conversation\n- `Message`: Individual message within a conversation\n- `LogStore`: Represents a storage location for conversation logs\n\n### Exceptions\n\n- `ChatParserError`: Base exception for all parser errors\n- `ParseError`: Error during parsing operations\n- `LogAccessError`: Error accessing log files\n- `LogCorruptionError`: Corrupted or malformed log file\n- `InvalidFormatError`: Invalid message format\n\n## License\n\nThis project is licensed under the GNU Affero General Public License v3.0 - see the LICENSE file for details.\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.",
"bugtrack_url": null,
"license": "AGPL-3.0",
"summary": "Chat Parser Library for parsing AI agent conversation logs",
"version": "0.1.0",
"project_urls": {
"Homepage": "https://github.com/sublang-ai/cligent",
"Issues": "https://github.com/sublang-ai/cligent/issues",
"Repository": "https://github.com/sublang-ai/cligent.git"
},
"split_keywords": [
"agent",
" ai",
" chat",
" conversation",
" logs",
" parser"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "46ef3c9c5dae1d31100a5353d1477410de25ec49f03bd66645e906b524238fe1",
"md5": "63eae712c53e250a759e7286029ed04a",
"sha256": "c9a26ca73369ef059e5903e1d0dcef292e75d596accc801ad2bb9b5c7d8fa520"
},
"downloads": -1,
"filename": "cligent-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "63eae712c53e250a759e7286029ed04a",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 12292,
"upload_time": "2025-08-27T08:10:52",
"upload_time_iso_8601": "2025-08-27T08:10:52.494598Z",
"url": "https://files.pythonhosted.org/packages/46/ef/3c9c5dae1d31100a5353d1477410de25ec49f03bd66645e906b524238fe1/cligent-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "cb346eb1a769c20431b52383c2cd9a2d4da1e37905f94f3774f50982aa0c28aa",
"md5": "66bf5ba53163b4f19669a77107345d8b",
"sha256": "75d1535011bc138b5f980de275588cf18d2bf83ed2b87c08347f69ca15d68ff9"
},
"downloads": -1,
"filename": "cligent-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "66bf5ba53163b4f19669a77107345d8b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 9671,
"upload_time": "2025-08-27T08:10:54",
"upload_time_iso_8601": "2025-08-27T08:10:54.086886Z",
"url": "https://files.pythonhosted.org/packages/cb/34/6eb1a769c20431b52383c2cd9a2d4da1e37905f94f3774f50982aa0c28aa/cligent-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-27 08:10:54",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "sublang-ai",
"github_project": "cligent",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "cligent"
}