Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

improve obsidian prompts, put in subfolders, remove log noise

Louis Beaumont7fcc92018fb4
diff --git a/pipes/obsidian/package.json b/pipes/obsidian/package.json
index 07d5b26e0..575888ee1 100644
--- a/pipes/obsidian/package.json
+++ b/pipes/obsidian/package.json
@@ -1,6 +1,6 @@
{
"name": "obsidian",
- "version": "0.1.24",
+ "version": "0.1.25",
"private": true,
"scripts": {
"dev": "next dev --turbopack",
diff --git a/pipes/obsidian/src/app/api/intelligence/route.ts b/pipes/obsidian/src/app/api/intelligence/route.ts
index 0df2f554e..b5a0db03e 100644
--- a/pipes/obsidian/src/app/api/intelligence/route.ts
+++ b/pipes/obsidian/src/app/api/intelligence/route.ts
@@ -11,15 +11,16 @@ async function readRecentLogs(
obsidianPath: string,
since: Date
): Promise<string> {
+ const logsPath = path.join(path.normalize(obsidianPath), "logs");
const today = new Date().toISOString().split("T")[0];
const yesterday = since.toISOString().split("T")[0];
try {
const todayContent = await fs
- .readFile(path.join(obsidianPath, `${today}.md`), "utf8")
+ .readFile(path.join(logsPath, `${today}.md`), "utf8")
.catch(() => "");
const yesterdayContent = await fs
- .readFile(path.join(obsidianPath, `${yesterday}.md`), "utf8")
+ .readFile(path.join(logsPath, `${yesterday}.md`), "utf8")
.catch(() => "");
return `${yesterdayContent}\n${todayContent}`;
@@ -66,8 +67,10 @@ Instructions for Media and Formatting:
- Do not wrap your response in \`\`\`markdown\`\`\` tags
- Add relevant #tags for categorization
- Escape any pipe characters (|) in tables with \\|
+- Do not hallucinate video paths, use the exact video path from the logs
- All your outputs will be written directly in Obsidian note taking app so use the formatting of the app in your response to maximize readability,
embeding links, videos, etc. usually mp4 needs video html component and not the link format
+- If you do not know the answer or do not have the right context, say I do not know, do not hallucinate
Analysis Structure:
### Summary
@@ -120,18 +123,16 @@ async function saveMarkdown(
obsidianPath: string,
filename: string
): Promise<string> {
- const normalizedPath = path.normalize(obsidianPath);
- await fs.mkdir(normalizedPath, { recursive: true });
+ const analysesPath = path.join(path.normalize(obsidianPath), "analyses");
+ await fs.mkdir(analysesPath, { recursive: true });
- const filePath = path.join(normalizedPath, filename);
+ const filePath = path.join(analysesPath, filename);
await fs.writeFile(filePath, content, "utf8");
- const relativePath = obsidianPath
- .replace(normalizedPath, "")
- .replace(/^\//, "");
+ const vaultName = path.basename(path.resolve(obsidianPath));
return `obsidian://open?vault=${encodeURIComponent(
- relativePath
- )}&file=${encodeURIComponent(filename)}`;
+ vaultName
+ )}&file=analyses/${encodeURIComponent(filename)}`;
}
export async function GET() {
@@ -182,7 +183,11 @@ export async function GET() {
.toString()
.padStart(2, "0")}-analysis.md`;
- const deepLink = await saveMarkdown(analysis, obsidianPath, filename);
+ const deepLink = await saveMarkdown(
+ "\n" + analysis,
+ obsidianPath,
+ filename
+ );
return NextResponse.json({
message: "analysis completed",
diff --git a/pipes/obsidian/src/app/api/log/route.ts b/pipes/obsidian/src/app/api/log/route.ts
index 841b6b5ed..73a124535 100644
--- a/pipes/obsidian/src/app/api/log/route.ts
+++ b/pipes/obsidian/src/app/api/log/route.ts
@@ -54,7 +54,31 @@ async function generateWorkLog(
- include all relevant media file paths in the mediaLinks array
- maintain user privacy by excluding sensitive/personal information
- ensure description and content are properly escaped for markdown table cells (use <br> for newlines)
+ - link to people using [[firstname]]
+ - link to concepts using [[concept-name]]
+ Example outputs:
+ {
+ "title": "engineering: implemented rust error handling",
+ "description": "refactored error handling in [[screenpipe-core]] pipeline. paired with [[sarah]] to implement anyhow::Result across key modules. improved error propagation and logging",
+ "tags": ["#rust", "#error-handling", "#pair-programming"],
+ "mediaLinks": ["<video src=\"file:///recordings/pair-programming-session.mp4\" controls></video>"]
+ }
+
+ {
+ "title": "sales: customer discovery call with fintech startup",
+ "description": "met with [[alex]] from payflow. discussed [[24-7-recording]] use cases for compliance. key pain point: audit trail generation. next: technical demo next week",
+ "tags": ["#sales", "#fintech", "#customer-discovery"],
+ "mediaLinks": ["<video src=\"file:///recordings/sales-call-payflow.mp4\" controls></video>"]
+ }
+
+ {
+ "title": "research: llm context window analysis",
+ "description": "reviewed [[claude-3]] papers on attention mechanisms. summarized findings in [[context-window]] note. potential implications for [[screenpipe]]'s chunking strategy",
+ "tags": ["#research", "#llm", "#ai-architecture"],
+ "mediaLinks": []
+ }
+
Return a JSON object with:
{
"title": "Brief, specific title describing the main activity",
@@ -93,16 +117,16 @@ async function syncLogToObsidian(
logEntry: WorkLog,
obsidianPath: string
): Promise<string> {
- const normalizedPath = path.normalize(obsidianPath);
- await fs.mkdir(normalizedPath, { recursive: true });
+ const logsPath = path.join(path.normalize(obsidianPath), "logs");
+ await fs.mkdir(logsPath, { recursive: true });
const today = new Date();
const filename = `${today.getFullYear()}-${String(
today.getMonth() + 1
).padStart(2, "0")}-${String(today.getDate()).padStart(2, "0")}.md`;
- const filePath = path.join(normalizedPath, filename);
+ const filePath = path.join(logsPath, filename);
- const vaultName = path.basename(path.resolve(normalizedPath));
+ const vaultName = path.basename(path.resolve(obsidianPath));
const escapeTableCell = (content: string) => {
return content.replace(/\|/g, "\\|").replace(/\n/g, "<br>");
diff --git a/screenpipe-vision/src/core.rs b/screenpipe-vision/src/core.rs
index cdb2b8c00..d8a399e21 100644
--- a/screenpipe-vision/src/core.rs
+++ b/screenpipe-vision/src/core.rs
@@ -31,8 +31,8 @@ use tokio::io::{AsyncBufReadExt, BufReader};
use tokio::sync::mpsc::Sender;
use tokio::time::sleep;
-use xcap::Monitor;
use crate::browser_utils::create_url_detector;
+use xcap::Monitor;
fn serialize_image<S>(image: &Option<DynamicImage>, serializer: S) -> Result<S::Ok, S::Error>
where
@@ -128,7 +128,9 @@ pub struct OcrTaskData {
pub result_tx: Sender<CaptureResult>,
}
-const BROWSER_NAMES: [&str; 9] = ["chrome", "firefox", "safari", "edge", "brave", "arc", "chromium", "vivaldi", "opera"];
+const BROWSER_NAMES: [&str; 9] = [
+ "chrome", "firefox", "safari", "edge", "brave", "arc", "chromium", "vivaldi", "opera",
+];
pub async fn continuous_capture(
result_tx: Sender<CaptureResult>,
@@ -283,12 +285,20 @@ pub async fn process_ocr_task(
for captured_window in window_images {
let app_name = captured_window.app_name.clone();
- let browser_url = if cfg!(target_os = "macos") && captured_window.is_focused &&
- BROWSER_NAMES.iter().any(|&browser| app_name.to_lowercase().contains(browser)) {
- match tokio::task::spawn_blocking(move || get_active_browser_url_sync(&app_name, captured_window.process_id)).await {
+ let browser_url = if cfg!(target_os = "macos")
+ && captured_window.is_focused
+ && BROWSER_NAMES
+ .iter()
+ .any(|&browser| app_name.to_lowercase().contains(browser))
+ {
+ match tokio::task::spawn_blocking(move || {
+ get_active_browser_url_sync(&app_name, captured_window.process_id)
+ })
+ .await
+ {
Ok(Ok(url)) => Some(url),
- Ok(Err(e)) => {
- error!("Failed to get browser URL: {}", e);
+ Ok(Err(_)) => {
+ // error!("Failed to get browser URL: {}", e);
None
}
Err(e) => {
@@ -468,11 +478,11 @@ fn get_active_browser_url_sync(app_name: &str, process_id: i32) -> Result<String
Ok(Some(url)) => Ok(url),
Ok(None) => Err(std::io::Error::new(
std::io::ErrorKind::Other,
- "Failed to get browser URL"
+ "Failed to get browser URL",
)),
Err(e) => Err(std::io::Error::new(
std::io::ErrorKind::Other,
- format!("Error getting browser URL: {}", e)
+ format!("Error getting browser URL: {}", e),
)),
}
-}
\ No newline at end of file
+}