Ship code safely with AI after deal drama / “AI提携が崩れても”安全に開発を回す

person using computer keyboard AI活用術

English

The Meta、Manus reversal is a reminder of something we usually ignore when we’re heads-down shipping: AI access can change overnight. Not because your code got worse, but because the “who can use what, where” part moved under your feet.

So today, instead of discussing geopolitics, I want to give you a practical, boring-in-a-good-way workflow: a vendor-agnostic AI coding setup in VS Code that keeps you productive even if a tool disappears, gets restricted, or becomes “not allowed for this repo.”

Who this is for

  • You use an AI assistant for coding, but you don’t want your whole workflow to depend on one product.
  • You work with private repos or company code and need a clean boundary for what you paste into AI.
  • You want a repeatable way to ask AI for help (bugs, refactors, tests) without turning your codebase into a prompt dump.

What changed this week (in normal words)

Multiple outlets reported that China ordered Meta to unwind its planned acquisition of Manus, even after completion steps had started. The practical takeaway for regular users isn’t the corporate drama. It’s this: cross-border AI tools can become fragile, and “I’ll just use X forever” is not a plan.

That’s why I like workflows that keep your code and your decisions local, and treat AI as a replaceable component.

The 20-minute setup: a “Provider-agnostic AI Coding Loop” in VS Code

This setup uses any chat-style LLM you have access to (cloud or on-prem), but the workflow stays the same. Think of it as a small interface you control.

  • Folder: create /ai-notes in your repo (and add it to .gitignore if it contains sensitive traces).
  • Files: create three files: task.md, context.md, results.md.
  • Rule: you never paste raw secrets, customer data, or full proprietary files into an AI chat. You paste only the minimum snippet that reproduces the issue.

Here’s what each file is for:

  • task.md: the one thing you want done, plus acceptance criteria (what “done” means).
  • context.md: the minimal code snippets, file names, versions, and constraints.
  • results.md: what you tried, what the AI suggested, what you accepted, and what you rejected.

Why this matters: if you switch providers, you don’t lose the reasoning trail. Also, when something breaks, you can see what changed without re-reading a 400-message chat.

Step-by-step workflow (with prompts you can reuse)

Pick one small task. For example: “a flaky unit test” or “a slow function.” Then run this loop.

Step 1: Write the task like a ticket (2 minutes)

Task: Fix failing test `UserService.spec.ts` on CI.

Acceptance criteria:
- Test passes locally and on CI
- No production code behavior change
- Explain the root cause in 3 bullet points

Constraints:
- Do not change external API
- Keep diff < 60 lines

Step 2: Add minimal context (5 minutes)

In context.md, paste only what’s needed: the failing test, the error message, and the function under test. Replace secrets with placeholders.

Environment:
- Node 20
- Vitest 1.6

CI error:
TypeError: Cannot read properties of undefined (reading 'id')

Relevant snippet:
// ... paste 30-80 lines max ...

Notes:
- This fails only on CI (timing?)
- Local run passes

Step 3: Ask for a diagnosis-first answer (3 minutes)

This prompt is designed to stop the AI from jumping straight to random code changes.

You are my coding assistant.

First, diagnose:
1) List 3 likely root causes (ranked) for the CI-only failure.
2) For each cause, propose one quick experiment I can run locally.

Then, propose a fix:
- Provide the smallest possible patch
- Explain why it works
- Add/adjust one test to prevent regression

You must NOT assume access to the full repo.
If information is missing, ask me 3 specific questions.

Task:
<paste task.md>

Context:
<paste context.md>

Step 4: Run one experiment, then re-prompt with evidence (5 minutes)

When you get new logs or confirm a hypothesis, add it to context.md and re-ask:

Update: I ran experiment #2. Result:
- Setting TZ=UTC reproduces the failure locally
- The failing assertion compares formatted dates

Given this evidence, propose a minimal patch.
Also tell me what NOT to change.

