@xiaotianxt/skills 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. package/EXCLUDED.md +42 -0
  2. package/LICENSE +21 -0
  3. package/README.md +165 -0
  4. package/SECURITY.md +23 -0
  5. package/SOURCES.md +45 -0
  6. package/bin/skills.mjs +241 -0
  7. package/package.json +38 -0
  8. package/skills/1password/SKILL.md +94 -0
  9. package/skills/1password/agents/openai.yaml +4 -0
  10. package/skills/1password/references/item-management.md +80 -0
  11. package/skills/1password/references/op-cli.md +107 -0
  12. package/skills/apple-calendar-event/SKILL.md +81 -0
  13. package/skills/apple-calendar-event/agents/openai.yaml +4 -0
  14. package/skills/apple-calendar-event/scripts/calendar_audit.py +201 -0
  15. package/skills/apple-calendar-event/scripts/calendar_event.py +164 -0
  16. package/skills/bro-browser/SKILL.md +118 -0
  17. package/skills/bro-browser/agents/openai.yaml +4 -0
  18. package/skills/bro-browser/references/tool-map.md +102 -0
  19. package/skills/bro-browser/references/workflows.md +146 -0
  20. package/skills/bro-browser/scripts/bro-call.mjs +189 -0
  21. package/skills/calendar/SKILL.md +182 -0
  22. package/skills/calendar/agents/openai.yaml +4 -0
  23. package/skills/calendar/references/operations.md +255 -0
  24. package/skills/calendar/scripts/calendar_list_review.py +157 -0
  25. package/skills/calendar/scripts/event_dedupe_preview.py +155 -0
  26. package/skills/canvas/SKILL.md +70 -0
  27. package/skills/canvas/agents/openai.yaml +4 -0
  28. package/skills/canvas/references/canvas-api.md +76 -0
  29. package/skills/course-exam-review-planner/SKILL.md +127 -0
  30. package/skills/cx/SKILL.md +25 -0
  31. package/skills/gh-fix-ci/LICENSE.txt +201 -0
  32. package/skills/gh-fix-ci/SKILL.md +81 -0
  33. package/skills/gh-fix-ci/agents/openai.yaml +6 -0
  34. package/skills/gh-fix-ci/assets/github-small.svg +3 -0
  35. package/skills/gh-fix-ci/assets/github.png +0 -0
  36. package/skills/gh-fix-ci/scripts/inspect_pr_checks.py +509 -0
  37. package/skills/gh-review-workflow/SKILL.md +61 -0
  38. package/skills/gh-review-workflow/agents/openai.yaml +4 -0
  39. package/skills/gh-review-workflow/references/workflow.md +48 -0
  40. package/skills/gh-review-workflow/scripts/fetch_review_state.py +222 -0
  41. package/skills/gh-review-workflow/scripts/resolve_review_threads.py +83 -0
  42. package/skills/github/SKILL.md +74 -0
  43. package/skills/github/agents/openai.yaml +6 -0
  44. package/skills/github/assets/github-small.svg +3 -0
  45. package/skills/github/assets/github.png +0 -0
  46. package/skills/gws-calendar/SKILL.md +126 -0
  47. package/skills/gws-calendar-agenda/SKILL.md +52 -0
  48. package/skills/gws-calendar-insert/SKILL.md +66 -0
  49. package/skills/gws-docs/SKILL.md +48 -0
  50. package/skills/gws-docs-write/SKILL.md +49 -0
  51. package/skills/gws-drive/SKILL.md +137 -0
  52. package/skills/gws-drive-upload/SKILL.md +52 -0
  53. package/skills/gws-gmail/SKILL.md +62 -0
  54. package/skills/gws-gmail-forward/SKILL.md +55 -0
  55. package/skills/gws-gmail-reply/SKILL.md +58 -0
  56. package/skills/gws-gmail-reply-all/SKILL.md +62 -0
  57. package/skills/gws-gmail-send/SKILL.md +57 -0
  58. package/skills/gws-gmail-triage/SKILL.md +50 -0
  59. package/skills/gws-gmail-watch/SKILL.md +58 -0
  60. package/skills/gws-shared/SKILL.md +27 -0
  61. package/skills/helium-browser-mcp/SKILL.md +137 -0
  62. package/skills/helium-browser-mcp/agents/openai.yaml +4 -0
  63. package/skills/helium-browser-mcp/scripts/obmcp.mjs +92 -0
  64. package/skills/helium-browser-mcp/scripts/openbrowsermcp-stdio-proxy.mjs +170 -0
  65. package/skills/learn/SKILL.md +122 -0
  66. package/skills/learn/agents/openai.yaml +7 -0
  67. package/skills/learn/assets/AGENTS.template.md +33 -0
  68. package/skills/learn/assets/errorlog.template.typ +61 -0
  69. package/skills/learn/assets/reading-sequence.template.md +23 -0
  70. package/skills/learn/assets/source-index.template.md +17 -0
  71. package/skills/learn/assets/tasklog.template.typ +57 -0
  72. package/skills/learn/assets/workbook.template.typ +60 -0
  73. package/skills/learn/references/learning-science.md +103 -0
  74. package/skills/learn/scripts/init_learning_workspace.py +70 -0
  75. package/skills/macos-messages/SKILL.md +258 -0
  76. package/skills/memory/SKILL.md +33 -0
  77. package/skills/memory/codex.md +186 -0
  78. package/skills/memory/opencode.md +164 -0
  79. package/skills/mimestreamctl/SKILL.md +170 -0
  80. package/skills/mimestreamctl/agents/openai.yaml +4 -0
  81. package/skills/mimestreamctl/scripts/mimestreamctl +33 -0
  82. package/skills/mon/SKILL.md +51 -0
  83. package/skills/mon/scripts/mon_spend_review.py +458 -0
  84. package/skills/ocr/SKILL.md +136 -0
  85. package/skills/ocr/agents/openai.yaml +4 -0
  86. package/skills/ocr/references/local-ocr-best-practices.md +297 -0
  87. package/skills/ocr/references/mineru-api.md +159 -0
  88. package/skills/ocr/scripts/ocr-router +22 -0
  89. package/skills/ocr/scripts/ocr_router.py +741 -0
  90. package/skills/panopto-mp4-bulk-download/SKILL.md +57 -0
  91. package/skills/panopto-mp4-bulk-download/agents/openai.yaml +4 -0
  92. package/skills/panopto-mp4-bulk-download/references/url-patterns.md +26 -0
  93. package/skills/panopto-mp4-bulk-download/scripts/panopto_bulk_mp4.sh +213 -0
  94. package/skills/rust-systems-style/SKILL.md +109 -0
  95. package/skills/rust-systems-style/agents/openai.yaml +4 -0
  96. package/skills/rust-systems-style/references/rust-review-checklist.md +77 -0
  97. package/skills/rust-systems-style/references/style-sources.md +68 -0
  98. package/skills/ship-ai-native-cli/SKILL.md +76 -0
  99. package/skills/ship-ai-native-cli/agents/openai.yaml +4 -0
  100. package/skills/ship-ai-native-cli/references/case-notes.md +83 -0
  101. package/skills/ship-ai-native-cli/references/product-method.md +82 -0
  102. package/skills/ship-ai-native-cli/references/release-checklist.md +147 -0
  103. package/skills/ship-ai-native-cli/references/rust-cli-shape.md +111 -0
  104. package/skills/telegram-mtproto-session/SKILL.md +125 -0
  105. package/skills/telegram-mtproto-session/agents/openai.yaml +4 -0
  106. package/skills/telegram-mtproto-session/scripts/telegram_session.py +687 -0
  107. package/skills/tg/SKILL.md +173 -0
  108. package/skills/things3-manager/SKILL.md +116 -0
  109. package/skills/things3-manager/scripts/things +42 -0
  110. package/skills/things3-manager/scripts/things_cli.py +514 -0
  111. package/skills/web-artifacts-builder/LICENSE.txt +202 -0
  112. package/skills/web-artifacts-builder/SKILL.md +74 -0
  113. package/skills/web-artifacts-builder/scripts/bundle-artifact.sh +54 -0
  114. package/skills/web-artifacts-builder/scripts/init-artifact.sh +379 -0
  115. package/skills/web-artifacts-builder/scripts/shadcn-components.tar.gz +0 -0
  116. package/skills/yeet/LICENSE.txt +201 -0
  117. package/skills/yeet/SKILL.md +71 -0
  118. package/skills/yeet/agents/openai.yaml +6 -0
  119. package/skills/yeet/assets/yeet-small.svg +3 -0
  120. package/skills/yeet/assets/yeet.png +0 -0
