mirror of
https://github.com/bitsofchris/openaugi-obsidian-plugin.git
synced 2026-07-22 05:46:42 +00:00
remove distill recent activity command
This commit is contained in:
parent
f15cc5a7e8
commit
8415c0c944
2 changed files with 6 additions and 247 deletions
70
README.md
70
README.md
|
|
@ -178,64 +178,6 @@ The plugin will:
|
|||
- Generate a summary that connects the key concepts
|
||||
- Extract any actionable tasks found across the notes
|
||||
|
||||
### 3. Distill Recent Activity
|
||||
|
||||
This command automatically discovers and distills notes that have been recently modified or have date prefixes in their filenames, perfect for daily/weekly reviews.
|
||||
|
||||
**Usage:**
|
||||
1. Hit `CMD+P` (or `CTRL+P` on Windows/Linux) to open the command palette
|
||||
2. Run `OpenAugi: Distill Recent Activity`
|
||||
3. Configure your preferences in the modal:
|
||||
- **Time Window Selection**:
|
||||
- **Default Mode**: "Days to look back" - specify how many days of activity to include (default: 7)
|
||||
- **Date Range Mode**: Toggle "Use specific date range" to select exact start and end dates
|
||||
- **Filter journal sections**: For journal-style notes with date headers, only include recent sections
|
||||
- **Root note**: Optionally specify a note to provide additional context
|
||||
- **Exclude folders**: Skip folders like Templates or Archive
|
||||
4. Click "Select Notes" to preview and choose which notes to include:
|
||||
- View all discovered notes with their modification dates
|
||||
- Check/uncheck individual notes to customize your selection
|
||||
- Use "Select All" toggle for bulk selection
|
||||
5. Optional: Click "Save as Collection" to create a persistent checkbox list for future use
|
||||
6. Click "Distill" to process
|
||||
7. Select a custom prompt "lens" or use the default prompt
|
||||
|
||||
**The plugin will:**
|
||||
- Show discovered notes in an interactive checkbox list
|
||||
- Process only the notes you've selected
|
||||
- For journal-style notes with date headers (e.g., `### 2024-01-20`), extract only recent sections
|
||||
- Synthesize the activity into organized atomic notes using your selected lens
|
||||
- Create atomic notes in a timestamped session folder (e.g., `OpenAugi/Notes/Recent Activity 2024-01-20 14-30-52/`)
|
||||
- Generate a summary with a descriptive name based on content
|
||||
|
||||
**Date Range Selection:**
|
||||
Toggle between two modes for selecting your time window:
|
||||
- **"Last N days"**: Quick selection for recent activity (1 day, 7 days, etc.)
|
||||
- **Specific date range**: Choose exact start and end dates using date pickers
|
||||
- Perfect for reviewing specific periods like "last week" or "this month"
|
||||
- Includes all notes modified or dated within the range
|
||||
|
||||
**Note Selection Interface:**
|
||||
The new selection interface lets you:
|
||||
- Preview all notes that match your criteria before processing
|
||||
- See each note's folder location and modification time
|
||||
- Exclude specific notes by unchecking them
|
||||
- Save your selection as a collection for future reference
|
||||
|
||||
**Save as Collection:**
|
||||
Create a persistent record of your note selection:
|
||||
- Saves to `OpenAugi/Collections/` folder
|
||||
- Preserves checked/unchecked states
|
||||
- Can be used later with "Distill Linked Notes" command
|
||||
- Perfect for creating curated sets of notes for repeated analysis
|
||||
|
||||
**Date-Based Note Discovery:**
|
||||
Notes with filenames beginning with `YYYY-MM-DD` format are automatically included if their date falls within your specified time window, regardless of when they were last modified. This is perfect for:
|
||||
- Meeting notes dated by when they occurred
|
||||
- Daily logs or journal entries
|
||||
- Event-based documentation
|
||||
- Any notes you want to organize by their content date rather than modification time
|
||||
|
||||
## Custom Prompt Lenses
|
||||
|
||||
**NEW**: OpenAugi now supports custom prompt templates that act as "lenses" to focus processing on specific aspects of your notes.
|
||||
|
|
@ -246,7 +188,7 @@ Custom prompts allow you to guide OpenAugi's AI processing with specific perspec
|
|||
|
||||
### Using Custom Prompts
|
||||
|
||||
1. When you run "Distill Linked Notes" or "Distill Recent Activity", you'll see a prompt selection modal
|
||||
1. When you run "Distill Linked Notes", you'll see a prompt selection modal
|
||||
2. Choose from any prompt in your prompts folder (default: `OpenAugi/Prompts`)
|
||||
3. The selected prompt replaces the default processing instructions while keeping the structured output format
|
||||
4. Or select "Use default prompt" for general-purpose processing
|
||||
|
|
@ -354,7 +296,7 @@ The custom context allows you to narrow the focus of processing to extract speci
|
|||
## Use Cases
|
||||
|
||||
### Daily/Weekly Reviews
|
||||
Use "Distill Recent Activity" to automatically summarize your work:
|
||||
Use "Process Recent Activity" to automatically summarize your work:
|
||||
- Set to 1 day for daily reviews
|
||||
- Set to 7 days for weekly reviews
|
||||
- Automatically captures all your recent thoughts and work
|
||||
|
|
@ -368,14 +310,14 @@ Use "Distill Linked Notes" with a project hub note:
|
|||
|
||||
### Research Synthesis
|
||||
Combine both commands for research workflows:
|
||||
- Use "Distill Recent Activity" to review recent research notes
|
||||
- Use "Process Recent Activity" to review recent research notes
|
||||
- Use "Distill Linked Notes" on topic-specific collections
|
||||
- Add custom context to focus on findings, methodologies, or insights
|
||||
|
||||
### Journal Processing
|
||||
Take advantage of journal-style note support:
|
||||
- Keep daily journal entries with date headers
|
||||
- Use "Distill Recent Activity" to extract recent insights
|
||||
- Use "Process Recent Activity" to extract recent insights
|
||||
- Only relevant date sections are processed, keeping context focused
|
||||
|
||||
## Requirements
|
||||
|
|
@ -403,7 +345,7 @@ Configure defaults for the unified context gathering system:
|
|||
- **Filter Recent Sections by Default**: Automatically enable journal section filtering (default: On)
|
||||
|
||||
### Recent Activity Settings
|
||||
Configure defaults for the "Distill Recent Activity" command:
|
||||
Configure defaults for recent activity processing:
|
||||
|
||||
- **Default Days to Look Back**: How many days of activity to include by default (default: 7)
|
||||
- **Filter Journal Sections**: When enabled, only includes recent sections from journal-style notes
|
||||
|
|
@ -437,7 +379,7 @@ Yesterday's reflections...
|
|||
Older content that may be filtered out...
|
||||
```
|
||||
|
||||
When using "Distill Recent Activity" with a 7-day window, only the recent sections would be processed.
|
||||
When using "Process Recent Activity" with a 7-day window, only the recent sections would be processed.
|
||||
|
||||
## Output Structure
|
||||
|
||||
|
|
|
|||
183
src/main.ts
183
src/main.ts
|
|
@ -7,7 +7,6 @@ import { ContextGatheringService } from './services/context-gathering-service';
|
|||
import { OpenAugiSettingTab } from './ui/settings-tab';
|
||||
import { LoadingIndicator } from './ui/loading-indicator';
|
||||
import { sanitizeFilename, createFileWithCollisionHandling } from './utils/filename-utils';
|
||||
import { RecentActivityModal, RecentActivityConfig } from './ui/recent-activity-modal';
|
||||
import { PromptSelectionModal, PromptSelectionConfig } from './ui/prompt-selection-modal';
|
||||
import { ContextGatheringModal } from './ui/context-gathering-modal';
|
||||
import { ContextSelectionModal } from './ui/context-selection-modal';
|
||||
|
|
@ -75,15 +74,6 @@ export default class OpenAugiPlugin extends Plugin {
|
|||
}
|
||||
});
|
||||
|
||||
// Add command to distill recent activity
|
||||
this.addCommand({
|
||||
id: 'distill-recent-activity',
|
||||
name: 'Distill recent activity',
|
||||
callback: async () => {
|
||||
await this.distillRecentActivity();
|
||||
}
|
||||
});
|
||||
|
||||
// Add new unified context gathering commands
|
||||
this.addCommand({
|
||||
id: 'openaugi-process-notes',
|
||||
|
|
@ -335,179 +325,6 @@ export default class OpenAugiPlugin extends Plugin {
|
|||
this.initializeServices();
|
||||
}
|
||||
|
||||
/**
|
||||
* Distill recent activity based on user configuration
|
||||
*/
|
||||
private async distillRecentActivity(): Promise<void> {
|
||||
// Show configuration modal
|
||||
const modal = new RecentActivityModal(
|
||||
this.app,
|
||||
this.settings.recentActivityDefaults,
|
||||
async (config: RecentActivityConfig) => {
|
||||
// After recent activity config, show prompt selection
|
||||
const promptModal = new PromptSelectionModal(
|
||||
this.app,
|
||||
this.settings.promptsFolder,
|
||||
async (promptConfig: PromptSelectionConfig) => {
|
||||
await this.executeRecentActivityDistill(config, promptConfig);
|
||||
}
|
||||
);
|
||||
promptModal.open();
|
||||
}
|
||||
);
|
||||
modal.open();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the recent activity distillation with the given configuration
|
||||
* @param config The configuration for recent activity distillation
|
||||
* @param promptConfig The prompt configuration from the modal
|
||||
*/
|
||||
private async executeRecentActivityDistill(config: RecentActivityConfig, promptConfig: PromptSelectionConfig): Promise<void> {
|
||||
try {
|
||||
// Check API key
|
||||
if (!this.settings.apiKey) {
|
||||
new Notice('Please set your OpenAI API key in the settings');
|
||||
return;
|
||||
}
|
||||
|
||||
// Show loading indicator
|
||||
this.loadingIndicator?.show('Discovering recent activity...');
|
||||
|
||||
// Update services with latest API key and model
|
||||
this.openAIService = new OpenAIService(this.settings.apiKey, this.getConfiguredModel());
|
||||
this.distillService = new DistillService(
|
||||
this.app,
|
||||
this.openAIService,
|
||||
this.settings
|
||||
);
|
||||
|
||||
// Use selected notes if provided, otherwise get all recent notes
|
||||
let recentFiles: TFile[];
|
||||
if (config.selectedNotes && config.selectedNotes.length > 0) {
|
||||
recentFiles = config.selectedNotes;
|
||||
} else {
|
||||
// Fallback to getting all recent notes (shouldn't happen with new UI)
|
||||
recentFiles = await this.distillService.getRecentlyModifiedNotes(
|
||||
config.daysBack,
|
||||
config.excludeFolders,
|
||||
config.useDateRange ? config.fromDate : undefined,
|
||||
config.useDateRange ? config.toDate : undefined
|
||||
);
|
||||
}
|
||||
|
||||
if (recentFiles.length === 0 && !config.rootNote) {
|
||||
this.loadingIndicator?.hide();
|
||||
new Notice(`No notes selected for processing`);
|
||||
return;
|
||||
}
|
||||
|
||||
// Prepare files list including root note if provided
|
||||
let allFiles = [...recentFiles];
|
||||
if (config.rootNote && !recentFiles.some(f => f.path === config.rootNote!.path)) {
|
||||
allFiles = [config.rootNote, ...recentFiles];
|
||||
}
|
||||
|
||||
// Show notice about discovered files
|
||||
const message = config.rootNote
|
||||
? `Processing ${recentFiles.length} selected notes plus root note: ${config.rootNote.basename}`
|
||||
: `Processing ${recentFiles.length} selected notes`;
|
||||
new Notice(message);
|
||||
|
||||
// Update loading message
|
||||
this.loadingIndicator?.show('Processing recent activity...');
|
||||
|
||||
// Use appropriate time window for filtering
|
||||
const timeWindow = config.filterJournalSections ? config.daysBack : 0;
|
||||
|
||||
// Create a synthetic root file for the distillation
|
||||
let timeWindowDesc: string;
|
||||
if (config.useDateRange && config.fromDate && config.toDate) {
|
||||
timeWindowDesc = `from ${config.fromDate} to ${config.toDate}`;
|
||||
} else {
|
||||
timeWindowDesc = `in the last ${config.daysBack} days`;
|
||||
}
|
||||
|
||||
const syntheticRootContent = `# Recent Activity Summary
|
||||
|
||||
This is an automated summary of notes modified ${timeWindowDesc}.
|
||||
${config.rootNote ? `\nUsing [[${config.rootNote.basename}]] as context root.` : ''}
|
||||
|
||||
## Recently Modified Notes:
|
||||
${allFiles.map(f => `- [[${f.basename}]]`).join('\n')}`;
|
||||
|
||||
// Ensure OpenAugi folder exists
|
||||
if (!await this.app.vault.adapter.exists('OpenAugi')) {
|
||||
await this.app.vault.createFolder('OpenAugi');
|
||||
}
|
||||
|
||||
// Create a temporary root file
|
||||
const tempRootPath = `OpenAugi/temp-recent-activity-${Date.now()}.md`;
|
||||
await createFileWithCollisionHandling(this.app.vault, tempRootPath, syntheticRootContent);
|
||||
const tempRootFile = this.app.vault.getAbstractFileByPath(tempRootPath) as TFile;
|
||||
|
||||
// Aggregate content with time filtering
|
||||
const { content: aggregatedContent, sourceNotes } = await this.distillService.aggregateContent(
|
||||
allFiles,
|
||||
timeWindow
|
||||
);
|
||||
|
||||
// Combine with synthetic root content
|
||||
const combinedContent = `# Recent Activity: ${timeWindowDesc}\n\n${syntheticRootContent}\n\n${aggregatedContent}`;
|
||||
|
||||
// Read custom prompt if selected
|
||||
let customPrompt: string | undefined;
|
||||
if (promptConfig.useCustomPrompt && promptConfig.selectedPrompt) {
|
||||
try {
|
||||
customPrompt = await this.app.vault.read(promptConfig.selectedPrompt);
|
||||
} catch (error) {
|
||||
console.error('Failed to read custom prompt:', error);
|
||||
new Notice('Failed to read custom prompt, using default');
|
||||
}
|
||||
}
|
||||
|
||||
// Distill the recent activity
|
||||
const distilledData = await this.distillService.distillFromRootNote(
|
||||
tempRootFile,
|
||||
combinedContent,
|
||||
sourceNotes,
|
||||
undefined, // No time window needed here since we already filtered
|
||||
customPrompt
|
||||
);
|
||||
|
||||
// Update the distilled data to reflect recent activity
|
||||
const summaryTimeDesc = config.useDateRange && config.fromDate && config.toDate
|
||||
? `${config.fromDate} to ${config.toDate}`
|
||||
: `Last ${config.daysBack} Days`;
|
||||
distilledData.summary = `## Recent Activity Summary (${summaryTimeDesc})\n\n${distilledData.summary}`;
|
||||
|
||||
// Remove the temp file from source notes before writing
|
||||
distilledData.sourceNotes = distilledData.sourceNotes?.filter(
|
||||
note => !note.includes('temp-recent-activity')
|
||||
);
|
||||
|
||||
// Write result to files
|
||||
const summaryPath = await this.fileService.writeDistilledFiles(tempRootFile, distilledData);
|
||||
|
||||
// Clean up temporary file
|
||||
await this.app.vault.delete(tempRootFile);
|
||||
|
||||
// Hide loading indicator
|
||||
this.loadingIndicator?.hide();
|
||||
|
||||
// Show success message
|
||||
new Notice(`Successfully distilled recent activity\nCreated ${distilledData.notes.length} atomic notes`);
|
||||
|
||||
// Open the summary file in a new tab
|
||||
await this.openFileInNewTab(summaryPath);
|
||||
} catch (error) {
|
||||
// Hide loading indicator
|
||||
this.loadingIndicator?.hide();
|
||||
|
||||
console.error('Failed to distill recent activity:', error);
|
||||
new Notice('Failed to distill recent activity. Check console for details.');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Main orchestration method for unified context gathering and processing
|
||||
|
|
|
|||
Loading…
Reference in a new issue