Step 5: Record decisions in results.md (5 minutes)

Yes, it feels like extra work. In practice, it saves you later.

Decision log (2026-05-03)
- Root cause: date formatting depended on local timezone
- Accepted fix: normalize to UTC in formatter helper
- Rejected: adding sleep / retry (hides bug)
- Added test: forces TZ=UTC for deterministic snapshot

Safety boundaries that actually work (without being paranoid)

Here are three rules I’ve found realistic for day-to-day coding:

  • Snippet-only policy: paste the smallest reproducible part. If it’s longer than one screen, it’s probably too much.
  • Redaction habit: replace keys, domains, customer identifiers with <REDACTED> before you paste.
  • Patch review rule: you don’t apply AI-generated patches blindly. You read diffs like it’s a teammate PR (because it is).

Also: keep an eye on your org’s policy. Some companies allow AI with certain settings (no training on your data, logged access, etc.). Others don’t. The workflow above still helps because it reduces what you would have shared anyway.

Can you do this for free? What about pricing?

You can do the workflow with free tiers of many AI chat tools, but two costs show up quickly:

  • Usage limits: debugging loops can take several back-and-forth messages. Free plans may throttle you right when you’re close.
  • Context length: paid plans usually allow longer inputs, which is convenient, but don’t use that as an excuse to paste whole files.

My practical suggestion: start with whatever you already have access to, and only upgrade if you feel pain from limits. The main win is the workflow, not the model.

Wrap-up: make your AI assistant swappable

This week’s news is loud, but your daily work doesn’t need to be fragile. If you keep tasks, context, and decision logs in your repo (or alongside it), you can switch AI providers without losing momentum or safety.

Pick one small bug this week and try the loop once. If it feels good, keep the three files as a template. Your future self will thank you.

日本語

MetaとManusの件、ニュースとしては派手なんですが、使う側として刺さるのは別のところなんですよね。「AIツールって、急に使えなくなることがある」って現実です。

今日は政治の話はほぼ抜きにして、開発が止まらないための小さな仕組みを紹介します。特定のAIに依存しない、VS Codeで回せる「入れ替え可能なAIコーディング手順」です。

こんな人におすすめ

  • AIにコードを手伝ってほしいけど、1社のツールに全部乗っかるのは不安な人
  • 会社のリポジトリやプライベートコードを扱っていて、貼り付ける範囲をちゃんと決めたい人
  • デバッグ、リファクタ、テスト追加を“毎回いい感じに”頼める型が欲しい人

今週のニュースを「使う側」に翻訳すると

複数の報道で、中国当局がMetaに対してManus関連の取引を巻き戻すよう求めた、と伝えられています。ここで言いたいのは、どっちが悪いとかではなくて、国境をまたぐAIの利用って「ある日ルールが変わる」ことがある、という点です。

だから私は、AIを“便利な部品”として使いつつ、ワークフロー自体は自分で握るのが好きです。

20分で作る:「AIコーディングの入れ替え可能ループ」

どのAIを使ってもOKです。大事なのは、質問と検証の流れをファイルに残して、AIチャットに依存しないことです。

  • リポジトリに /ai-notes フォルダを作ります(機密に触れるなら .gitignore に入れるのが安心です)。
  • task.mdcontext.mdresults.md の3ファイルを作ります。
  • ルールは1つ。「秘密情報、顧客データ、丸ごとファイル」はAIに貼らない。再現に必要な最小スニペットだけ。

役割はこんな感じです。

  • task.md:やりたいことと、完了条件(ここが曖昧だとAIも迷子になります)
  • context.md:必要最小限のコード、エラー、環境情報
  • results.md:試したこと、採用した案、捨てた案のメモ

チャットは流れて消えますが、この3つは残ります。AIを変えても、続きから作業できるのが強いんです。

手順(スクショで追うつもりの細かさ)

題材は小さくいきましょう。例えば「CIだけ落ちるテスト」みたいなやつがちょうどいいです。

