s2idle sleep state is active. Deep S3 sleep is not available. This is the #1 cause of NVIDIA suspend issues on Dell/Alienware laptops.diff --git a/omp-docs/.okf/config.yaml b/omp-docs/.okf/config.yaml new file mode 100644 index 0000000..3b6a360 --- /dev/null +++ b/omp-docs/.okf/config.yaml @@ -0,0 +1,107 @@ +# OKF Bundle Configuration +# This file configures tooling behavior for the pi Agent Documentation Bundle. +# It is not part of the OKF v0.1 spec — it is an extension for automation. + +bundle: + name: "pi Agent Documentation Bundle" + version: "0.1" + author: "pi agent system" + description: "Cached documentation for tools, configurations, and systems used during pi agent sessions." + root: "/home/dank/.pi/agent/docs" + +generator: + # Index generation settings + index: + auto_generate: true # Regenerate index.md when files change + exclude: # Filenames to never include in auto-generated indexes + - log.md + - config.yaml + description_format: "{title} — {description}" # Format for index entries + sort: alphabetical # Sort order: alphabetical | size | modified + max_depth: 1 # Only list immediate children (not recursive) + + # Frontmatter template for new files + frontmatter_template: | + --- + type: {type} + title: {title} + description: {description} + tags: [] + timestamp: {timestamp} + --- + +validator: + # Validation rules — which checks to run + checks: + - name: "missing_type" + severity: "error" + description: "Every concept must have a `type` field in frontmatter" + run: "grep -L '^type:' {file}" + + - name: "missing_description" + severity: "warning" + description: "Every concept should have a `description` field" + run: "grep -L '^description:' {file}" + + - name: "missing_timestamp" + severity: "info" + description: "Consider adding a `timestamp` for staleness detection" + run: "grep -L '^timestamp:' {file}" + + - name: "oversized_file" + severity: "warning" + description: "Files over 500 lines should be split into separate concepts" + threshold: 500 # lines + run: "wc -l {file} | awk '$1 > 500'" + + - name: "empty_frontmatter" + severity: "error" + description: "Frontmatter block exists but contains no parseable YAML" + run: "head -n 4 {file} | grep -c '^---'" + + - name: "index_mismatch" + severity: "warning" + description: "index.md does not list all non-reserved .md files in directory" + run: "compare-index {directory}" + + # Staleness detection + staleness: + warning_days: 90 # Flag files older than 90 days + error_days: 180 # Flag files older than 180 days as stale + timestamp_field: "timestamp" + + # Cross-link validation + linking: + check_absolute_links: true # Validate absolute (bundle-relative) links resolve + check_relative_links: true # Validate relative links resolve + tolerate_broken: true # OKF spec says consumers must tolerate broken links, + # but this validator can flag them for cleanup + +fields: + # Custom field definitions beyond the OKF v0.1 spec + required: + - type # Non-negotiable — defines concept kind + + recommended: + - title # Human-readable display name + - description # One-line summary for previews and index listings + - timestamp # Last meaningful change for staleness detection + - tags # Cross-cutting categorization + + optional: + - resource # URI identifying the underlying asset + - status # Draft | Current | Deprecated | Archived + - version # Version string for versioned concepts + - see_also # Explicit list of related concept paths + - related_concepts # Tags or paths to related concepts + + # Predefined type values recognized by this bundle + types: + - concept # A single concept or idea + - reference # Reference material, specifications, tables + - guide # How-to, walkthrough, procedural + - configuration # Config file reference or setup instructions + - changelog # Update history + - specification # Formal spec or standard + - tutorial # Step-by-step learning content + - tool # Tool documentation, setup, and usage diff --git a/omp-docs/agentic-web-research/agentic-search-best-practices.md b/omp-docs/agentic-web-research/agentic-search-best-practices.md new file mode 100644 index 0000000..ec33822 --- /dev/null +++ b/omp-docs/agentic-web-research/agentic-search-best-practices.md @@ -0,0 +1,121 @@ +--- +type: concept +title: Agentic Search Best Practices +description: Query formulation, extraction, validation, retry, and rate limiting for an agent that searches the web. +tags: + - agentic + - search + - rag + - retrieval + - unverified +verified: 2026-08-28 +timestamp: 2026-08-11 +--- + +# Agentic Search Best Practices + +An agent that searches well does not fire one query and trust one answer. It rewrites queries, reads the strongest sources, and checks its own work. + +This page gives the practices. See [Research Effectiveness](research-effectiveness.md) for how to orchestrate the loop. + +## The Search Pipeline + +```mermaid +graph LR + A[User question] --> B[Query rewriter] + B --> C[Query 1] + B --> C2[Query 2] + B --> C3[Query 3] + C --> D[SearXNG] + C2 --> D + C3 --> D + D --> E[Extract content] + E --> F[Re-rank + dedupe] + F --> G[Validate facts] + G --> H[Synthesize + cite] +``` + +## Query Formulation + +- Rewrite the user question into a search-ready query. +- Generate two or three alternative queries for broader coverage. +- Add synonyms and related terms. +- Batch the queries in one action when the framework allows it. + +A code-based agent (CodeAct) can run several searches in one action. This cuts LLM calls by about 30 percent compared with one tool call per search. The ReAct loop (reason, act, observe) is the default pattern. + +## Extraction and Processing + +- Convert HTML to clean Markdown before you feed the model. Pi does this in `fetch_content`. +- Remove near-duplicate results across engines. +- Re-rank with BM25 relevance scoring. +- Keep a source reference for every extracted fact. +- Truncate long pages. A common cap is 40,000 characters per page. + +Use query-aware content filters to cut noise before the model sees text. Crawl4AI ships three filters: + +- `BM25ContentFilter` — score page chunks against the query. Keep only relevant snippets. +- `PruningContentFilter` — strip boilerplate by text and link density. +- `LLMContentFilter` — delegate filtering to a model for hard pages. + +Run BM25 re-ranking on the search results themselves. The SearXNG BM25 reranker plugin builds a temporary index and fuses BM25 scores with engine rankings using reciprocal rank fusion. This lifts keyword accuracy over raw engine order. + +## Respect Rate Limits + +Upstream engines and SearXNG block agents that hammer them. Slow down on purpose. + +- Respect `Retry-After` headers. +- Use exponential backoff on retries. +- Rotate user-agent strings. +- Add random delays between requests. +- Cap the request rate. A common default is 1 request per second. +- Run a circuit breaker that suspends a failing engine. +- Cache results with a time-to-live value. + +```yaml +# SearXNG side: cap timeouts and retries +outgoing: + request_timeout: 2.0 + max_request_timeout: 10.0 + retries: 3 +``` + +SearXNG suspends failing engines on a timer. For example, a CAPTCHA response suspends the engine for 3600 seconds. Respect that pause instead of retrying into the block. + +## Validate the Answer + +- Cross-reference each claim against a second independent source. +- Prefer primary sources over summaries. +- Record the authority and freshness of each source. + +Score credibility on concrete signals: + +- Domain type. Prefer `.edu`, `.gov`, and `.org` over personal `.com` sites. +- Link density. A low text-to-link ratio signals a content farm. +- Metadata. A real `
Alienware M16 R2 • CachyOS (Kernel 7.1.4) • NVIDIA RTX 4070
+Generated: July 22, 2026
+Your machine enters sleep when closing the lid, but exhibits issues properly waking from sleep. The screen may remain black, or the system may exhibit partial wake behavior.
+ +The primary issue is that the system only supports s2idle (Modern Standby) sleep state, which is fundamentally broken for NVIDIA hybrid GPU configurations on Linux. Deep S3 sleep is available but not enabled by default.
| Property | +Value | +
|---|---|
| Machine | +Alienware m16 R2 (Model 01HV0T) | +
| BIOS | +v1.15.0 (08/06/2025) | +
| CPU | +Intel Core Ultra 7 155H (Meteor Lake-H) | +
| GPU | +NVIDIA RTX 4070 Max-Q (PRIME hybrid) | +
| Kernel | +7.1.4-1-cachyos | +
| Display Manager | +SDDM with niri Wayland compositor | +
/sys/power/mem_sleep: [s2idle] ← ONLY s2idle available
+/sys/power/state: freeze mem disk
+NVIDIA Driver: 610.43.03 (proprietary)
+PreserveVideoMemoryAllocations: 2 ← Enabled
+UseKernelSuspendNotifiers: 1 ← Enabled
+ s2idle sleep state is active. Deep S3 sleep is not available. This is the #1 cause of NVIDIA suspend issues on Dell/Alienware laptops._SB.PC00.XHCI.RHUB.SS03, SS04, method TUPC missing arguments).Failed to handle ACPI D-Notifier event, status=0x11 during wake indicates driver cannot properly handle ACPI power state transitions.Jul 22 19:43:43 dankware kernel: NVRM: RmHandleDNotifierEvent: Failed to handle ACPI D-Notifier event, status=0x11
+Jul 22 19:43:43 dankware kernel: spd5118 18-0050: PM: dpm_run_callback(): spd5118_resume [spd5118] returns -6
+Jul 22 19:43:43 dankware kernel: spd5118 18-0050: PM: failed to resume async: error -6
+Jul 22 19:49:48 cachyos kernel: ACPI BIOS Error (bug): Could not resolve symbol [\_SB.PC00.XHCI.RHUB.SS03], AE_NOT_FOUND
+Jul 22 19:50:08 dankware kernel: i915 0000:00:02.0: [drm] *ERROR* GT1: GSC proxy component didn't bind within expected timeout
+ /home/dank/.pi/scripts/diagnose-sleep-wake.sh — 700+ line comprehensive diagnostic toolAlienware-M16a2-Linux-sleep-wake-issues.md (424 lines) and Sleep-Fix-Guide.md (260 lines)docs/research/ and docs/tools/ directories with proper OKF structure| File | +Purpose | +Status | +
|---|---|---|
scripts/diagnose-sleep-wake.sh |
+ Comprehensive diagnostic tool | +Ready to run | +
docs/research/Alienware-M16a2-Linux-sleep-wake-issues.md |
+ Root cause research | +Complete | +
docs/research/Sleep-Fix-Guide.md |
+ Step-by-step fix implementation guide | +Complete | +
docs/tools/linux-power-management/index.md |
+ Configuration reference | +Complete | +
Comprehensive research was conducted on NVIDIA GPU driver state corruption during suspend/resume, documenting 10+ GitHub issues from the NVIDIA/open-gpu-kernel-modules repository, identifying patterns across Dell/Alienware systems, and tracking kernel regressions affecting s2idle with NVIDIA hybrid GPUs.
+Despite comprehensive documentation and research, the actual system configuration changes remain pending.
+| Priority | +Fix | +Rationale | +
|---|---|---|
| CRITICAL | +Force S3 deep sleep | +s2idle is fundamentally broken for NVIDIA hybrid GPUs | +
| HIGH | +Blacklist nvidiafb module | +Known to cause black screen on resume | +
| HIGH | +Add kernel parameters | +Improve ACPI and sleep behavior | +
| MEDIUM | +Update BIOS/firmware | +Dell frequently fixes ACPI/suspend bugs in updates | +
| MEDIUM | +Disable problematic wake sources | +8 wake sources enabled, including XHCI (USB) | +
# Check if S3 is supported
+cat /sys/power/mem_sleep
+# Current: [s2idle] — need to enable "deep"
+
+# Test S3 temporarily
+echo deep | sudo tee /sys/power/mem_sleep
+
+# If successful, make permanent by adding to bootloader:
+# GRUB: GRUB_CMDLINE_LINUX_DEFAULT="... mem_sleep_default=deep"
+# systemd-boot: Add "mem_sleep_default=deep" to options line
+
+ # Create blacklist file
+sudo tee /etc/modprobe.d/blacklist-nvidiafb.conf > /dev/null <<'EOF'
+blacklist nvidiafb
+EOF
+
+# Regenerate initramfs
+sudo mkinitcpio -P
+
+# Verify
+lsmod | grep -q nvidiafb && echo "FAIL" || echo "PASS"
+
+ # Edit your bootloader config and add these parameters:
+mem_sleep_default=deep acpi_backlight=vendor acpi_enforce_resources=lax
+
+# For GRUB, edit /etc/default/grub:
+GRUB_CMDLINE_LINUX_DEFAULT="quiet splash mem_sleep_default=deep acpi_backlight=vendor acpi_enforce_resources=lax nvidia-drm.modeset=1 pcie_aspm=off"
+
+# Then update:
+sudo update-grub
+
+ # Check current version
+sudo dmidecode -s bios-version
+# Current: v1.15.0 (08/06/2025)
+
+# Check for updates
+sudo fwupdmgr get-updates
+sudo fwupdmgr update
+
+# Or download from Dell Support
+
+ # View current wake sources
+cat /proc/acpi/wakeup
+# XHCI, RP01, RP05, RP07, RP08, RP09, RP12 are enabled (8 total)
+
+# Toggle problematic devices (temporary - resets on reboot)
+sudo sh -c 'echo XHCI > /proc/acpi/wakeup'
+
+# For permanent fix, create systemd service:
+ sudo tee /etc/systemd/system/disable-wake-devices.service > /dev/null <<'EOF'
+[Unit]
+Description=Disable problematic wake devices
+Before=sleep.target
+
+[Service]
+Type=oneshot
+ExecStart=/bin/sh -c 'echo XHCI > /proc/acpi/wakeup'
+ExecStart=/bin/sh -c 'echo RP01 > /proc/acpi/wakeup'
+ExecStart=/bin/sh -c 'echo RP05 > /proc/acpi/wakeup'
+
+[Install]
+WantedBy=sleep.target
+EOF
+
+sudo systemctl enable disable-wake-devices.service
+ systemctl suspend — System should sleep and wake properly# After applying fixes, verify configuration:
+
+# 1. Check sleep state (should show [deep])
+cat /sys/power/mem_sleep
+
+# 2. Verify kernel parameters
+cat /proc/cmdline | grep -E "mem_sleep_default|acpi_backlight"
+
+# 3. Check NVIDIA services status
+systemctl status nvidia-suspend.service nvidia-resume.service
+
+# 4. Verify nvidiafb not loaded
+lsmod | grep -q nvidiafb && echo "FAIL" || echo "PASS"
+ echo deep | sudo tee /sys/power/mem_sleep, then make permanent via bootloader/etc/modprobe.d/blacklist-nvidiafb.conf and run sudo mkinitcpio -Pmem_sleep_default=deep acpi_backlight=vendor acpi_enforce_resources=laxsudo fwupdmgr get-updates and compare with Dell support siteAfter applying these fixes, your system should properly enter and exit sleep mode without black screen issues. The s2idle→S3 transition is the most critical change, as Modern Standby is known to be incompatible with NVIDIA hybrid GPU configurations on Linux.
+| Document | +Location | +Description | +
|---|---|---|
Sleep-Fix-Guide.md |
+ docs/research/ |
+ Step-by-step implementation guide with verification commands | +
Alienware-M16a2-*.md |
+ docs/research/ |
+ Comprehensive root cause research and community reports | +
diagnose-sleep-wake.sh |
+ scripts/ |
+ Diagnostic script for collecting system state | +
linux-power-management/index.md |
+ docs/tools/ |
+ Configuration reference for power management tools | +