Skip to content

Commit 972417d

Browse files
TonsOfFunclaude
andauthored
feat: Report Composer UI and Landing Page Feature Showcase (#12)
* feat: add Report Composer UI and landing page feature showcase - Add ReportComposerAgent with compose, answer_question, and generate_section actions - Create Document Composer modal with Ask Question and Compose Section modes - Implement real-time streaming responses via ActionCable - Add citation highlighting for source references - Add feature showcase section to landing page with functional screenshots - Include CSS styling for composer modal and feature showcase 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * feat: add tech diligence agent and PDF image extraction - Add TechDiligenceAgent with VLM support for document analysis - Add PdfImageExtractor service using pdftoppm for page rendering - Add API endpoints for tech diligence (questions, pages, specs, verify) - Add API endpoints for report composer (section, answer, generate) - Extend Document model with page image blob retrieval methods - Add citation fragment types with provenance tracking - Add rake tasks for CLI testing of tech diligence features - Rebrand from Writebook to Dill throughout 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * fix: rename demo image for Dill rebranding Rename writebook-manual.jpg to dill-manual.jpg to match the updated reference in demo_content.rb 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * feat: add Project Templates feature for reusable report structures - Add ProjectTemplate model with section_schema JSON storage - Add InformationRequest model for tracking document requests - Add ProjectTemplatesController with full CRUD operations - Add template views (index, show, new, edit, form) - Add section_schema_controller.js for dynamic form building - Add save_as_template action to ReportsController - Add navigation link to templates from reports index - Add "Save as Template" button to report show page 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * feat: update landing page with new feature screenshots and Source Library integration - Add new landing page screenshots showcasing Document Composer, Source Library, and Report TOC - Add "Professional Report Structure" section to landing page - Integrate Sources with ReportComposerAgent for AI content generation - Add radio card styling for Source type selection - Fix composer modal and section preview styling issues - Update prompt templates to include SOURCE LIBRARY MATERIALS context - Add ActiveAgents demo content generator and rake task 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 5a7294c commit 972417d

74 files changed

Lines changed: 4534 additions & 324 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 14 additions & 258 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
# Writebook (AI-Enhanced Fork)
1+
# Dill
22

3-
A fork of [Writebook](https://github.com/basecamp/writebook) with integrated AI writing assistance powered by [ActiveAgent](https://github.com/activeagents/activeagent) and [SolidAgent](https://github.com/activeagents/solid_agent).
3+
AI-powered due diligence platform with document analysis powered by [ActiveAgent](https://github.com/activeagents/activeagent).
44

5-
## What's Different in This Fork
6-
7-
This fork extends the original Writebook with a complete AI agent framework that provides:
5+
## Features
86

7+
- **Document Analysis** - Upload PDFs and get AI-powered analysis
8+
- **Tech Diligence Reports** - Automated technical due diligence report generation
99
- **Writing Assistant** - Improve, grammar check, summarize, expand, and brainstorm content
1010
- **Research Assistant** - Autonomous web research with browser automation
11-
- **File Analyzer** - PDF and image analysis with OCR-style text extraction
1211
- **Real-time Streaming** - Live AI responses via ActionCable
1312
- **Context Persistence** - Full audit trail of AI interactions stored in the database
1413

@@ -30,116 +29,19 @@ app/
3029
│ ├── application_agent.rb # Base agent with shared concerns
3130
│ ├── writing_assistant_agent.rb # Writing improvement features
3231
│ ├── research_assistant_agent.rb # Web research with browser tools
33-
│ └── file_analyzer_agent.rb # PDF/image analysis
32+
│ ├── file_analyzer_agent.rb # PDF/image analysis
33+
│ └── tech_diligence_agent.rb # Technical due diligence reports
3434
├── models/
3535
│ ├── agent_context.rb # Conversation/session storage
3636
│ ├── agent_message.rb # Individual messages
3737
│ └── agent_generation.rb # AI response metadata & tokens
3838
└── views/
3939
├── writing_assistant_agent/ # Prompt templates
4040
├── research_assistant_agent/ # Includes tools/*.json.erb
41-
└── file_analyzer_agent/
42-
```
43-
44-
### SolidAgent Concerns
45-
46-
All agents inherit from `ApplicationAgent` which includes three SolidAgent concerns:
47-
48-
```ruby
49-
class ApplicationAgent < ActiveAgent::Base
50-
include SolidAgent::HasContext # Database-backed conversation history
51-
include SolidAgent::HasTools # Declarative tool schema DSL
52-
include SolidAgent::StreamsToolUpdates # Real-time tool status broadcasting
53-
end
54-
```
55-
56-
#### HasContext
57-
58-
Provides automatic persistence of prompts and AI responses:
59-
60-
```ruby
61-
class MyAgent < ApplicationAgent
62-
has_context # Enables auto-save of messages and generations
63-
64-
def chat
65-
create_context(contextable: params[:user])
66-
prompt messages: context_messages
67-
end
68-
end
69-
```
70-
71-
#### HasTools
72-
73-
Declarative tool registration with auto-discovery from JSON templates:
74-
75-
```ruby
76-
class ResearchAgent < ApplicationAgent
77-
has_tools :navigate, :click, :extract_text # Load from views/tools/*.json.erb
78-
79-
tool :custom_action do # Or define inline
80-
description "Perform a custom action"
81-
parameter :input, type: :string, required: true
82-
end
83-
84-
def navigate(url:)
85-
# Tool implementation called by AI
86-
end
87-
end
88-
```
89-
90-
#### StreamsToolUpdates
91-
92-
Broadcasts tool execution status to the frontend via ActionCable:
93-
94-
```ruby
95-
class ResearchAgent < ApplicationAgent
96-
tool_description :navigate, ->(args) { "Visiting #{args[:url]}..." }
97-
tool_description :extract_text, "Reading page content..."
98-
end
41+
├── file_analyzer_agent/
42+
└── tech_diligence_agent/
9943
```
10044

101-
## Available Agents
102-
103-
### WritingAssistantAgent
104-
105-
AI-powered writing enhancement with 6 actions:
106-
107-
| Action | Description |
108-
|--------|-------------|
109-
| `improve` | Enhance writing quality, clarity, and engagement |
110-
| `grammar` | Fix grammar, punctuation, and spelling |
111-
| `style` | Adjust writing style and tone |
112-
| `summarize` | Create concise summaries |
113-
| `expand` | Elaborate and add detail to content |
114-
| `brainstorm` | Generate creative ideas and suggestions |
115-
116-
### ResearchAssistantAgent
117-
118-
Autonomous web research using Capybara/Cuprite browser automation:
119-
120-
| Tool | Description |
121-
|------|-------------|
122-
| `navigate` | Visit URLs |
123-
| `click` | Click elements by selector or text |
124-
| `fill_form` | Fill form fields |
125-
| `extract_text` | Extract text from selectors |
126-
| `extract_main_content` | Smart content detection |
127-
| `extract_links` | Get visible links from page |
128-
| `page_info` | Analyze page structure |
129-
| `go_back` | Navigate back in history |
130-
131-
### FileAnalyzerAgent
132-
133-
Document and image analysis with vision model support:
134-
135-
| Action | Description |
136-
|--------|-------------|
137-
| `analyze_pdf` | Extract and analyze PDF content |
138-
| `analyze_image` | Vision-based image description |
139-
| `extract_image_text` | OCR-style text extraction |
140-
| `extract_text` | Generic file text extraction |
141-
| `summarize_document` | Document summarization |
142-
14345
## Setup
14446

14547
### 1. Install Dependencies
@@ -166,164 +68,18 @@ Run migrations for agent context tables:
16668
bin/rails db:migrate
16769
```
16870

169-
This creates:
170-
- `agent_contexts` - Conversation sessions
171-
- `agent_messages` - Individual messages (user/assistant/tool)
172-
- `agent_generations` - Response metadata and token usage
173-
174-
### 4. Configure Providers
175-
176-
Edit `config/active_agent.yml`:
177-
178-
```yaml
179-
development:
180-
openai:
181-
service: "OpenAI"
182-
api_key: <%= ENV['OPENAI_API_KEY'] %>
183-
model: "gpt-4o"
184-
temperature: 0.7
185-
```
186-
187-
## Usage
188-
189-
### Controller Integration
71+
### 4. Start the Server
19072

191-
```ruby
192-
# Synchronous
193-
result = WritingAssistantAgent.with(
194-
content: params[:content],
195-
contextable: @page
196-
).improve.generate_now
197-
198-
# Asynchronous with streaming
199-
stream_id = SecureRandom.hex(8)
200-
WritingAssistantAgent.with(
201-
content: params[:content],
202-
stream_id: stream_id
203-
).improve.generate_later
204-
```
205-
206-
### Frontend Streaming
207-
208-
Subscribe to ActionCable channel with the stream_id:
209-
210-
```javascript
211-
const channel = consumer.subscriptions.create(
212-
{ channel: "AssistantStreamChannel", stream_id: streamId },
213-
{
214-
received(data) {
215-
if (data.content) {
216-
// Append streamed content
217-
}
218-
if (data.tool_status) {
219-
// Show tool execution status
220-
}
221-
if (data.done) {
222-
// Generation complete
223-
}
224-
}
225-
}
226-
)
227-
```
228-
229-
### Adding New Agents
230-
231-
1. Create agent class:
232-
233-
```ruby
234-
# app/agents/my_agent.rb
235-
class MyAgent < ApplicationAgent
236-
has_context
237-
has_tools :my_tool
238-
239-
def my_action
240-
create_context(contextable: params[:record])
241-
prompt(tools: tools)
242-
end
243-
244-
def my_tool(param:)
245-
# Tool implementation
246-
{ success: true, result: "..." }
247-
end
248-
end
249-
```
250-
251-
2. Create prompt templates:
252-
253-
```erb
254-
<%# app/views/my_agent/my_action.text.erb %>
255-
Please help with: <%= @task %>
256-
```
257-
258-
3. Create tool schemas:
259-
260-
```json
261-
<%# app/views/my_agent/tools/my_tool.json.erb %>
262-
{
263-
"type": "function",
264-
"name": "my_tool",
265-
"description": "Does something useful",
266-
"parameters": {
267-
"type": "object",
268-
"properties": {
269-
"param": { "type": "string", "description": "Input parameter" }
270-
},
271-
"required": ["param"]
272-
}
273-
}
274-
```
275-
276-
## Database Models
277-
278-
### AgentContext
279-
280-
Stores conversation sessions with polymorphic association:
281-
282-
```ruby
283-
context = AgentContext.create!(
284-
contextable: page, # Any record (Page, Book, User, etc.)
285-
agent_name: "WritingAssistantAgent",
286-
action_name: "improve"
287-
)
288-
289-
context.add_user_message("Please improve this text")
290-
context.record_generation!(response)
291-
```
292-
293-
### AgentMessage
294-
295-
Individual conversation turns:
296-
297-
```ruby
298-
message.role # "system", "user", "assistant", "tool"
299-
message.content # Message text
300-
message.to_message_hash # Convert to ActiveAgent format
301-
```
302-
303-
### AgentGeneration
304-
305-
Response metadata with token tracking:
306-
307-
```ruby
308-
generation.input_tokens # Tokens in prompt
309-
generation.output_tokens # Tokens in response
310-
generation.total_tokens # Total usage
311-
generation.duration_ms # Response time
312-
generation.usage # AgentUsage object
73+
```bash
74+
bin/dev
31375
```
31476

31577
## Documentation
31678

31779
- [Active Agents Integration](docs/active-agents-integration.md) - Detailed implementation guide
318-
- [Research Assistant](docs/features/research-assistant.md) - Web research feature docs
80+
- [Tech Diligence Report Generator](docs/features/tech-diligence-report-generator.md) - Document analysis feature
31981
- [Claude Integration Guide](docs/CLAUDE.md) - Agent development patterns
32082

321-
## Original Writebook
322-
323-
For the base Writebook functionality (books, pages, users, publishing), see the [original Writebook repository](https://github.com/basecamp/writebook).
324-
32583
## License
32684

327-
This fork maintains the original Writebook license. The AI integration uses:
328-
- [ActiveAgent](https://github.com/activeagents/activeagent) - MIT License
329-
- [SolidAgent](https://github.com/activeagents/solid_agent) - MIT License
85+
MIT License

0 commit comments

Comments
 (0)