手順1:task.mdに“チケットっぽく”書く(2分)

Task: CIで落ちる `UserService.spec.ts` を直す

完了条件:
- ローカルとCIでテストが通る
- 本番コードの挙動を変えない
- 原因を3つの箇条書きで説明できる

制約:
- 外部APIは変えない
- 差分は60行以内

手順2:context.mdに最小の材料だけ入れる(5分)

エラー全文、落ちているテスト、関係する関数。これだけで十分なことが多いです。キーやURLは <REDACTED> に置き換えます。

環境:
- Node 20
- Vitest 1.6

CIのエラー:
TypeError: Cannot read properties of undefined (reading 'id')

関連スニペット:
// ... 30〜80行くらい(1画面目安) ...

メモ:
- CIだけ失敗する
- ローカルは通る

手順3:「まず診断」を要求するプロンプトで聞く(3分)

いきなり修正案に飛ばれると、無駄な変更が増えがちです。最初は原因候補と実験を出してもらいます。

あなたは私のコーディングアシスタントです。

最初に診断してください:
1) CIだけで失敗する原因を可能性が高い順に3つ
2) それぞれを切り分けるために、ローカルでできる簡単な実験を1つずつ

次に修正案:
- 最小のパッチで
- なぜ効くかを説明
- 再発防止のテストを1つ追加または調整

前提:
- リポジトリ全体にはアクセスできない想定で、断定しない
- 情報が足りないなら、必要な質問を3つだけしてください

Task:
<task.mdを貼る>

Context:
<context.mdを貼る>

手順4:実験を1つやって、結果込みでもう一回聞く(5分)

ここが一番“効きます”。ログや再現条件を渡すと、AIの精度が体感で上がります。

更新: 実験#2を実行しました。
- TZ=UTC を指定するとローカルでも再現します
- 失敗箇所は日付フォーマットの比較です

この証拠を前提に、最小のパッチを提案してください。
あと「やらない方がいい変更」も明示してください。

手順5:results.mdに“採用/不採用”を残す(5分)

これ、地味なんですが後から効きます。「なんでこう直したんだっけ?」が消えません。

Decision log (2026-05-03)
- 原因: タイムゾーン依存で日付文字列が変わっていた
- 採用: formatter helperをUTC基準に正規化
- 不採用: sleep/retryの追加(バグを隠すだけ)
- 追加テスト: TZ=UTCで固定してスナップショットを安定化

安全に使うための現実的な線引き(専門用語は薄め)

難しい話を抜きにすると、私はこの3つを守るだけでかなり事故が減ると思っています。

  • 1画面以上貼らない(長いほど情報漏れと混乱が増えます)
  • 伏せ字を習慣にする(トークン、顧客ID、社内ドメインは <REDACTED>
  • AIのパッチはPRだと思って読む(差分レビューは必須です)

会社のルールがある場合は当然そちら優先で。逆に、ルールが曖昧な職場ほど、この“最小スニペット運用”が効きますよ。

無料で使える?料金は?

この手順自体は無料枠でも回せます。ただ、現実には2つで詰まりやすいです。

  • やり取り回数が多くなって、無料枠の上限に当たる
  • 長い文脈(context)を扱える上位プランの方が楽になる

私のおすすめはシンプルで「いま使える範囲で始めて、上限が痛くなったら課金を検討」です。モデルの強さより、回し方の型の方が効果が残ります。

まとめ:AIは“取り替え可能な相棒”にする

今週のニュースは大きいですが、私たちの作業はもっと小さく、確実にしたいですよね。タスク、文脈、意思決定を自分の側に残しておけば、AIが変わっても開発は止まりません。

今週、ひとつだけでいいので小さなバグ修正にこの3ファイル方式を試してみてください。ハマったらテンプレ化して、次からは“考えなくても回る”状態にしていきましょう。

References / 参考リンク

Photo by Zan Lazarevic on Unsplash