@@ -0,0 +1,83 @@
1
+ # Case Notes From tg, cx, mon
2
+
3
+ ## Shared Project Shape
4
+
5
+ All three converge on:
6
+
7
+ - short binary name and repo under `~/dev/<name>`;
8
+ - Rust CLI with `clap` and small modules;
9
+ - `README.md` for humans;
10
+ - `SKILL.md` for Codex operation;
11
+ - `docs/architecture.md` or workflow design notes for maintainers;
12
+ - `Makefile`;
13
+ - `scripts/install.sh`;
14
+ - `scripts/release.sh`;
15
+ - GitHub CI and tag-triggered release workflow;
16
+ - Homebrew tap formula that installs prebuilt arm64 binaries;
17
+ - real installed-binary verification after release.
18
+
19
+ ## tg Lessons
20
+
21
+ `tg` started from a fragile local-data problem and became usable by hiding
22
+ low-level recovery steps behind task-level commands.
23
+
24
+ Useful patterns:
25
+
26
+ - default command maps to the primary user job;
27
+ - `refresh` and `doctor` separate maintenance from diagnosis;
28
+ - `sessions` provides discovery before exact reads;
29
+ - exports support `txt`, `csv`, and `json`;
30
+ - sensitive local data stays local;
31
+ - `SKILL.md` tells agents how to operate the tool, not how internals work.
32
+
33
+ Product lesson: users want a chat-history tool, not a database-decryption
34
+ toolkit. Low-level commands can exist, but they should not dominate the product
35
+ frame.
36
+
37
+ ## cx Lessons
38
+
39
+ `cx` wrapped an everyday manual workflow into one fast command.
40
+
41
+ Useful patterns:
42
+
43
+ - direct default action: `cx` launches through the best slot;
44
+ - management commands are explicit: `status`, `select`, `add`, `login`, `doctor`;
45
+ - stdin wrapping is part of the product contract;
46
+ - status output needed iteration to become human-readable;
47
+ - transient network failure gets a conservative fallback;
48
+ - release automation came early because the tool is used constantly.
49
+
50
+ Product lesson: for a workflow tool, optimize the default path first. Users
51
+ should not have to remember the implementation model on every run.
52
+
53
+ ## mon Lessons
54
+
55
+ `mon` is the boundary-discipline case.
56
+
57
+ Useful patterns:
58
+
59
+ - expose the remote service as a general, structured, agent-native API surface;
60
+ - provide `auth`, `accounts`, `transactions`, `gql`, `doctor`;
61
+ - test against real credentials and real API responses;
62
+ - treat rate limits, MFA, redirects, and CAPTCHA as product behavior;
63
+ - reuse sessions before attempting password login;
64
+ - keep domain-specific reconciliation outside the generic API tool.
65
+
66
+ Product lesson: the first concrete use case can reveal the tool, but should not
67
+ own the tool. Put one-off settlement or reconciliation logic in a separate
68
+ project folder or downstream skill.
69
+
70
+ ## Conversation-Derived Method
71
+
72
+ The successful sessions followed this rhythm:
73
+
74
+ 1. User states a concrete pain.
75
+ 2. Codex inspects existing local evidence before designing.
76
+ 3. First version ships a narrow but real vertical slice.
77
+ 4. User tries it immediately.
78
+ 5. Failures become product requirements, not just bug fixes.
79
+ 6. The repo gains release/Homebrew automation once the loop proves useful.
80
+ 7. Scope mistakes are corrected by moving domain-specific logic out of the core.
81
+
82
+ Use this loop intentionally. Do not wait for perfect architecture before the
83
+ first real smoke test.
@@ -0,0 +1,82 @@
1
+ # Product Method
2
+
3
+ ## The Pattern
4
+
5
+ The repeated shape across `tg`, `cx`, and `mon` is:
6
+
7
+ 1. Find a repeated local job that is painful enough to deserve a command.
8
+ 2. Collapse the job into a small command taxonomy.
9
+ 3. Implement a direct, local, deterministic vertical slice.
10
+ 4. Add diagnostics and recovery paths before broadening features.
11
+ 5. Make the tool agent-native with JSON output and stable error behavior.
12
+ 6. Ship it like a real product: docs, CI, release assets, Homebrew, installed smoke test.
13
+
14
+ ## Product Frame Template
15
+
16
+ Use this before writing code:
17
+
18
+ ```text
19
+ <name> is a <platform/domain> CLI for <user job>.
20
+ It should let a user/agent do <primary outcome> without manually doing <old workflow>.
21
+ The first shipped slice is <smallest real command set>.
22
+ It is not <non-goals>.
23
+ ```
24
+
25
+ Examples:
26
+
27
+ - `tg`: read/search/export local chat history without manually opening databases.
28
+ - `cx`: launch Codex through the best available auth slot without manual account rotation.
29
+ - `mon`: query Monarch data through a stable local CLI without browser scraping.
30
+
31
+ ## Command Taxonomy
32
+
33
+ Prefer this order:
34
+
35
+ 1. Primary task command: the thing users actually came for.
36
+ 2. Discovery command: list/find/select available targets.
37
+ 3. Data command: stable JSON for agents and scripts.
38
+ 4. Maintenance command: refresh/cache/auth/install.
39
+ 5. Diagnostic command: `doctor`, with read-only checks by default.
40
+ 6. Escape hatch: raw API/query command for future needs.
41
+
42
+ Avoid exposing implementation chores as the first screen unless the domain
43
+ requires setup. If setup is required, make it explicit and diagnoseable.
44
+
45
+ ## AI-Native Contract
46
+
47
+ AI-native means an agent can operate the tool without screen scraping or hidden
48
+ state guesses:
49
+
50
+ - `--json` for data-bearing commands.
51
+ - Machine-readable rows with stable field names.
52
+ - Human tables for quick terminal use.
53
+ - Secrets never printed by default.
54
+ - Errors include the failing subsystem and next useful action.
55
+ - Commands can be composed in shell pipelines.
56
+ - Local state paths can be overridden by env vars or flags.
57
+
58
+ ## Boundary Discipline
59
+
60
+ When a user asks for a specific workflow while building a general tool, separate
61
+ the layers:
62
+
63
+ - Put **generic access** in the CLI.
64
+ - Put **domain-specific reconciliation or analysis** in a project folder,
65
+ downstream script, or separate skill.
66
+ - Promote a domain workflow into the CLI only after it proves general and stable.
67
+
68
+ The `mon` rent detour is the cautionary case: payment reconciliation belonged in
69
+ the rent tracking folder, while `mon` should stay a general Monarch API surface.
70
+
71
+ ## First Slice
72
+
73
+ For a new CLI, ship the smallest version that can be used immediately:
74
+
75
+ - `auth/status` or equivalent local setup if needed.
76
+ - One read-only command that returns real useful data.
77
+ - `--json`.
78
+ - `doctor`.
79
+ - README install/usage.
80
+ - CI and release path.
81
+
82
+ Only add mutation commands after read-only behavior is verified.
@@ -0,0 +1,147 @@
1
+ # Release Checklist
2
+
3
+ ## Local Verification
4
+
5
+ Run before committing:
6
+
7
+ ```bash
8
+ cargo fmt --all -- --check
9
+ cargo check
10
+ cargo test
11
+ cargo build --release
12
+ cargo run -- --help
13
+ ```
14
+
15
+ Also run the most important real-world smoke test:
16
+
17
+ - local app/database access for local tools;
18
+ - authenticated read-only API call for API tools;
19
+ - installed binary behavior after Homebrew install.
20
+
21
+ ## Makefile
22
+
23
+ Include:
24
+
25
+ ```makefile
26
+ .PHONY: build check fmt test install-local install release clean
27
+
28
+ build:
29
+ cargo build --release
30
+
31
+ check:
32
+ cargo check
33
+
34
+ fmt:
35
+ cargo fmt --all
36
+
37
+ test:
38
+ cargo test
39
+
40
+ install-local: build
41
+ mkdir -p ~/.local/bin
42
+ cp target/release/<bin> ~/.local/bin/
43
+
44
+ install: build
45
+ sudo cp target/release/<bin> /usr/local/bin/
46
+
47
+ release:
48
+ scripts/release.sh
49
+
50
+ clean:
51
+ cargo clean
52
+ rm -f ~/.local/bin/<bin> 2>/dev/null || true
53
+ ```
54
+
55
+ ## CI
56
+
57
+ Use macOS arm64 when the product is macOS-specific or distributed as
58
+ `darwin-arm64`:
59
+
60
+ ```yaml
61
+ name: CI
62
+ on:
63
+ push:
64
+ branches: [main]
65
+ pull_request:
66
+ branches: [main]
67
+ env:
68
+ CARGO_TERM_COLOR: always
69
+ FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
70
+ jobs:
71
+ build:
72
+ runs-on: macos-latest
73
+ steps:
74
+ - uses: actions/checkout@v4
75
+ - uses: actions-rust-lang/setup-rust-toolchain@v1
76
+ - name: Verify arm64 runner
77
+ run: test "$(uname -m)" = "arm64"
78
+ - name: Format
79
+ run: cargo fmt --all -- --check
80
+ - name: Build
81
+ run: cargo build --release
82
+ - name: Test
83
+ run: cargo test
84
+ - name: Verify CLI
85
+ run: cargo run --release -- --help
86
+ ```
87
+
88
+ ## Release Workflow
89
+
90
+ On tag `v*`:
91
+
92
+ 1. Build release binary on `macos-latest`.
93
+ 2. Archive `target/release/<bin>` into `<bin>-${{ github.ref_name }}-darwin-arm64.tar.gz`.
94
+ 3. Upload artifact.
95
+ 4. Create GitHub release with `softprops/action-gh-release@v2`.
96
+
97
+ ## Homebrew Formula Rules
98
+
99
+ Prefer prebuilt release assets:
100
+
101
+ ```ruby
102
+ class Tool < Formula
103
+ desc "..."
104
+ homepage "https://github.com/<owner>/<repo>"
105
+ url "https://github.com/<owner>/<repo>/releases/download/vX.Y.Z/tool-vX.Y.Z-darwin-arm64.tar.gz"
106
+ sha256 "..."
107
+ license "MIT"
108
+
109
+ depends_on arch: :arm64
110
+
111
+ head do
112
+ url "https://github.com/<owner>/<repo>.git", branch: "main"
113
+ depends_on "rust" => :build
114
+ end
115
+
116
+ def install
117
+ if build.head?
118
+ system "cargo", "install", "--bin", "tool", "--root", prefix, "."
119
+ else
120
+ bin.install "tool"
121
+ end
122
+ end
123
+
124
+ test do
125
+ system bin/"tool", "--help"
126
+ end
127
+ end
128
+ ```
129
+
130
+ Avoid requiring Rust for normal `brew install`; only `--HEAD` should build from
131
+ source.
132
+
133
+ ## Release Script Behavior
134
+
135
+ The release script should:
136
+
137
+ 1. Refuse dirty source and dirty tap checkouts.
138
+ 2. Pull tap and fetch source tags.
139
+ 3. Bump `Cargo.toml` and `Cargo.lock` when requested.
140
+ 4. Run tests.
141
+ 5. Push main and tag.
142
+ 6. Wait for GitHub Actions release.
143
+ 7. Read or compute asset sha256.
144
+ 8. Update `Formula/<bin>.rb` in the tap and push it.
145
+ 9. Run `brew update`, `brew upgrade/reinstall`, and `brew test`.
146
+
147
+ Do not call the release complete until `brew test` passes.
@@ -0,0 +1,111 @@
1
+ # Rust CLI Shape
2
+
3
+ ## Default File Tree
4
+
5
+ Use this shape unless the repo already has a stronger local convention:
6
+
7
+ ```text
8
+ project/
9
+ .github/workflows/ci.yml
10
+ .github/workflows/release.yml
11
+ .gitignore
12
+ Cargo.toml
13
+ Cargo.lock
14
+ LICENSE
15
+ Makefile
16
+ README.md
17
+ SKILL.md
18
+ docs/architecture.md
19
+ scripts/install.sh
20
+ scripts/release.sh
21
+ src/
22
+ main.rs
23
+ cli.rs
24
+ client.rs # API or local app boundary, if applicable
25
+ output.rs # human tables + JSON
26
+ paths.rs # local state paths
27
+ session.rs # auth/session state, if applicable
28
+ install.rs
29
+ ```
30
+
31
+ Add modules only when the domain forces them. Keep names boring and explicit.
32
+
33
+ ## Cargo Defaults
34
+
35
+ Use `edition = "2021"` for compatibility unless there is a reason to move.
36
+
37
+ Common dependencies:
38
+
39
+ ```toml
40
+ anyhow = "1"
41
+ clap = { version = "4", features = ["derive"] }
42
+ reqwest = { version = "0.12", default-features = false, features = ["blocking", "json", "rustls-tls"] }
43
+ serde = { version = "1", features = ["derive"] }
44
+ serde_json = "1"
45
+ ```
46
+
47
+ Use `rusqlite`, `toml`, `chrono`, `rpassword`, etc. only when the product needs
48
+ them. Avoid async runtimes unless concurrency is central to the tool.
49
+
50
+ ## CLI Design
51
+
52
+ In `src/main.rs`:
53
+
54
+ - Keep `main()` as a thin `ExitCode` wrapper.
55
+ - Put command parsing in `cli.rs`.
56
+ - Dispatch commands explicitly.
57
+ - Print errors as `name: {err:#}`.
58
+
59
+ In `src/cli.rs`:
60
+
61
+ - Use `clap::{Parser, Subcommand, Args}`.
62
+ - Prefer typed args over stringly parsing.
63
+ - Add `--json` to agent-consumed data commands.
64
+ - Add `--session-file`, `--config-dir`, or env overrides where local state matters.
65
+
66
+ ## Output
67
+
68
+ Split output from logic:
69
+
70
+ - Human tables should be compact and terminal-friendly.
71
+ - JSON should be uncontaminated stdout.
72
+ - Progress/warnings should go to stderr when stdout is data.
73
+ - Avoid long wrapped lines in status output; use short columns or sections.
74
+
75
+ ## Local State
76
+
77
+ Use predictable paths:
78
+
79
+ ```text
80
+ ~/.<tool>/session.json
81
+ ~/.<tool>/cache/
82
+ ```
83
+
84
+ Support env overrides:
85
+
86
+ ```text
87
+ TOOL_SESSION_FILE
88
+ TOOL_CONFIG_DIR
89
+ ```
90
+
91
+ Secrets:
92
+
93
+ - chmod token/session files to `0600` on Unix.
94
+ - Never commit generated local state.
95
+ - Never print tokens in status output.
96
+
97
+ ## Core Commands To Consider
98
+
99
+ ```text
100
+ tool # default primary action, if unambiguous
101
+ tool status # quick state, if status matters
102
+ tool auth ... # login/token/logout, if remote API
103
+ tool list/find # discovery
104
+ tool get/search # data access
105
+ tool gql/query/raw # escape hatch for APIs
106
+ tool refresh # maintenance
107
+ tool doctor # diagnostics
108
+ tool install # local install into ~/.local/bin
109
+ ```
110
+
111
+ Do not add every command. Pick the smallest taxonomy that matches the product.
@@ -0,0 +1,125 @@
1
+ ---
2
+ name: telegram-mtproto-session
3
+ description: Create, verify, and use local Telegram MTProto user sessions with Telethon, including fast date-bounded chat history sync into local SQLite/FTS and local history queries. Use when Codex needs to log in to Telegram with a phone account, validate an existing .session file, read Telegram channel/group/chat history, search or inspect Telegram chats through the user API, or recover from broken/unauthorized sessions while keeping Telegram app credentials in macOS Keychain.
4
+ ---
5
+
6
+ # Telegram MTProto Session
7
+
8
+ Use this skill for Telegram user-account access through MTProto/Telethon. This is separate from bot-token workflows and separate from the `tg` skill, which is for local WeChat history on this machine.
9
+
10
+ ## Rules
11
+
12
+ - Read Telegram app credentials from macOS Keychain; do not paste API IDs, hashes, phone numbers, login codes, or 2FA passwords into files or final responses.
13
+ - Prefer these Keychain entries:
14
+ - `keychain-secret get codex.telegram api_id`
15
+ - `keychain-secret get codex.telegram api_hash`
16
+ - `keychain-secret get codex.telegram phone`
17
+ - One-time migration from 1Password, when needed:
18
+ - `keychain-secret import-op codex.telegram api_id 'op://Private/Telegram Apps/api_id'`
19
+ - `keychain-secret import-op codex.telegram api_hash 'op://Private/Telegram Apps/api_hash'`
20
+ - `keychain-secret import-op codex.telegram phone 'op://Private/Telegram Apps/telegram_phone'`
21
+ - Use a dedicated session path under `~/.local/share/codex-telegram/` unless the user asks for another location.
22
+ - Use the bundled SQLite history store for high-volume reads:
23
+ `~/.local/share/codex-telegram/history.sqlite3`.
24
+ - Treat `.session` files as sensitive account credentials. Do not commit, upload, or print their raw contents.
25
+ - If Keychain reads, Telethon network calls, or SQLite opens under `~/.local/share`
26
+ fail under sandboxing, rerun the same scoped command with approval.
27
+ - Respect Telegram rate limits. If a command reports `FloodWaitError`, stop and report the wait duration.
28
+
29
+ ## Script
30
+
31
+ Use `scripts/telegram_session.py` from this skill directory. It requires Telethon and reads credentials from environment variables:
32
+
33
+ ```bash
34
+ TELEGRAM_API_ID="$(keychain-secret get codex.telegram api_id)" \
35
+ TELEGRAM_API_HASH="$(keychain-secret get codex.telegram api_hash)" \
36
+ TELEGRAM_PHONE="$(keychain-secret get codex.telegram phone)" \
37
+ python3 scripts/telegram_session.py --session ~/.local/share/codex-telegram/telegram login
38
+ ```
39
+
40
+ When login sends a Telegram code, ask the user for the code in chat or have them type it into the running command. If Telegram asks for 2FA, prefer prompting interactively with `getpass`; do not ask the user to paste a long-lived password into chat unless they explicitly choose that path.
41
+
42
+ ## Workflows
43
+
44
+ ### Verify A Session
45
+
46
+ ```bash
47
+ TELEGRAM_API_ID="$(keychain-secret get codex.telegram api_id)" \
48
+ TELEGRAM_API_HASH="$(keychain-secret get codex.telegram api_hash)" \
49
+ python3 scripts/telegram_session.py --session ~/.local/share/codex-telegram/telegram verify
50
+ ```
51
+
52
+ Expected successful output includes `authorized=True`, the session path, and the Telegram user id/username. If `authorized=False`, run `login`.
53
+
54
+ ### Search Public Telegram Chats
55
+
56
+ ```bash
57
+ TELEGRAM_API_ID="$(keychain-secret get codex.telegram api_id)" \
58
+ TELEGRAM_API_HASH="$(keychain-secret get codex.telegram api_hash)" \
59
+ python3 scripts/telegram_session.py --session ~/.local/share/codex-telegram/telegram search 'linux.do'
60
+ ```
61
+
62
+ Use this for public channel/group discovery. It prints title, username, kind, participants, and id.
63
+
64
+ ### Inspect A Channel Or Group
65
+
66
+ ```bash
67
+ TELEGRAM_API_ID="$(keychain-secret get codex.telegram api_id)" \
68
+ TELEGRAM_API_HASH="$(keychain-secret get codex.telegram api_hash)" \
69
+ python3 scripts/telegram_session.py --session ~/.local/share/codex-telegram/telegram inspect linux_do --limit 5
70
+ ```
71
+
72
+ Use `inspect` to resolve a known username, print channel metadata, and summarize recent messages. Message summaries include reply/comment metadata when Telegram exposes it.
73
+
74
+ ### Fast History Sync And Local Query
75
+
76
+ For date-bounded history, prefer `today` or `sync` so messages are cached in
77
+ local SQLite with WAL and FTS5 indexes. `today` syncs one local day and prints
78
+ the resulting rows:
79
+
80
+ ```bash
81
+ TELEGRAM_API_ID="$(keychain-secret get codex.telegram api_id)" \
82
+ TELEGRAM_API_HASH="$(keychain-secret get codex.telegram api_hash)" \
83
+ python3 scripts/telegram_session.py --session ~/.local/share/codex-telegram/telegram \
84
+ today @linux_do_channel --day 2026-05-08 --timezone America/Los_Angeles
85
+ ```
86
+
87
+ Use `sync` when you want to warm the local cache without printing messages:
88
+
89
+ ```bash
90
+ TELEGRAM_API_ID="$(keychain-secret get codex.telegram api_id)" \
91
+ TELEGRAM_API_HASH="$(keychain-secret get codex.telegram api_hash)" \
92
+ python3 scripts/telegram_session.py --session ~/.local/share/codex-telegram/telegram \
93
+ sync @linux_do_channel --since 2026-05-01 --until 2026-05-08 --timezone America/Los_Angeles
94
+ ```
95
+
96
+ Use `query` for local-only reads after sync:
97
+
98
+ ```bash
99
+ python3 scripts/telegram_session.py query @linux_do_channel \
100
+ --since 2026-05-08 --until 2026-05-08 --timezone America/Los_Angeles
101
+ ```
102
+
103
+ Add `--match '<fts expression>'` to search message text through SQLite FTS5.
104
+ Add `--format jsonl` when downstream tooling should parse rows.
105
+
106
+ ### List Joined Dialogs
107
+
108
+ ```bash
109
+ TELEGRAM_API_ID="$(keychain-secret get codex.telegram api_id)" \
110
+ TELEGRAM_API_HASH="$(keychain-secret get codex.telegram api_hash)" \
111
+ python3 scripts/telegram_session.py --session ~/.local/share/codex-telegram/telegram dialogs --match linux
112
+ ```
113
+
114
+ Use this when the user says the session is already joined to a group/channel but the public username is unknown.
115
+
116
+ ## Common Fixes
117
+
118
+ - `missing required env`: load credentials through the exact `keychain-secret get` commands above.
119
+ - `authorized=False`: the session file is missing, expired, or was created for another account; run `login`.
120
+ - `SessionPasswordNeededError`: Telegram account has 2FA enabled; let the script prompt via `getpass`.
121
+ - `FloodWaitError`: stop and report the wait duration; do not retry aggressively.
122
+ - Public search finds candidates but `inspect` fails: the channel may require joining, may be private, or may be blocked by account restrictions.
123
+ - `query` returns no rows: run `sync` or `today` for that chat/date first, or check that the local date and `--timezone` match the intended day.
124
+ - `sqlite3.OperationalError: unable to open database file` in Codex sandbox:
125
+ run the same query with approval, or point `--db` at a writable/readable task-local path.
@@ -0,0 +1,4 @@
1
+ interface:
2
+ display_name: "Telegram MTProto Session"
3
+ short_description: "Read Telegram via local MTProto sessions and SQLite history."
4
+ default_prompt: "Use the local Telegram MTProto session to verify access, sync date-bounded chat history into SQLite, or query cached Telegram messages."