[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7ETR0D2SC2G6ARWDBAD47W9":3,"skill-same:01M7ETR0D2SC2G6ARWDBAD47W9":48},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":26,"commitSha":27,"skillDirectory":28,"forksCount":29,"repositoryHtmlUrl":30,"repositoryHomepageUrl":6,"ownerHtmlUrl":31,"ownerBlogUrl":6,"ownerDescription":32,"updatedAt":33,"install":34,"resources":47},"01M7ETR0D2SC2G6ARWDBAD47W9","trader-portfolio-cg",null,"Mean-variance portfolio optimization via Conjugate Gradient — 40-60× faster than the legacy Neumann path (ADR-126 Phase 3, ADR-123 Wedge 8)","lza6\u002FArmor-piercing-system-prompts","lza6","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F128880206?v=4","01M7EB3K7WPX5T28EJ2NVHE6EG","Chinese-tingfeng","01M7EB3K97E1KQ16QWKJMFNGX8",11,"MIT","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F04-安全渗透\u002Ftrader-portfolio-cg\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: trader-portfolio-cg\ndescription: Mean-variance portfolio optimization via Conjugate Gradient — 40-60× faster than the legacy Neumann path (ADR-126 Phase 3, ADR-123 Wedge 8)\nallowed-tools: Bash Read mcp__ruflo-sublinear__solve mcp__plugin_ruflo-core_ruflo__memory_store mcp__plugin_ruflo-core_ruflo__memory_retrieve mcp__plugin_ruflo-core_ruflo__memory_search mcp__plugin_ruflo-core_ruflo__agentdb_pattern-search\nargument-hint: \"[--portfolio-id ID] [--tolerance 1e-6]\"\n---\nSolve the mean-variance optimization `Σ · x = μ` via Conjugate Gradient instead of the legacy Neumann series.\n\n**Why CG instead of Neumann (ADR-123 Wedge 8):**\n- Neumann series: ~50 µs at n=256 (legacy `npx neural-trader --portfolio optimize`)\n- Conjugate Gradient: ~816 ns at n=256 (this skill)\n- Measured speedup: 40-60×; parity within 1e-4 on a fixed seed.\n\nThe covariance matrix Σ is symmetric positive-definite by construction (it's a Gram matrix on real returns), so CG is provably optimal — it converges in at most n iterations with no preconditioning, and typically far fewer when eigenvalues cluster.\n\n**Disable flag**: set `RUFLO_NEURAL_TRADER_DISABLE_CG=1` to skip the CG path entirely and fall through to step 4's legacy Neumann route. Useful for A\u002FB validation or when an upstream covariance regression breaks SPD.\n\n**Native dispatch flag**: set `RUFLO_SUBLINEAR_NATIVE=1` to force the adapter to attempt the native `mcp__ruflo-sublinear__solve` path even when `globalThis` doesn't expose the tool (e.g. when the harness mounts it via a different transport). On any native-dispatch failure the adapter cleanly falls back to the local JS CG and records `method: 'cg-local'` in the artifact metadata — so the regression is auditable.\n\nSteps:\n\n1. **Ensure neural-trader is available**:\n   ```bash\n   npm ls neural-trader 2>\u002Fdev\u002Fnull || npm install --ignore-scripts neural-trader\n   ```\n\n2. **Read the current covariance matrix Σ and expected-return vector μ** from neural-trader's portfolio API:\n   ```bash\n   # Primary path (preferred — clean JSON):\n   npx neural-trader --portfolio current --json\n   # Fallback paths if the --json flag is unavailable on the installed version:\n   npx neural-trader --portfolio current  # parse the text output\n   # OR pull from AgentDB if a prior run stored the matrix there:\n   ```\n   ```text\n   mcp__plugin_ruflo-core_ruflo__memory_search({ query: \"covariance matrix current\", namespace: \"trading-risk\", limit: 1 })\n   ```\n   The skill expects the response to include `covariance: number[][]` (n × n) and `expectedReturns: number[]` (length n).\n\n3. **Solve Σ · x = μ via the SublinearAdapter** (preferred path) when `RUFLO_NEURAL_TRADER_DISABLE_CG` is unset:\n   ```js\n   import { sublinearAdapter } from '..\u002F..\u002Fsrc\u002Fsublinear-adapter.mjs';\n   const result = await sublinearAdapter.solveCG(COVARIANCE, EXPECTED_RETURNS, {\n     tolerance: 1e-6,\n     maxIterations: 200,\n   });\n   \u002F\u002F result.solution    — optimal weights (number[])\n   \u002F\u002F result.iterations  — CG iterations executed\n   \u002F\u002F result.residual    — final ||A·x − b||₂\n   \u002F\u002F result.latencyMs   — wall-clock latency\n   \u002F\u002F result.method      — 'cg-sublinear-native' | 'cg-local'   \u003C-- READ THIS\n   \u002F\u002F result.solver      — 'sublinear-time-solver@1.7.0' | 'local-js-cg'\n   \u002F\u002F result.degraded    — true if input failed SPD checks (fall back to step 4)\n   ```\n   The adapter does the dispatch itself: it probes for `mcp__ruflo-sublinear__solve` on `globalThis` (and honours `RUFLO_SUBLINEAR_NATIVE=1` as a manual override), routes through the native kernel when reachable, and falls back transparently to the embedded ~50-LOC JS CG when not. The math is identical either way — CG, dense form, n × n SPD covariance. The operator reads `result.method` to know which backend produced the artifact.\n\n   The native MCP tool's wire shape (for direct callers who want to bypass the adapter):\n   ```text\n   mcp__ruflo-sublinear__solve({\n     matrix: COVARIANCE,\n     rhs: EXPECTED_RETURNS,\n     algorithm: \"cg\",\n     tolerance: 1e-6,\n     maxIterations: 200\n   })\n   ```\n   Output:\n   ```ts\n   { solution: number[], iterations: number, residual: number }\n   ```\n\n4. **Fallback (legacy Neumann)** — if step 3 reports `degraded: true` (non-SPD input, non-square matrix, MCP error) OR if `RUFLO_NEURAL_TRADER_DISABLE_CG=1`:\n   ```bash\n   npx neural-trader --portfolio optimize\n   ```\n   Capture the weights output and tag the artifact metadata with `method: 'neumann-fallback'` and a `reason` field.\n\n5. **Store the optimal weights** to `trading-risk` namespace with full provenance metadata. **Take `method` and `solver` straight from the adapter's result so the operator can verify which backend ran**:\n   ```text\n   mcp__plugin_ruflo-core_ruflo__memory_store({\n     key: \"portfolio-weights-PORTFOLIO_ID-TIMESTAMP\",\n     namespace: \"trading-risk\",\n     value: JSON.stringify({\n       weights: result.solution,           \u002F\u002F number[] from step 3 (or weights from step 4 fallback)\n       method: result.method,              \u002F\u002F 'cg-sublinear-native' | 'cg-local' | 'neumann-fallback'\n       solver: result.solver,              \u002F\u002F 'sublinear-time-solver@1.7.0' | 'local-js-cg' | 'neural-trader-cli'\n       iterations: result.iterations,\n       residual: result.residual,\n       latencyMs: result.latencyMs,\n       capturedAt: NEW_DATE_ISO,\n       reason: FALLBACK_REASON || null\n     })\n   })\n   ```\n   The `trading-risk` namespace is canonical (ADR-126 Phase 1; the five-namespace alignment). Long-lived — no TTL — because portfolio weights are the audit trail Phase 4 will Ed25519-sign.\n\n6. **Cross-check against historical patterns** (optional but recommended):\n   ```text\n   mcp__plugin_ruflo-core_ruflo__agentdb_pattern-search({\n     query: \"portfolio weights Sharpe regime:CURRENT_REGIME\",\n     namespace: \"trading-risk\"\n   })\n   ```\n   If the new weights differ by more than 30% in any single asset from the historical median, flag for human review before applying. This is a guard-rail, not a hard block.\n\n**Acceptance criteria (ADR-126 Phase 3):**\n- Latency \u003C 1 ms on n = 256 covariance (local JS CG); native path target 40-60× faster (816 ns native vs 50 µs Neumann per sublinear-time-solver@1.7.0).\n- Parity with legacy Neumann within `||cg − neumann||_∞ \u003C 1e-4` on a fixed seed.\n- Fallback path engages cleanly when native MCP unavailable \u002F covariance non-SPD.\n- Artifact metadata distinguishes `cg-sublinear-native`, `cg-local`, and `neumann-fallback`.\n\n**Refs**:\n- ADR-126 Phase 3 (this skill's authoring ADR)\n- ADR-123 §162 Row 8 (Wedge 8 speedup claim)\n- ADR-123 §262-289 (the SublinearAdapter contract)\n- `plugins\u002Fruflo-neural-trader\u002Fsrc\u002Fsublinear-adapter.ts` (the adapter)\n- `plugins\u002Fruflo-neural-trader\u002Fbenchmarks\u002Fportfolio-cg.bench.ts` (the measured numbers)\n","Solve the mean-variance optimization `Σ · x = μ` via Conjugate Gradient instead of the legacy Neumann series.\n\n**Why CG instead of Neumann (ADR-123 Wedge 8):**\n- Neumann series: ~50 µs at n=256 (legacy `npx neural-trader --portfolio optimize`)\n- Conjugate Gradient: ~816 ns at n=256 (this skill)\n- Measured speedup: 40-60×; parity within 1e-4 on a fixed seed.\n\nThe covariance matrix Σ is symmetric positive-definite by construction (it's a Gram matrix on real returns), so CG is provably optimal — it converges in at most n iterations with no preconditioning, and typically far fewer when eigenvalues cluster.\n\n**Disable flag**: set `RUFLO_NEURAL_TRADER_DISABLE_CG=1` to skip the CG path entirely and fall through to step 4's legacy Neumann route. Useful for A\u002FB validation or when an upstream covariance regression breaks SPD.\n\n**Native dispatch flag**: set `RUFLO_SUBLINEAR_NATIVE=1` to force the adapter to attempt the native `mcp__ruflo-sublinear__solve` path even when `globalThis` doesn't expose the tool (e.g. when the harness mounts it via a different transport). On any native-dispatch failure the adapter cleanly falls back to the local JS CG and records `method: 'cg-local'` in the artifact metadata — so the regression is auditable.\n\nSteps:\n\n1. **Ensure neural-trader is available**:\n   ```bash\n   npm ls neural-trader 2>\u002Fdev\u002Fnull || npm install --ignore-scripts neural-trader\n   ```\n\n2. **Read the current covariance matrix Σ and expected-return vector μ** from neural-trader's portfolio API:\n   ```bash\n   # Primary path (preferred — clean JSON):\n   npx neural-trader --portfolio current --json\n   # Fallback paths if the --json flag is unavailable on the installed version:\n   npx neural-trader --portfolio current  # parse the text output\n   # OR pull from AgentDB if a prior run stored the matrix there:\n   ```\n   ```text\n   mcp__plugin_ruflo-core_ruflo__memory_search({ query: \"covariance matrix current\", namespace: \"trading-risk\", limit: 1 })\n   ```\n   The skill expects the response to include `covariance: number[][]` (n × n) and `expectedReturns: number[]` (length n).\n\n3. **Solve Σ · x = μ via the SublinearAdapter** (preferred path) when `RUFLO_NEURAL_TRADER_DISABLE_CG` is unset:\n   ```js\n   import { sublinearAdapter } from '..\u002F..\u002Fsrc\u002Fsublinear-adapter.mjs';\n   const result = await sublinearAdapter.solveCG(COVARIANCE, EXPECTED_RETURNS, {\n     tolerance: 1e-6,\n     maxIterations: 200,\n   });\n   \u002F\u002F result.solution    — optimal weights (number[])\n   \u002F\u002F result.iterations  — CG iterations executed\n   \u002F\u002F result.residual    — final ||A·x − b||₂\n   \u002F\u002F result.latencyMs   — wall-clock latency\n   \u002F\u002F result.method      — 'cg-sublinear-native' | 'cg-local'   \u003C-- READ THIS\n   \u002F\u002F result.solver      — 'sublinear-time-solver@1.7.0' | 'local-js-cg'\n   \u002F\u002F result.degraded    — true if input failed SPD checks (fall back to step 4)\n   ```\n   The adapter does the dispatch itself: it probes for `mcp__ruflo-sublinear__solve` on `globalThis` (and honours `RUFLO_SUBLINEAR_NATIVE=1` as a manual override), routes through the native kernel when reachable, and falls back transparently to the embedded ~50-LOC JS CG when not. The math is identical either way — CG, dense form, n × n SPD covariance. The operator reads `result.method` to know which backend produced the artifact.\n\n   The native MCP tool's wire shape (for direct callers who want to bypass the adapter):\n   ```text\n   mcp__ruflo-sublinear__solve({\n     matrix: COVARIANCE,\n     rhs: EXPECTED_RETURNS,\n     algorithm: \"cg\",\n     tolerance: 1e-6,\n     maxIterations: 200\n   })\n   ```\n   Output:\n   ```ts\n   { solution: number[], iterations: number, residual: number }\n   ```\n\n4. **Fallback (legacy Neumann)** — if step 3 reports `degraded: true` (non-SPD input, non-square matrix, MCP error) OR if `RUFLO_NEURAL_TRADER_DISABLE_CG=1`:\n   ```bash\n   npx neural-trader --portfolio optimize\n   ```\n   Capture the weights output and tag the artifact metadata with `method: 'neumann-fallback'` and a `reason` field.\n\n5. **Store the optimal weights** to `trading-risk` namespace with full provenance metadata. **Take `method` and `solver` straight from the adapter's result so the operator can verify which backend ran**:\n   ```text\n   mcp__plugin_ruflo-core_ruflo__memory_store({\n     key: \"portfolio-weights-PORTFOLIO_ID-TIMESTAMP\",\n     namespace: \"trading-risk\",\n     value: JSON.stringify({\n       weights: result.solution,           \u002F\u002F number[] from step 3 (or weights from step 4 fallback)\n       method: result.method,              \u002F\u002F 'cg-sublinear-native' | 'cg-local' | 'neumann-fallback'\n       solver: result.solver,              \u002F\u002F 'sublinear-time-solver@1.7.0' | 'local-js-cg' | 'neural-trader-cli'\n       iterations: result.iterations,\n       residual: result.residual,\n       latencyMs: result.latencyMs,\n       capturedAt: NEW_DATE_ISO,\n       reason: FALLBACK_REASON || null\n     })\n   })\n   ```\n   The `trading-risk` namespace is canonical (ADR-126 Phase 1; the five-namespace alignment). Long-lived — no TTL — because portfolio weights are the audit trail Phase 4 will Ed25519-sign.\n\n6. **Cross-check against historical patterns** (optional but recommended):\n   ```text\n   mcp__plugin_ruflo-core_ruflo__agentdb_pattern-search({\n     query: \"portfolio weights Sharpe regime:CURRENT_REGIME\",\n     namespace: \"trading-risk\"\n   })\n   ```\n   If the new weights differ by more than 30% in any single asset from the historical median, flag for human review before applying. This is a guard-rail, not a hard block.\n\n**Acceptance criteria (ADR-126 Phase 3):**\n- Latency \u003C 1 ms on n = 256 covariance (local JS CG); native path target 40-60× faster (816 ns native vs 50 µs Neumann per sublinear-time-solver@1.7.0).\n- Parity with legacy Neumann within `||cg − neumann||_∞ \u003C 1e-4` on a fixed seed.\n- Fallback path engages cleanly when native MCP unavailable \u002F covariance non-SPD.\n- Artifact metadata distinguishes `cg-sublinear-native`, `cg-local`, and `neumann-fallback`.\n\n**Refs**:\n- ADR-126 Phase 3 (this skill's authoring ADR)\n- ADR-123 §162 Row 8 (Wedge 8 speedup claim)\n- ADR-123 §262-289 (the SublinearAdapter contract)\n- `plugins\u002Fruflo-neural-trader\u002Fsrc\u002Fsublinear-adapter.ts` (the adapter)\n- `plugins\u002Fruflo-neural-trader\u002Fbenchmarks\u002Fportfolio-cg.bench.ts` (the measured numbers)\n",{"name":5,"description":7,"allowed-tools":24,"argument-hint":25},"Bash Read mcp__ruflo-sublinear__solve mcp__plugin_ruflo-core_ruflo__memory_store mcp__plugin_ruflo-core_ruflo__memory_retrieve mcp__plugin_ruflo-core_ruflo__memory_search mcp__plugin_ruflo-core_ruflo__agentdb_pattern-search","[--portfolio-id ID] [--tolerance 1e-6]","main","d69096e239f2a89aabc2cd078c47664a9d3b1e11","04-安全渗透\u002Ftrader-portfolio-cg",3,"https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts","https:\u002F\u002Fgithub.com\u002Flza6","个人vx：Tf00798\r\n个人✈：@TFGY999","2026-10-08 14:29:22",{"source":8,"skillName":5,"commands":35,"prompt":45,"zipAvailable":46},[36,39,42],{"tool":37,"command":38},"npx","npx skills add lza6\u002FArmor-piercing-system-prompts --skill trader-portfolio-cg",{"tool":40,"command":41},"bunx","bunx skills add lza6\u002FArmor-piercing-system-prompts --skill trader-portfolio-cg",{"tool":43,"command":44},"pnpm","pnpm dlx skills add lza6\u002FArmor-piercing-system-prompts --skill trader-portfolio-cg","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F04-安全渗透\u002Ftrader-portfolio-cg\u002FSKILL.md",true,[],[49,56,63,70,78,85],{"skillNo":50,"name":51,"nameZh":6,"description":52,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":53,"categories":54,"keywords":55,"publishedAt":19},"01M7EXRM12046G0GM1WGMMFXCN","ci-cd-and-automation","Automates CI\u002FCD pipeline setup. Use when setting up or modifying build and deployment pipelines. Use when you need to automate quality gates, configure test runners in CI, or establish deployment strategies.","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F05-技能与代理开发\u002Fci-cd-and-automation\u002FSKILL.md",[],[],{"skillNo":57,"name":58,"nameZh":6,"description":59,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":60,"categories":61,"keywords":62,"publishedAt":19},"01M7EXRFYYSJ3Y15AGPDDEWWQD","chrome-devtools","Uses Chrome DevTools via MCP for efficient debugging, troubleshooting and browser automation. Use when debugging web pages, automating browser interactions, analyzing performance, or inspecting network requests. This skill does not apply to `--slim` mode (MCP configuration).","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F05-技能与代理开发\u002Fchrome-devtools\u002FSKILL.md",[],[],{"skillNo":64,"name":65,"nameZh":6,"description":66,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":67,"categories":68,"keywords":69,"publishedAt":19},"01M7EXR6EYPE4X5X1BTAE6QJRV","chrome-cdp","Drive a real Chrome via the Chrome DevTools Protocol (CDP). Ensures a\ndebuggable Chrome is running (launching it if needed) so the agent can\nnavigate, read page content, inspect the DOM, run JavaScript, and take\nscreenshots — without the user typing any launch command. Includes a\nfirst-class \"review a live running app\" flow: point Chrome at the app under\ndevelopment and inspect\u002Fscreenshot the REAL page (what a static-artifact tool\ncannot do). Backed by Glimpse and the chrome-devtools MCP server. Use when\nasked to \"use chrome\", \"open chrome\", \"drive my browser\", \"read the page in\nchrome\", \"review the running app\", \"screenshot the app\", or \"\u002Fchrome-cdp\".","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F05-技能与代理开发\u002Fchrome-cdp\u002FSKILL.md",[],[],{"skillNo":71,"name":72,"nameZh":6,"description":73,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":74,"licenseFileUrl":6,"sourceHtmlUrl":75,"categories":76,"keywords":77,"publishedAt":19},"01M7EXR1Y7E79KQKG4J798XGH6","check-identity-pack","Run an AFP 100-point or AUSTRAC safe-harbour identity check over a set of documents, and report exactly what's missing. Use when the user asks to check identity documents, verify someone's ID for onboarding, or assess whether a document pack satisfies Australian identity requirements.","Apache-2.0","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F05-技能与代理开发\u002Fcheck-identity-pack\u002FSKILL.md",[],[],{"skillNo":79,"name":80,"nameZh":6,"description":81,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":82,"categories":83,"keywords":84,"publishedAt":19},"01M7EXQXW7C7PGREJW9ZZTZ16H","changelog","Auto-generates a changelog from git commits, sprint data, and design documents. Produces both internal and player-facing versions.","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F05-技能与代理开发\u002Fchangelog\u002FSKILL.md",[],[],{"skillNo":86,"name":87,"nameZh":6,"description":88,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":89,"categories":90,"keywords":91,"publishedAt":19},"01M7EXQMH2ZME3ANN8Q8MEWPFB","cellxgene-census","Query the CZ CELLxGENE Census programmatically for versioned public single-cell and spatial transcriptomics data. Use when you need population-scale cell metadata, gene expression slices, Census summary counts, source H5AD URIs\u002Fdownloads, embeddings, spatial Census data, or reference atlas comparisons across organisms, tissues, diseases, assays, and cell types. For analyzing your own local single-cell data use scanpy, anndata, or scvi-tools.","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F05-技能与代理开发\u002Fcellxgene-census\u002FSKILL.md",[],[]]